CVS commit: src/sys/arch/arm/include

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 07:04:15 UTC 2012

Modified Files:
src/sys/arch/arm/include: lock.h

Log Message:
Add required dsb/dmb instructions (or placeholders for them) required for
the weak memory ordering of the ARMV7-A architecture.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/include/lock.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/arm/include/lock.h
diff -u src/sys/arch/arm/include/lock.h:1.19 src/sys/arch/arm/include/lock.h:1.20
--- src/sys/arch/arm/include/lock.h:1.19	Mon Jul 23 12:36:41 2012
+++ src/sys/arch/arm/include/lock.h	Wed Aug 29 07:04:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.19 2012/07/23 12:36:41 matt Exp $	*/
+/*	$NetBSD: lock.h,v 1.20 2012/08/29 07:04:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -74,19 +74,42 @@ __cpu_simple_lock_set(__cpu_simple_lock_
 #endif
 
 #if defined(_KERNEL)
-static __inline int
-__swp(int __val, volatile unsigned char *__ptr)
+static __inline __cpu_simple_lock_t
+__swp(__cpu_simple_lock_t __val, volatile __cpu_simple_lock_t *__ptr)
 {
 #ifdef _ARM_ARCH_6
-	int __rv, __tmp;
-	__asm volatile(
-		1:\t
-		ldrexb\t%[__rv], [%[__ptr]]			\n\t
-		strexb\t%[__tmp], %[__val], [%[__ptr]]	\n\t
-		cmp\t%[__tmp], #0\n\t
-		bne 1b
-	: [__rv] =r (__rv), [__tmp] =r(__tmp)
-	: [__val] r (__val), [__ptr] r (__ptr) : cc, memory);
+	__cpu_simple_lock_t __rv, __tmp;
+	if (sizeof(*__ptr) == 1) {
+		__asm volatile(
+			1:\t
+			ldrexb\t%[__rv], [%[__ptr]]			\n\t
+			cmp\t%[__rv],%[__val]\n\t
+			strexbne\t%[__tmp], %[__val], [%[__ptr]]	\n\t
+			cmpne\t%[__tmp], #0\n\t
+			bne\t1b	\n\t
+#ifdef _ARM_ARCH_7
+			dmb
+#else
+			mrc p15, 0, %[__tmp], c7, c10, 5
+#endif
+		: [__rv] =r (__rv), [__tmp] =r(__tmp)
+		: [__val] r (__val), [__ptr] r (__ptr) : cc, memory);
+	} else {
+		__asm volatile(
+			1:\t
+			ldrex\t%[__rv], [%[__ptr]]			\n\t
+			cmp\t%[__rv],%[__val]\n\t
+			strexne\t%[__tmp], %[__val], [%[__ptr]]	\n\t
+			cmpne\t%[__tmp], #0\n\t
+			bne\t1b	\n\t
+#ifdef _ARM_ARCH_7
+			nop
+#else
+			mrc p15, 0, %[__tmp], c7, c10, 5
+#endif
+		: [__rv] =r (__rv), [__tmp] =r(__tmp)
+		: [__val] r (__val), [__ptr] r (__ptr) : cc, memory);
+	}
 	return __rv;
 #else
 	__asm volatile(swpb %0, %1, [%2]
@@ -95,13 +118,41 @@ __swp(int __val, volatile unsigned char 
 #endif
 }
 #else
+/*
+ * On Cortex-A9 (SMP), SWP no longer guarantees atomic results.  Thus we pad
+ * out SWP so that when the A9 generates an undefined exception we can replace
+ * the SWP/MOV instructions with the right LDREX/STREX instructions.
+ *
+ * This is why we force the SWP into the template needed for LDREX/STREX
+ * including the extra instructions and extra register for testing the result.
+ */
 static __inline int
 __swp(int __val, volatile int *__ptr)
 {
-
-	__asm volatile(swp %0, %1, [%2]
-	: =r (__val) : r (__val), r (__ptr) : memory);
-	return __val;
+	int __rv, __tmp;
+	__asm volatile(
+		1:\t
+#ifdef _ARM_ARCH_6
+		ldrex\t%[__rv], [%[__ptr]]			\n\t
+		cmp\t%[__rv],%[__val]\n\t
+		strexne\t%[__tmp], %[__val], [%[__ptr]]	\n\t
+#else
+		swp\t%[__rv], %[__val], [%[__ptr]]		\n\t
+		cmp\t%[__rv],%[__val]\n\t
+		movs\t%[__tmp], #0\n\t
+#endif
+		cmpne\t%[__tmp], #0\n\t
+		bne\t1b	\n\t
+#ifdef _ARM_ARCH_7
+		dmb
+#elif defined(_ARM_ARCH_6)
+		mrc p15, 0, %[__tmp], c7, c10, 5
+#else
+		nop
+#endif
+	: [__rv] =r (__rv), [__tmp] =r(__tmp)
+	: [__val] r (__val), [__ptr] r (__ptr) : cc, memory);
+	return __rv;
 }
 #endif /* _KERNEL */
 
@@ -110,6 +161,9 @@ __cpu_simple_lock_init(__cpu_simple_lock
 {
 
 	*alp = __SIMPLELOCK_UNLOCKED;
+#ifdef _ARM_ARCH_7
+	__asm __volatile(dsb);
+#endif
 }
 
 static __inline void __attribute__((__unused__))
@@ -131,7 +185,13 @@ static __inline void __attribute__((__un
 __cpu_simple_unlock(__cpu_simple_lock_t *alp)
 {
 
+#ifdef _ARM_ARCH_7
+	__asm __volatile(dmb);
+#endif
 	*alp = __SIMPLELOCK_UNLOCKED;
+#ifdef _ARM_ARCH_7
+	__asm __volatile(dsb);
+#endif
 }
 
 #endif /* _ARM_LOCK_H_ */



CVS commit: src/sys/arch

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 07:14:06 UTC 2012

Modified Files:
src/sys/arch/arm/arm: arm_machdep.c cpufunc.c
src/sys/arch/arm/arm32: cpuswitch.S locore.S
src/sys/arch/arm/conf: files.arm
src/sys/arch/arm/include: cpu.h
src/sys/arch/evbarm/conf: std.beagle std.igepv2 std.overo std.tisdp24xx

Log Message:
Rename ARM options PROCESS_ID_IS_CUR{CPU,LWP} to TPIDRPRW_IS_CUR{CPU,LWP}
since TPIDRPRW is the cp15 register name.
Initialize it early in start along with CI_ARM_CPUID.
Remove other initializations.
We alays have ci_curlwp.
Enable TIPRPRW_IS_CURCPU in std.beagle.
[tested on a beaglboard (cortex-a8)]


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/arm/arm_machdep.c
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/arm/arm/cpufunc.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/arm32/cpuswitch.S
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/arm32/locore.S
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/std.beagle
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/std.igepv2 \
src/sys/arch/evbarm/conf/std.overo
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/std.tisdp24xx

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/arm/arm/arm_machdep.c
diff -u src/sys/arch/arm/arm/arm_machdep.c:1.33 src/sys/arch/arm/arm/arm_machdep.c:1.34
--- src/sys/arch/arm/arm/arm_machdep.c:1.33	Thu Aug 16 17:35:01 2012
+++ src/sys/arch/arm/arm/arm_machdep.c	Wed Aug 29 07:14:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_machdep.c,v 1.33 2012/08/16 17:35:01 matt Exp $	*/
+/*	$NetBSD: arm_machdep.c,v 1.34 2012/08/29 07:14:03 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -78,7 +78,7 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(0, $NetBSD: arm_machdep.c,v 1.33 2012/08/16 17:35:01 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm_machdep.c,v 1.34 2012/08/29 07:14:03 matt Exp $);
 
 #include sys/exec.h
 #include sys/proc.h
@@ -103,9 +103,7 @@ char	machine_arch[] = MACHINE_ARCH;	/* f
 /* Our exported CPU info; we can have only one. */
 struct cpu_info cpu_info_store = {
 	.ci_cpl = IPL_HIGH,
-#ifndef PROCESS_ID_IS_CURLWP
 	.ci_curlwp = lwp0,
-#endif
 };
 
 const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {

Index: src/sys/arch/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.110 src/sys/arch/arm/arm/cpufunc.c:1.111
--- src/sys/arch/arm/arm/cpufunc.c:1.110	Thu Aug 16 18:22:38 2012
+++ src/sys/arch/arm/arm/cpufunc.c	Wed Aug 29 07:14:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.110 2012/08/16 18:22:38 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.111 2012/08/29 07:14:03 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.110 2012/08/16 18:22:38 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.111 2012/08/29 07:14:03 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -2697,14 +2697,6 @@ arm11_setup(char *args)
 {
 	int cpuctrl, cpuctrlmask;
 
-#if defined(PROCESS_ID_IS_CURCPU)
-	/* set curcpu() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(cpu_info_store));
-#elif defined(PROCESS_ID_IS_CURLWP)
-	/* set curlwp() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(lwp0));
-#endif
-
 	cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE
 	| CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE
 	/* | CPU_CONTROL_BPRD_ENABLE */;
@@ -2752,14 +2744,6 @@ arm11mpcore_setup(char *args)
 {
 	int cpuctrl, cpuctrlmask;
 
-#if defined(PROCESS_ID_IS_CURCPU)
-	/* set curcpu() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(cpu_info_store));
-#elif defined(PROCESS_ID_IS_CURLWP)
-	/* set curlwp() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(lwp0));
-#endif
-
 	cpuctrl = CPU_CONTROL_IC_ENABLE
 	| CPU_CONTROL_DC_ENABLE
 	| CPU_CONTROL_BPRD_ENABLE ;
@@ -2815,14 +2799,6 @@ armv7_setup(char *args)
 {
 	int cpuctrl, cpuctrlmask;
 
-#if defined(PROCESS_ID_IS_CURCPU)
-	/* set curcpu() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(cpu_info_store));
-#elif defined(PROCESS_ID_IS_CURLWP)
-	/* set curlwp() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(lwp0));
-#endif
-
 	cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_IC_ENABLE
 	| CPU_CONTROL_DC_ENABLE | CPU_CONTROL_BPRD_ENABLE ;
 	cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE
@@ -2911,14 +2887,6 @@ arm11x6_setup(char *args)
 	uint32_t sbz=0;
 	uint32_t cpuid;
 
-#if defined(PROCESS_ID_IS_CURCPU)
-	/* set curcpu() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(cpu_info_store));
-#elif defined(PROCESS_ID_IS_CURLWP)
-	/* set curlwp() */
-	__asm(mcr\tp15, 0, %0, c13, c0, 4 : : r(lwp0));
-#endif
-
 	cpuid = cpu_id();
 
 	cpuctrl =

Index: src/sys/arch/arm/arm32/cpuswitch.S
diff -u 

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

2012-08-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 29 08:30:03 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: CP3100 GUMSTIX HDL_G HPT5325 IQ31244 IQ80321
IXDP425 MARVELL_NAS MV2120 NSLU2 OPENBLOCKS_A6 OVERO SHEEVAPLUG
TEAMASA_NPWR_FC TS7200 VIPER ZAO425

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/conf/CP3100
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/evbarm/conf/GUMSTIX
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/conf/HDL_G
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/HPT5325 \
src/sys/arch/evbarm/conf/OPENBLOCKS_A6
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/evbarm/conf/IQ31244
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/evbarm/conf/IQ80321
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/conf/IXDP425 \
src/sys/arch/evbarm/conf/TEAMASA_NPWR_FC
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/MARVELL_NAS \
src/sys/arch/evbarm/conf/MV2120
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/NSLU2
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/OVERO
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/conf/SHEEVAPLUG
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/conf/TS7200
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/VIPER
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbarm/conf/ZAO425

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/evbarm/conf/CP3100
diff -u src/sys/arch/evbarm/conf/CP3100:1.26 src/sys/arch/evbarm/conf/CP3100:1.27
--- src/sys/arch/evbarm/conf/CP3100:1.26	Sat Apr  7 03:25:00 2012
+++ src/sys/arch/evbarm/conf/CP3100	Wed Aug 29 08:29:57 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: CP3100,v 1.26 2012/04/07 03:25:00 tsutsui Exp $
+#	$NetBSD: CP3100,v 1.27 2012/08/29 08:29:57 skrll Exp $
 #
 #	CP3100 -- Certance CP3100 Kernel
 #
@@ -243,5 +243,5 @@ pseudo-device	clockctl		# user control o
 pseudo-device	ksyms			# /dev/ksyms
 
 # data mover pseudo-devices
-#pseudo-device	swdmover		# softare dmover(9) back-end
+#pseudo-device	swdmover		# software dmover(9) back-end
 #pseudo-device	dmoverio		# /dev/dmover dmover(9) interface

Index: src/sys/arch/evbarm/conf/GUMSTIX
diff -u src/sys/arch/evbarm/conf/GUMSTIX:1.66 src/sys/arch/evbarm/conf/GUMSTIX:1.67
--- src/sys/arch/evbarm/conf/GUMSTIX:1.66	Sat Apr  7 03:25:00 2012
+++ src/sys/arch/evbarm/conf/GUMSTIX	Wed Aug 29 08:29:57 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: GUMSTIX,v 1.66 2012/04/07 03:25:00 tsutsui Exp $
+#	$NetBSD: GUMSTIX,v 1.67 2012/08/29 08:29:57 skrll Exp $
 #
 #	GUMSTIX -- Gumstix. Inc. gumstix platforms kernel
 #
@@ -413,7 +413,7 @@ pseudo-device	wsmux			# mouse  keyboard
 #pseudo-device	wsfont
 
 # data mover pseudo-devices
-pseudo-device	swdmover		# softare dmover(9) back-end
+pseudo-device	swdmover		# software dmover(9) back-end
 pseudo-device	dmoverio		# /dev/dmover dmover(9) interface
 
 # userland interface to drivers, including autoconf and properties retrieval

Index: src/sys/arch/evbarm/conf/HDL_G
diff -u src/sys/arch/evbarm/conf/HDL_G:1.27 src/sys/arch/evbarm/conf/HDL_G:1.28
--- src/sys/arch/evbarm/conf/HDL_G:1.27	Sat Apr  7 03:25:00 2012
+++ src/sys/arch/evbarm/conf/HDL_G	Wed Aug 29 08:29:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: HDL_G,v 1.27 2012/04/07 03:25:00 tsutsui Exp $
+# $NetBSD: HDL_G,v 1.28 2012/08/29 08:29:57 skrll Exp $
 #
 #   HDL_G -- I-O DATA HDL-G Kernel
 #
@@ -443,5 +443,5 @@ pseudo-device	nsmb			# experimental - SM
 #pseudo-device	veriexec	1
 
 # data mover pseudo-devices
-pseudo-device	swdmover		# softare dmover(9) back-end
+pseudo-device	swdmover		# software dmover(9) back-end
 pseudo-device	dmoverio		# /dev/dmover dmover(9) interface

Index: src/sys/arch/evbarm/conf/HPT5325
diff -u src/sys/arch/evbarm/conf/HPT5325:1.3 src/sys/arch/evbarm/conf/HPT5325:1.4
--- src/sys/arch/evbarm/conf/HPT5325:1.3	Thu Aug 23 00:20:16 2012
+++ src/sys/arch/evbarm/conf/HPT5325	Wed Aug 29 08:29:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: HPT5325,v 1.3 2012/08/23 00:20:16 kiyohara Exp $
+#	$NetBSD: HPT5325,v 1.4 2012/08/29 08:29:58 skrll Exp $
 #
 #  This configuration supports for HP T5325 Thin Client
 #
@@ -498,7 +498,7 @@ pseudo-device	wsmux			# mouse  keyboard
 pseudo-device	wsfont
 
 # data mover pseudo-devices
-#pseudo-device	swdmover		# softare dmover(9) back-end
+#pseudo-device	swdmover		# software dmover(9) back-end
 #pseudo-device	dmoverio		# /dev/dmover dmover(9) interface
 
 #options 	FILEASSOC		# fileassoc(9) - required for Veriexec
Index: src/sys/arch/evbarm/conf/OPENBLOCKS_A6
diff -u src/sys/arch/evbarm/conf/OPENBLOCKS_A6:1.3 src/sys/arch/evbarm/conf/OPENBLOCKS_A6:1.4
--- src/sys/arch/evbarm/conf/OPENBLOCKS_A6:1.3	Thu Aug 23 10:24:52 2012
+++ src/sys/arch/evbarm/conf/OPENBLOCKS_A6	Wed Aug 29 08:29:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: OPENBLOCKS_A6,v 1.3 2012/08/23 10:24:52 kiyohara Exp $
+#	$NetBSD: OPENBLOCKS_A6,v 1.4 2012/08/29 08:29:58 skrll Exp $
 #
 #  OPENBLOCKS_A6 -- Plat'Home. OpenBlockS A6 kernel
 #
@@ 

CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 08:42:25 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
cfparse.y cftoken.l racoon.conf.5

Log Message:
Allow inherited remote blocks without additional remote statements to be
specified in a simpler way. patch by Roman Hoog Antink r...@open.ch


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/cfparse.y
cvs rdiff -u -r1.23 -r1.23.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/cftoken.l
cvs rdiff -u -r1.61 -r1.61.4.1 \
src/crypto/dist/ipsec-tools/src/racoon/racoon.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/crypto/dist/ipsec-tools/src/racoon/cfparse.y
diff -u src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.42 src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.42.2.1
--- src/crypto/dist/ipsec-tools/src/racoon/cfparse.y:1.42	Mon Mar 14 15:50:36 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/cfparse.y	Wed Aug 29 08:42:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cfparse.y,v 1.42 2011/03/14 15:50:36 vanhu Exp $	*/
+/*	$NetBSD: cfparse.y,v 1.42.2.1 2012/08/29 08:42:24 tteras Exp $	*/
 
 /* Id: cfparse.y,v 1.66 2006/08/22 18:17:17 manubsd Exp */
 
@@ -172,6 +172,76 @@ static int load_x509(const char *file, c
 	return 0;
 }
 
+static int process_rmconf()
+{
+
+	/* check a exchange mode */
+	if (cur_rmconf-etypes == NULL) {
+		yyerror(no exchange mode specified.\n);
+		return -1;
+	}
+
+	if (cur_rmconf-idvtype == IDTYPE_UNDEFINED)
+		cur_rmconf-idvtype = IDTYPE_ADDRESS;
+
+	if (cur_rmconf-idvtype == IDTYPE_ASN1DN) {
+		if (cur_rmconf-mycertfile) {
+			if (cur_rmconf-idv)
+yywarn(Both CERT and ASN1 ID 
+   are set. Hope this is OK.\n);
+			/* TODO: Preparse the DN here */
+		} else if (cur_rmconf-idv) {
+			/* OK, using asn1dn without X.509. */
+		} else {
+			yyerror(ASN1 ID not specified 
+and no CERT defined!\n);
+			return -1;
+		}
+	}
+
+	if (duprmconf_finish(cur_rmconf))
+		return -1;
+
+	if (set_isakmp_proposal(cur_rmconf) != 0)
+		return -1;
+
+	/* DH group settting if aggressive mode is there. */
+	if (check_etypeok(cur_rmconf, (void*) ISAKMP_ETYPE_AGG)) {
+		struct isakmpsa *p;
+		int b = 0;
+
+		/* DH group */
+		for (p = cur_rmconf-proposal; p; p = p-next) {
+			if (b == 0 || (b  b == p-dh_group)) {
+b = p-dh_group;
+continue;
+			}
+			yyerror(DH group must be equal 
+in all proposals 
+when aggressive mode is 
+used.\n);
+			return -1;
+		}
+		cur_rmconf-dh_group = b;
+
+		if (cur_rmconf-dh_group == 0) {
+			yyerror(DH group must be set in the proposal.\n);
+			return -1;
+		}
+
+		/* DH group settting if PFS is required. */
+		if (oakley_setdhgroup(cur_rmconf-dh_group,
+cur_rmconf-dhgrp)  0) {
+			yyerror(failed to set DH value.\n);
+			return -1;
+		}
+	}
+
+	insrmconf(cur_rmconf);
+
+	return 0;
+}
+
 %}
 
 %union {
@@ -1643,7 +1713,7 @@ remote_statement
 			vfree($2);
 			vfree($4);
 		}
-		remote_specs_block
+		remote_specs_inherit_block
 	| REMOTE QUOTEDSTRING
 		{
 			struct remoteconf *new;
@@ -1686,7 +1756,7 @@ remote_statement
 			new-remote = $2;
 			cur_rmconf = new;
 		}
-		remote_specs_block
+		remote_specs_inherit_block
 	|	REMOTE remote_index
 		{
 			struct remoteconf *new;
@@ -1703,81 +1773,20 @@ remote_statement
 		remote_specs_block
 	;
 
-remote_specs_block
-	:	BOC remote_specs EOC
+remote_specs_inherit_block
+	:	remote_specs_block
+	|	EOS /* inheritance without overriding any settings */
 		{
-			/* check a exchange mode */
-			if (cur_rmconf-etypes == NULL) {
-yyerror(no exchange mode specified.\n);
-return -1;
-			}
-
-			if (cur_rmconf-idvtype == IDTYPE_UNDEFINED)
-cur_rmconf-idvtype = IDTYPE_ADDRESS;
-
-			if (cur_rmconf-idvtype == IDTYPE_ASN1DN) {
-if (cur_rmconf-mycertfile) {
-	if (cur_rmconf-idv)
-		yywarn(Both CERT and ASN1 ID 
-		   are set. Hope this is OK.\n);
-	/* TODO: Preparse the DN here */
-} else if (cur_rmconf-idv) {
-	/* OK, using asn1dn without X.509. */
-} else {
-	yyerror(ASN1 ID not specified 
-		and no CERT defined!\n);
-	return -1;
-}
-			}
-
-			if (duprmconf_finish(cur_rmconf))
+			if (process_rmconf() != 0)
 return -1;
+		}
+	;
 
-#if 0
-			/* this pointer copy will never happen, because duprmconf_shallow
-			 * already copied all pointers.
-			 */
-			if (cur_rmconf-spspec == NULL 
-			cur_rmconf-inherited_from != NULL) {
-cur_rmconf-spspec = cur_rmconf-inherited_from-spspec;
-			}
-#endif
-			if (set_isakmp_proposal(cur_rmconf) != 0)
+remote_specs_block
+	:	BOC remote_specs EOC
+		{
+			if (process_rmconf() != 0)
 return -1;
-
-			/* DH group settting if aggressive mode is there. */
-			if (check_etypeok(cur_rmconf, (void*) ISAKMP_ETYPE_AGG)) {
-struct isakmpsa *p;
-int b = 0;
-
-/* DH group */
-for (p = 

CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 08:54:00 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
isakmp.c

Log Message:
From Wolfgang Schmieder wolfgang.schmie...@honeywell.com: setup phase1
port properly.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/isakmp.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71.2.1
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71	Tue Mar 15 13:20:14 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp.c	Wed Aug 29 08:54:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp.c,v 1.71 2011/03/15 13:20:14 vanhu Exp $	*/
+/*	$NetBSD: isakmp.c,v 1.71.2.1 2012/08/29 08:54:00 tteras Exp $	*/
 
 /* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
 
@@ -2943,7 +2943,7 @@ copy_ph1addresses(iph1, rmconf, remote, 
 		port = myaddr_getsport(iph1-local);
 		if (port == 0)
 			port = PORT_ISAKMP;
-		set_port(iph1-local, PORT_ISAKMP);
+		set_port(iph1-local, port);
 	}
 
 #ifdef ENABLE_NATT



CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 08:55:27 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
isakmp.c

Log Message:
From Rainer Weikusat rweiku...@mobileactivedefense.com: Release unused
phase2 of passive remotes after acquire.


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.1 -r1.71.2.2 \
src/crypto/dist/ipsec-tools/src/racoon/isakmp.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71.2.1 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71.2.2
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71.2.1	Wed Aug 29 08:54:00 2012
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp.c	Wed Aug 29 08:55:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp.c,v 1.71.2.1 2012/08/29 08:54:00 tteras Exp $	*/
+/*	$NetBSD: isakmp.c,v 1.71.2.2 2012/08/29 08:55:26 tteras Exp $	*/
 
 /* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
 
@@ -2186,7 +2186,7 @@ isakmp_post_acquire(iph2, iph1hint, nopa
 			because of passive mode, 
 			ignore the acquire message for %s.\n,
 			saddrwop2str(iph2-dst));
-		return 0;
+		return -1;
 	}
 
 	/*



CVS commit: src/lib/librumpclient

2012-08-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 29 10:38:53 UTC 2012

Modified Files:
src/lib/librumpclient: rumpclient.c

Log Message:
Remove unused variable. Approved by pooka.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/librumpclient/rumpclient.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/librumpclient/rumpclient.c
diff -u src/lib/librumpclient/rumpclient.c:1.50 src/lib/librumpclient/rumpclient.c:1.51
--- src/lib/librumpclient/rumpclient.c:1.50	Fri Aug  3 14:52:31 2012
+++ src/lib/librumpclient/rumpclient.c	Wed Aug 29 10:38:53 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpclient.c,v 1.50 2012/08/03 14:52:31 pooka Exp $	*/
+/*  $NetBSD: rumpclient.c,v 1.51 2012/08/29 10:38:53 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -49,7 +49,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: rumpclient.c,v 1.50 2012/08/03 14:52:31 pooka Exp $);
+__RCSID($NetBSD: rumpclient.c,v 1.51 2012/08/29 10:38:53 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/mman.h
@@ -681,7 +681,6 @@ doconnect(void)
 	struct respwait rw;
 	struct rsp_hdr rhdr;
 	char banner[MAXBANNER];
-	struct pollfd pfd;
 	int s, error, flags;
 	ssize_t n;
 
@@ -725,8 +724,6 @@ doconnect(void)
 	if (s == -1)
 		return -1;
 
-	pfd.fd = s;
-	pfd.events = POLLIN;
 	while (host_connect(s, serv_sa, parsetab[ptab_idx].slen) == -1) {
 		if (errno == EINTR)
 			continue;



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 11:24:12 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: oakley.c

Log Message:
From Roman Hoog Antink r...@open.ch: do not print unnecessary warning
about non-verified certificate when using raw plain-rsa.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/crypto/dist/ipsec-tools/src/racoon/oakley.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/oakley.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22 src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.23
--- src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22	Thu Mar 17 14:42:58 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/oakley.c	Wed Aug 29 11:24:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oakley.c,v 1.22 2011/03/17 14:42:58 vanhu Exp $	*/
+/*	$NetBSD: oakley.c,v 1.23 2012/08/29 11:24:11 tteras Exp $	*/
 
 /* Id: oakley.c,v 1.32 2006/05/26 12:19:46 manubsd Exp */
 
@@ -1288,6 +1288,7 @@ oakley_validate_auth(iph1)
 {
 	vchar_t *my_hash = NULL;
 	int result;
+	int no_verify_needed = -1;
 #ifdef HAVE_GSSAPI
 	vchar_t *gsshash = NULL;
 #endif
@@ -1361,8 +1362,6 @@ oakley_validate_auth(iph1)
 		plog(LLV_DEBUG, LOCATION, NULL, HASH for PSK validated.\n);
 	}
 		break;
-	case OAKLEY_ATTR_AUTH_METHOD_DSSSIG:
-	case OAKLEY_ATTR_AUTH_METHOD_RSASIG:
 #ifdef ENABLE_HYBRID
 	case OAKLEY_ATTR_AUTH_METHOD_HYBRID_RSA_I:
 	case OAKLEY_ATTR_AUTH_METHOD_HYBRID_DSS_I:
@@ -1370,7 +1369,10 @@ oakley_validate_auth(iph1)
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_RSASIG_R:
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_DSSSIG_I:
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_DSSSIG_R:
+		no_verify_needed = 0;
 #endif
+	case OAKLEY_ATTR_AUTH_METHOD_DSSSIG:
+	case OAKLEY_ATTR_AUTH_METHOD_RSASIG:
 	{
 		int error = 0;
 		int certtype;
@@ -1454,6 +1456,9 @@ oakley_validate_auth(iph1)
 		case ISAKMP_CERT_PLAINRSA:
 			if (get_plainrsa_fromlocal(iph1, 0))
 return ISAKMP_INTERNAL_ERROR;
+			/* suppress CERT validation warning, unless hybrid mode in use */
+			if (no_verify_needed == -1)
+no_verify_needed = 1;
 			break;
 		case ISAKMP_CERT_DNS:
 			/* don't use received cert */
@@ -1480,12 +1485,12 @@ oakley_validate_auth(iph1)
 		if ((error = oakley_check_certid(iph1)) != 0)
 			return error;
 
-		/* Generate a warning if verify_cert */
+		/* Generate a warning unless verify_cert */
 		if (iph1-rmconf-verify_cert) {
-			plog(LLV_DEBUG, LOCATION, NULL,
+			plog(LLV_DEBUG, LOCATION, iph1-remote,
 			 CERT validated\n);
-		} else {
-			plog(LLV_WARNING, LOCATION, NULL,
+		} else if (no_verify_needed != 1) {
+			plog(LLV_WARNING, LOCATION, iph1-remote,
 			 CERT validation disabled by configuration\n);
 		}
 



CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 11:24:28 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
oakley.c

Log Message:
From Roman Hoog Antink r...@open.ch: do not print unnecessary warning
about non-verified certificate when using raw plain-rsa.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/oakley.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/oakley.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22 src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22.2.1
--- src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22	Thu Mar 17 14:42:58 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/oakley.c	Wed Aug 29 11:24:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oakley.c,v 1.22 2011/03/17 14:42:58 vanhu Exp $	*/
+/*	$NetBSD: oakley.c,v 1.22.2.1 2012/08/29 11:24:28 tteras Exp $	*/
 
 /* Id: oakley.c,v 1.32 2006/05/26 12:19:46 manubsd Exp */
 
@@ -1288,6 +1288,7 @@ oakley_validate_auth(iph1)
 {
 	vchar_t *my_hash = NULL;
 	int result;
+	int no_verify_needed = -1;
 #ifdef HAVE_GSSAPI
 	vchar_t *gsshash = NULL;
 #endif
@@ -1361,8 +1362,6 @@ oakley_validate_auth(iph1)
 		plog(LLV_DEBUG, LOCATION, NULL, HASH for PSK validated.\n);
 	}
 		break;
-	case OAKLEY_ATTR_AUTH_METHOD_DSSSIG:
-	case OAKLEY_ATTR_AUTH_METHOD_RSASIG:
 #ifdef ENABLE_HYBRID
 	case OAKLEY_ATTR_AUTH_METHOD_HYBRID_RSA_I:
 	case OAKLEY_ATTR_AUTH_METHOD_HYBRID_DSS_I:
@@ -1370,7 +1369,10 @@ oakley_validate_auth(iph1)
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_RSASIG_R:
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_DSSSIG_I:
 	case OAKLEY_ATTR_AUTH_METHOD_XAUTH_DSSSIG_R:
+		no_verify_needed = 0;
 #endif
+	case OAKLEY_ATTR_AUTH_METHOD_DSSSIG:
+	case OAKLEY_ATTR_AUTH_METHOD_RSASIG:
 	{
 		int error = 0;
 		int certtype;
@@ -1454,6 +1456,9 @@ oakley_validate_auth(iph1)
 		case ISAKMP_CERT_PLAINRSA:
 			if (get_plainrsa_fromlocal(iph1, 0))
 return ISAKMP_INTERNAL_ERROR;
+			/* suppress CERT validation warning, unless hybrid mode in use */
+			if (no_verify_needed == -1)
+no_verify_needed = 1;
 			break;
 		case ISAKMP_CERT_DNS:
 			/* don't use received cert */
@@ -1480,12 +1485,12 @@ oakley_validate_auth(iph1)
 		if ((error = oakley_check_certid(iph1)) != 0)
 			return error;
 
-		/* Generate a warning if verify_cert */
+		/* Generate a warning unless verify_cert */
 		if (iph1-rmconf-verify_cert) {
-			plog(LLV_DEBUG, LOCATION, NULL,
+			plog(LLV_DEBUG, LOCATION, iph1-remote,
 			 CERT validated\n);
-		} else {
-			plog(LLV_WARNING, LOCATION, NULL,
+		} else if (no_verify_needed != 1) {
+			plog(LLV_WARNING, LOCATION, iph1-remote,
 			 CERT validation disabled by configuration\n);
 		}
 



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 11:34:37 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: oakley.c

Log Message:
From Roman Hoog Antink r...@open.ch: add remote's IP address to the
certificate not verified error message.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/crypto/dist/ipsec-tools/src/racoon/oakley.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/oakley.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.23 src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.24
--- src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.23	Wed Aug 29 11:24:11 2012
+++ src/crypto/dist/ipsec-tools/src/racoon/oakley.c	Wed Aug 29 11:34:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oakley.c,v 1.23 2012/08/29 11:24:11 tteras Exp $	*/
+/*	$NetBSD: oakley.c,v 1.24 2012/08/29 11:34:37 tteras Exp $	*/
 
 /* Id: oakley.c,v 1.32 2006/05/26 12:19:46 manubsd Exp */
 
@@ -1434,7 +1434,7 @@ oakley_validate_auth(iph1)
 			}
 
 			if (error != 0) {
-plog(LLV_ERROR, LOCATION, NULL,
+plog(LLV_ERROR, LOCATION, iph1-remote,
  the peer's certificate is not verified.\n);
 return ISAKMP_NTYPE_INVALID_CERT_AUTHORITY;
 			}



CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 11:35:09 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
oakley.c

Log Message:
From Roman Hoog Antink r...@open.ch: add remote's IP address to the
certificate not verified error message.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.1 -r1.22.2.2 \
src/crypto/dist/ipsec-tools/src/racoon/oakley.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/oakley.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22.2.1 src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22.2.2
--- src/crypto/dist/ipsec-tools/src/racoon/oakley.c:1.22.2.1	Wed Aug 29 11:24:28 2012
+++ src/crypto/dist/ipsec-tools/src/racoon/oakley.c	Wed Aug 29 11:35:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: oakley.c,v 1.22.2.1 2012/08/29 11:24:28 tteras Exp $	*/
+/*	$NetBSD: oakley.c,v 1.22.2.2 2012/08/29 11:35:09 tteras Exp $	*/
 
 /* Id: oakley.c,v 1.32 2006/05/26 12:19:46 manubsd Exp */
 
@@ -1434,7 +1434,7 @@ oakley_validate_auth(iph1)
 			}
 
 			if (error != 0) {
-plog(LLV_ERROR, LOCATION, NULL,
+plog(LLV_ERROR, LOCATION, iph1-remote,
  the peer's certificate is not verified.\n);
 return ISAKMP_NTYPE_INVALID_CERT_AUTHORITY;
 			}



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 12:01:30 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: isakmp_inf.c

Log Message:
From Roman Hoog Antink r...@open.ch: Accept DPD messages with cookies
also in reversed order for compatiblity. At least Cisco 836 running
IOS 12.3(8)T does this.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 \
src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47 src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.48
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47	Tue Mar 15 13:20:14 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c	Wed Aug 29 12:01:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_inf.c,v 1.47 2011/03/15 13:20:14 vanhu Exp $	*/
+/*	$NetBSD: isakmp_inf.c,v 1.48 2012/08/29 12:01:30 tteras Exp $	*/
 
 /* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */
 
@@ -1465,8 +1465,11 @@ isakmp_info_recv_r_u_ack (iph1, ru, msgi
 		return 0;
 	}
 
-	if (memcmp(ru-i_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
-	memcmp(ru-r_ck, iph1-index.r_ck, sizeof(cookie_t))) {
+	/* accept cookies in original or reversed order */
+	if ((memcmp(ru-i_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
+	 memcmp(ru-r_ck, iph1-index.r_ck, sizeof(cookie_t))) 
+	(memcmp(ru-r_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
+	 memcmp(ru-i_ck, iph1-index.r_ck, sizeof(cookie_t {
 		plog(LLV_ERROR, LOCATION, iph1-remote,
 			 Cookie mismatch in DPD ACK!.\n);
 		return 0;
@@ -1477,7 +1480,7 @@ isakmp_info_recv_r_u_ack (iph1, ru, msgi
 	sched_cancel(iph1-dpd_r_u);
 	isakmp_sched_r_u(iph1, 0);
 
-	plog(LLV_DEBUG, LOCATION, NULL, received an R-U-THERE-ACK\n);
+	plog(LLV_DEBUG, LOCATION, iph1-remote, received an R-U-THERE-ACK\n);
 
 	return 0;
 }



CVS commit: [ipsec-tools-0_8-branch] src/crypto/dist/ipsec-tools/src/racoon

2012-08-29 Thread Timo Teräs
Module Name:src
Committed By:   tteras
Date:   Wed Aug 29 12:01:56 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon [ipsec-tools-0_8-branch]:
isakmp_inf.c

Log Message:
From Roman Hoog Antink r...@open.ch: Accept DPD messages with cookies
also in reversed order for compatiblity. At least Cisco 836 running
IOS 12.3(8)T does this.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.47.2.1 \
src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47 src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47.2.1
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47	Tue Mar 15 13:20:14 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c	Wed Aug 29 12:01:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_inf.c,v 1.47 2011/03/15 13:20:14 vanhu Exp $	*/
+/*	$NetBSD: isakmp_inf.c,v 1.47.2.1 2012/08/29 12:01:56 tteras Exp $	*/
 
 /* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */
 
@@ -1465,8 +1465,11 @@ isakmp_info_recv_r_u_ack (iph1, ru, msgi
 		return 0;
 	}
 
-	if (memcmp(ru-i_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
-	memcmp(ru-r_ck, iph1-index.r_ck, sizeof(cookie_t))) {
+	/* accept cookies in original or reversed order */
+	if ((memcmp(ru-i_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
+	 memcmp(ru-r_ck, iph1-index.r_ck, sizeof(cookie_t))) 
+	(memcmp(ru-r_ck, iph1-index.i_ck, sizeof(cookie_t)) ||
+	 memcmp(ru-i_ck, iph1-index.r_ck, sizeof(cookie_t {
 		plog(LLV_ERROR, LOCATION, iph1-remote,
 			 Cookie mismatch in DPD ACK!.\n);
 		return 0;
@@ -1477,7 +1480,7 @@ isakmp_info_recv_r_u_ack (iph1, ru, msgi
 	sched_cancel(iph1-dpd_r_u);
 	isakmp_sched_r_u(iph1, 0);
 
-	plog(LLV_DEBUG, LOCATION, NULL, received an R-U-THERE-ACK\n);
+	plog(LLV_DEBUG, LOCATION, iph1-remote, received an R-U-THERE-ACK\n);
 
 	return 0;
 }



CVS commit: src/sys/nfs

2012-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 29 14:00:22 UTC 2012

Modified Files:
src/sys/nfs: nfs_serv.c

Log Message:
When unloading the nfsserver module, call nfs_fini() so that the nfsrvdescpl
pool gets destroyed. Otherwise we are left with a stray pool that points to
unmapped memory behind (and bad things happen). Typically you get seemingly
random page faults (without printing uvm_fault) that happen in various pool
operations. Most frequent one is the pool_drain() from the page daemon.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/nfs/nfs_serv.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/nfs/nfs_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.164 src/sys/nfs/nfs_serv.c:1.165
--- src/sys/nfs/nfs_serv.c:1.164	Mon Aug 27 07:35:13 2012
+++ src/sys/nfs/nfs_serv.c	Wed Aug 29 10:00:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_serv.c,v 1.164 2012/08/27 11:35:13 chs Exp $	*/
+/*	$NetBSD: nfs_serv.c,v 1.165 2012/08/29 14:00:22 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nfs_serv.c,v 1.164 2012/08/27 11:35:13 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: nfs_serv.c,v 1.165 2012/08/29 14:00:22 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -142,6 +142,7 @@ nfsserver_modcmd(modcmd_t cmd, void *arg
 
 		/* Server uses server cache, so kill cache last. */
 		nfsrv_finicache();
+		nfs_fini();
 		return 0;
 	default:
 		return ENOTTY;



CVS commit: src/sys/arch/arm/arm32

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 17:08:41 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Support PMAP_NOCACHE in pmap_kenter_pa


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/arch/arm/arm32/pmap.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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.232 src/sys/arch/arm/arm32/pmap.c:1.233
--- src/sys/arch/arm/arm32/pmap.c:1.232	Wed Aug 29 05:51:30 2012
+++ src/sys/arch/arm/arm32/pmap.c	Wed Aug 29 17:08:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.232 2012/08/29 05:51:30 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.233 2012/08/29 17:08:41 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -211,7 +211,7 @@
 #include machine/param.h
 #include arm/arm32/katelib.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.232 2012/08/29 05:51:30 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.233 2012/08/29 17:08:41 matt Exp $);
 
 #ifdef PMAP_DEBUG
 
@@ -3361,8 +3361,8 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 		}
 	}
 
-	*ptep = L2_S_PROTO | pa | L2_S_PROT(PTE_KERNEL, prot) |
-	pte_l2_s_cache_mode;
+	*ptep = L2_S_PROTO | pa | L2_S_PROT(PTE_KERNEL, prot)
+	| ((flags  PMAP_NOCACHE) ? 0 : pte_l2_s_cache_mode);
 	PTE_SYNC(ptep);
 
 	if (pg) {



CVS commit: src

2012-08-29 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Wed Aug 29 17:13:23 UTC 2012

Modified Files:
src/distrib/sets/lists/comp: md.amd64 md.i386
src/sys/arch/x86/conf: files.x86
src/sys/arch/x86/include: Makefile cpu_ucode.h
src/sys/arch/x86/x86: cpu_ucode.c cpu_ucode_amd.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/xen: xen_ucode.c
src/sys/kern: kern_cpu.c
src/sys/sys: cpu.h cpuio.h
src/usr.sbin/cpuctl: cpuctl.c cpuctl.h
src/usr.sbin/cpuctl/arch: i386.c noarch.c
Added Files:
src/sys/arch/x86/x86: cpu_ucode_intel.c
src/sys/compat/sys: cpuio.h

Log Message:
Extend the CPU microcode update framework to support Intel x86 CPUs.
Contrary to the AMD implementation, it doesn't use xcalls to distribute
the update to all CPUs but relies on cpuctl(8) to bind itself to the
right CPU -- to keep it simple and avoid possible problems with
hyperthreading.
Also, it doesn't parse the vendor supplied file to pick the right
part for the present CPU model but relies on userland to prepare
files with specific filenames. I'll commit a pkg for this in a minute
(pkgsrc/sysutils/intel-microcode).
The ioctl interface changed; compatibility is provided (should be
limited to COMPAT_NETBSD6 as soon as this is available).


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.126 -r1.127 src/distrib/sets/lists/comp/md.i386
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/Makefile
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/cpu_ucode.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/cpu_ucode_amd.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/cpu_ucode_intel.c
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/xen/xen_ucode.c
cvs rdiff -u -r0 -r1.4 src/sys/compat/sys/cpuio.h
cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.35 -r1.36 src/sys/sys/cpu.h
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/cpuio.h
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/cpuctl/cpuctl.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/cpuctl.h
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/cpuctl/arch/i386.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/cpuctl/arch/noarch.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/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.175 src/distrib/sets/lists/comp/md.amd64:1.176
--- src/distrib/sets/lists/comp/md.amd64:1.175	Fri Aug 10 16:22:33 2012
+++ src/distrib/sets/lists/comp/md.amd64	Wed Aug 29 17:13:21 2012
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.175 2012/08/10 16:22:33 joerg Exp $
+# $NetBSD: md.amd64,v 1.176 2012/08/29 17:13:21 drochner Exp $
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
 ./usr/include/amd64/aout_machdep.h		comp-c-include
@@ -283,6 +283,7 @@
 ./usr/include/x86/bus.hcomp-obsolete		obsolete
 ./usr/include/x86/cacheinfo.h			comp-c-include
 ./usr/include/x86/cpu.hcomp-c-include
+./usr/include/x86/cpu_ucode.h			comp-c-include
 ./usr/include/x86/cputypes.h			comp-c-include
 ./usr/include/x86/cpuvar.h			comp-c-include
 ./usr/include/x86/float.h			comp-c-include

Index: src/distrib/sets/lists/comp/md.i386
diff -u src/distrib/sets/lists/comp/md.i386:1.126 src/distrib/sets/lists/comp/md.i386:1.127
--- src/distrib/sets/lists/comp/md.i386:1.126	Wed Aug  8 18:37:51 2012
+++ src/distrib/sets/lists/comp/md.i386	Wed Aug 29 17:13:21 2012
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.126 2012/08/08 18:37:51 drochner Exp $
+# $NetBSD: md.i386,v 1.127 2012/08/29 17:13:21 drochner Exp $
 ./usr/include/clang-3.0/avxintrin.h		comp-obsolete		obsolete
 ./usr/include/clang-3.0/avx2intrin.h		comp-obsolete		obsolete
 ./usr/include/clang-3.0/bmi2intrin.h		comp-obsolete		obsolete
@@ -165,6 +165,7 @@
 ./usr/include/x86/bus.hcomp-obsolete		obsolete
 ./usr/include/x86/cacheinfo.h			comp-c-include
 ./usr/include/x86/cpu.hcomp-c-include
+./usr/include/x86/cpu_ucode.h			comp-c-include
 ./usr/include/x86/cputypes.h			comp-c-include
 ./usr/include/x86/cpuvar.h			comp-c-include
 ./usr/include/x86/float.h			comp-c-include

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.78 src/sys/arch/x86/conf/files.x86:1.79
--- src/sys/arch/x86/conf/files.x86:1.78	Mon May  7 17:45:29 2012
+++ src/sys/arch/x86/conf/files.x86	Wed Aug 29 17:13:21 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.78 2012/05/07 17:45:29 jym Exp $
+#	$NetBSD: files.x86,v 1.79 2012/08/29 17:13:21 drochner Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -96,6 +96,7 @@ file	arch/x86/x86/x86_machdep.c
 
 file	arch/x86/x86/cpu_ucode.c	cpu_ucode needs-flag
 file	

CVS commit: src/sys/arch/arm

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 17:44:25 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/include: armreg.h cpu.h
src/sys/arch/arm/mainbus: cpu_mainbus.c

Log Message:
Use new armv7 CP15 register to print out cache types.
If the cpu_cc_freq is set, report it.
Add macros to make inlines for reading/writing co-processor registers.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/arm/include/armreg.h
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/mainbus/cpu_mainbus.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.84 src/sys/arch/arm/arm32/cpu.c:1.85
--- src/sys/arch/arm/arm32/cpu.c:1.84	Tue Aug 14 20:39:49 2012
+++ src/sys/arch/arm/arm32/cpu.c	Wed Aug 29 17:44:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.84 2012/08/14 20:39:49 matt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.85 2012/08/29 17:44:25 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,15 +46,16 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.84 2012/08/14 20:39:49 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.85 2012/08/29 17:44:25 matt Exp $);
 
 #include sys/systm.h
-#include sys/malloc.h
+#include sys/conf.h
+#include sys/cpu.h
 #include sys/device.h
+#include sys/kmem.h
 #include sys/proc.h
-#include sys/conf.h
+
 #include uvm/uvm_extern.h
-#include machine/cpu.h
 
 #include arm/cpuconf.h
 #include arm/undefined.h
@@ -66,45 +67,94 @@ __KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.84
 
 char cpu_model[256];
 
+#ifdef MULTIPROCESSOR
+volatile u_int arm_cpu_hatched = 0;
+u_int arm_cpu_max = 0;
+uint32_t arm_cpu_mbox __cacheline_aligned = 0;
+uint32_t arm_cpu_marker __cacheline_aligned = 1;
+#endif
+
 /* Prototypes */
 void identify_arm_cpu(device_t dv, struct cpu_info *);
+void identify_cortex_caches(device_t dv);
+void identify_features(device_t dv);
 
 /*
  * Identify the master (boot) CPU
  */
   
 void
-cpu_attach(device_t dv)
+cpu_attach(device_t dv, cpuid_t id)
 {
-	int usearmfpe;
+	struct cpu_info *ci;
+
+	if (id == 0) {
+		ci = curcpu();
 
-	usearmfpe = 1;	/* when compiled in, its enabled by default */
+		/* Get the CPU ID from coprocessor 15 */
+
+		ci-ci_arm_cpuid = cpu_id();
+		ci-ci_arm_cputype = ci-ci_arm_cpuid  CPU_ID_CPU_MASK;
+		ci-ci_arm_cpurev = ci-ci_arm_cpuid  CPU_ID_REVISION_MASK;
+	} else {
+#ifdef MULTIPROCESSOR
+		KASSERT(cpu_info[id] == NULL);
+		ci = kmem_zalloc(sizeof(*ci), KM_SLEEP);
+		KASSERT(ci != NULL);
+		ci-ci_cpl = IPL_HIGH;
+		ci-ci_cpuid = id;
+		ci-ci_data.cpu_core_id = id;
+		ci-ci_data.cpu_cc_freq = cpu_info_store.ci_data.cpu_cc_freq;
+		ci-ci_arm_cpuid = cpu_info_store.ci_arm_cpuid;
+		ci-ci_arm_cputype = cpu_info_store.ci_arm_cputype;
+		ci-ci_arm_cpurev = cpu_info_store.ci_arm_cpurev;
+		cpu_info[ci-ci_cpuid] = ci;
+		if ((arm_cpu_hatched  (1  id)) == 0) {
+			ci-ci_dev = dv;
+			dv-dv_private = ci;
+			aprint_naive(: disabled\n);
+			aprint_normal(: disabled (unresponsive)\n);
+			return;
+		}
+#else
+		aprint_naive(: disabled\n);
+		aprint_normal(: disabled (uniprocessor kernel)\n);
+		return;
+#endif
+	}
 
-	curcpu()-ci_dev = dv;
+	ci-ci_dev = dv;
+	dv-dv_private = ci;
 
-	evcnt_attach_dynamic(curcpu()-ci_arm700bugcount, EVCNT_TYPE_MISC,
-	NULL, dv-dv_xname, arm700swibug);
-	
-	/* Get the CPU ID from coprocessor 15 */
+	evcnt_attach_dynamic(ci-ci_arm700bugcount, EVCNT_TYPE_MISC,
+	NULL, device_xname(dv), arm700swibug);
 
-	curcpu()-ci_arm_cpuid = cpu_id();
-	curcpu()-ci_arm_cputype = curcpu()-ci_arm_cpuid  CPU_ID_CPU_MASK;
-	curcpu()-ci_arm_cpurev =
-	curcpu()-ci_arm_cpuid  CPU_ID_REVISION_MASK;
+#ifdef MULTIPROCESSOR
+	/*
+	 * and we are done if this is a secondary processor.
+	 */
+	if (!CPU_IS_PRIMARY(ci)) {
+		aprint_naive(: %s\n, cpu_model);
+		aprint_normal(: %s\n, cpu_model);
+		mi_cpu_attach(ci);
+		return;
+	}
+#endif
 
-	identify_arm_cpu(dv, curcpu());
+	identify_arm_cpu(dv, ci);
 
-	if (curcpu()-ci_arm_cputype == CPU_ID_SA110 
-	curcpu()-ci_arm_cpurev  3) {
-		aprint_normal(%s: SA-110 with bugged STM^ instruction\n,
-		   dv-dv_xname);
+#ifdef CPU_STRONGARM
+	if (ci-ci_arm_cputype == CPU_ID_SA110 
+	ci-ci_arm_cpurev  3) {
+		aprint_normal_dev(dv, SA-110 with bugged STM^ instruction\n);
 	}
+#endif
 
 #ifdef CPU_ARM8
-	if ((curcpu()-ci_arm_cpuid  CPU_ID_CPU_MASK) == CPU_ID_ARM810) {
+	if ((ci-ci_arm_cpuid  CPU_ID_CPU_MASK) == CPU_ID_ARM810) {
 		int clock = arm8_clock_config(0, 0);
 		char *fclk;
-		aprint_normal(%s: ARM810 cp15=%02x, dv-dv_xname, clock);
+		aprint_normal_dev(dv, ARM810 cp15=%02x, clock);
 		aprint_normal( clock:%s, (clock  1) ?  dynamic : );
 		aprint_normal(%s, (clock  2) ?  sync : );
 		switch ((clock  2)  3) {
@@ -150,6 +200,7 @@ cpu_attach(device_t 

CVS commit: src/sys/arch/arm/omap

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 17:48:17 UTC 2012

Modified Files:
src/sys/arch/arm/omap: files.omap2 omap2_gpio.c omap2_gpmcreg.h
omap2_intr.h omap2_obioreg.h omap2_reg.h

Log Message:
Add some more OMAP4430 support.
Add defines needed to determine clock rates of OMAP3530/TIAM37XX and
OMAP4430.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/omap/omap2_gpio.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/omap/omap2_gpmcreg.h \
src/sys/arch/arm/omap/omap2_intr.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap2_obioreg.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_reg.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/arm/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.13 src/sys/arch/arm/omap/files.omap2:1.14
--- src/sys/arch/arm/omap/files.omap2:1.13	Wed Aug 22 22:18:21 2012
+++ src/sys/arch/arm/omap/files.omap2	Wed Aug 29 17:48:17 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.13 2012/08/22 22:18:21 matt Exp $
+#	$NetBSD: files.omap2,v 1.14 2012/08/29 17:48:17 matt Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -39,7 +39,7 @@ file	arch/arm/arm/bus_space_a4x.S		obio
 device	omapicu: pic, pic_splfuncs
 attach	omapicu at obio with omap2icu
 file	arch/arm/omap/omap2_icu.c		(omap2 | omap3)  omapicu
-file	arch/arm/omap/omap2430_intr.c		omap2  !omapicu
+file	arch/arm/omap/omap2430_intr.c		omap2  !omapicu  !omap4
 
 # OMAP2 GPIO controllers
 device	omapgpio: gpiobus

Index: src/sys/arch/arm/omap/omap2_gpio.c
diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.10 src/sys/arch/arm/omap/omap2_gpio.c:1.11
--- src/sys/arch/arm/omap/omap2_gpio.c:1.10	Wed Aug 22 22:18:21 2012
+++ src/sys/arch/arm/omap/omap2_gpio.c	Wed Aug 29 17:48:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpio.c,v 1.10 2012/08/22 22:18:21 matt Exp $	*/
+/*	$NetBSD: omap2_gpio.c,v 1.11 2012/08/29 17:48:17 matt Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: omap2_gpio.c,v 1.10 2012/08/22 22:18:21 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: omap2_gpio.c,v 1.11 2012/08/29 17:48:17 matt Exp $);
 
 #define _INTR_PRIVATE
 
@@ -348,6 +348,17 @@ gpio_match(device_t parent, cfdata_t cfd
 	|| oa-obio_addr == GPIO6_BASE_3530)
 		return 1;
 #endif
+
+#ifdef OMAP_4430
+	if (oa-obio_addr == GPIO1_BASE_4430
+	|| oa-obio_addr == GPIO2_BASE_4430
+	|| oa-obio_addr == GPIO3_BASE_4430
+	|| oa-obio_addr == GPIO4_BASE_4430
+	|| oa-obio_addr == GPIO5_BASE_4430
+	|| oa-obio_addr == GPIO6_BASE_4430)
+		return 1;
+#endif
+
 #ifdef TI_AM335X
 	if (oa-obio_addr == GPIO0_BASE_TI_AM335X
 	|| oa-obio_addr == GPIO1_BASE_TI_AM335X
@@ -355,6 +366,7 @@ gpio_match(device_t parent, cfdata_t cfd
 	|| oa-obio_addr == GPIO3_BASE_TI_AM335X)
 		return 1;
 #endif
+
 #ifdef TI_DM37XX
 	if (oa-obio_addr == GPIO1_BASE_TI_DM37XX
 	|| oa-obio_addr == GPIO2_BASE_TI_DM37XX

Index: src/sys/arch/arm/omap/omap2_gpmcreg.h
diff -u src/sys/arch/arm/omap/omap2_gpmcreg.h:1.7 src/sys/arch/arm/omap/omap2_gpmcreg.h:1.8
--- src/sys/arch/arm/omap/omap2_gpmcreg.h:1.7	Wed Aug 22 22:18:21 2012
+++ src/sys/arch/arm/omap/omap2_gpmcreg.h	Wed Aug 29 17:48:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpmcreg.h,v 1.7 2012/08/22 22:18:21 matt Exp $	*/
+/*	$NetBSD: omap2_gpmcreg.h,v 1.8 2012/08/29 17:48:17 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -47,7 +47,7 @@
 #ifdef OMAP_3530
 #define GPMC_BASE			0x6e00
 #endif
-#ifdef TI_AM335X
+#if defined(TI_AM335X) || defined(OMAP_4430)
 #define GPMC_BASE			0x5000
 #endif
 #ifdef TI_DM37XX
Index: src/sys/arch/arm/omap/omap2_intr.h
diff -u src/sys/arch/arm/omap/omap2_intr.h:1.7 src/sys/arch/arm/omap/omap2_intr.h:1.8
--- src/sys/arch/arm/omap/omap2_intr.h:1.7	Sat Jul 14 07:42:57 2012
+++ src/sys/arch/arm/omap/omap2_intr.h	Wed Aug 29 17:48:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_intr.h,v 1.7 2012/07/14 07:42:57 matt Exp $ */
+/*	$NetBSD: omap2_intr.h,v 1.8 2012/08/29 17:48:17 matt Exp $ */
 
 /*
  * Define the SDP2430 specific information and then include the generic OMAP
@@ -39,11 +39,10 @@
 #include arm/cpufunc.h
 #endif
 
-#if defined(OMAP2) || defined(OMAP3)
-#include arm/omap/omap2430_intr.h
-#endif
 #if defined(OMAP_4430)
 #include arm/omap/omap4430_intr.h
+#elif defined(OMAP2) || defined(OMAP3)
+#include arm/omap/omap2430_intr.h
 #endif
 
 #ifndef _LOCORE

Index: src/sys/arch/arm/omap/omap2_obioreg.h
diff -u src/sys/arch/arm/omap/omap2_obioreg.h:1.5 src/sys/arch/arm/omap/omap2_obioreg.h:1.6
--- src/sys/arch/arm/omap/omap2_obioreg.h:1.5	Wed Aug 22 22:18:21 2012
+++ src/sys/arch/arm/omap/omap2_obioreg.h	Wed Aug 29 17:48:17 

CVS commit: src/sys/arch/evbarm/beagle

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:04:23 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle_start.S

Log Message:
Use cpsid
Don't add mmu entries for overlapping entries.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/beagle/beagle_start.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/evbarm/beagle/beagle_start.S
diff -u src/sys/arch/evbarm/beagle/beagle_start.S:1.8 src/sys/arch/evbarm/beagle/beagle_start.S:1.9
--- src/sys/arch/evbarm/beagle/beagle_start.S:1.8	Wed Aug 22 22:18:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_start.S	Wed Aug 29 18:04:23 2012
@@ -92,7 +92,7 @@
 #include arm/omap/omap2_obioreg.h
 #include evbarm/beagle/beagle.h  
 
-RCSID($NetBSD: beagle_start.S,v 1.8 2012/08/22 22:18:22 matt Exp $)
+RCSID($NetBSD: beagle_start.S,v 1.9 2012/08/29 18:04:23 matt Exp $)
 
 #define Invalidate_I_cache(reg) \
 	mcr	p15, 0, reg, c7, c5, 0	/* Invalidate Entire I cache */
@@ -107,10 +107,7 @@ RCSID($NetBSD: beagle_start.S,v 1.8 201
 	.global	_C_LABEL(beagle_start)
 _C_LABEL(beagle_start):
 	/* Move into supervisor mode and disable IRQs/FIQs. */
-	mrs	r0, cpsr
-	bic	r0, r0, #PSR_MODE
-	orr	r0, r0, #(I32_bit | F32_bit | PSR_SVC32_MODE)
-	msr	cpsr, r0
+	cpsid	if, #PSR_SVC32_MODE
 
 	/*
 	 * Set up a preliminary mapping in the MMU to allow us to run
@@ -282,9 +279,7 @@ mmu_init_table:
 		(OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
 		L1_S_PROTO | L1_S_APv7_KRW)
 
-#if defined(OMAP_L4_WAKEUP_BASE) \
- (OMAP_L4_WAKEUP_BASE  OMAP_L4_CORE_BASE \
-	|| OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE = OMAP_L4_WAKEUP_BASE)
+#if defined(OMAP_L4_WAKEUP_BASE)  defined(OMAP_L4_WAKEUP_VBASE)
 	/* Map all 4MB of L4 WAKEUP (so console will work) */
 	MMU_INIT(OMAP_L4_WAKEUP_VBASE, OMAP_L4_WAKEUP_BASE,
 		(OMAP_L4_WAKEUP_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,



CVS commit: src/sys/arch/evbarm/beagle

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:05:42 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c

Log Message:
For OMAP3530/TIAM37XX and OMAP4430, read the PLL regisers and calculate the
real CPU clock rate.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/beagle/beagle_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/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.6 src/sys/arch/evbarm/beagle/beagle.h:1.7
--- src/sys/arch/evbarm/beagle/beagle.h:1.6	Thu Aug 23 01:27:25 2012
+++ src/sys/arch/evbarm/beagle/beagle.h	Wed Aug 29 18:05:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.6 2012/08/23 01:27:25 matt Exp $	*/
+/*	$NetBSD: beagle.h,v 1.7 2012/08/29 18:05:41 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -56,6 +56,8 @@
 #define OMAP_L4_PERIPHERAL_SIZE		OMAP4430_L4_PERIPHERAL_SIZE
 #define OMAP_L4_WAKEUP_BASE		OMAP4430_L4_WAKEUP_BASE
 #define OMAP_L4_WAKEUP_SIZE		OMAP4430_L4_WAKEUP_SIZE
+#define OMAP_L4_ABE_BASE		OMAP4430_L4_ABE_BASE
+#define OMAP_L4_ABE_SIZE		OMAP4430_L4_ABE_SIZE
 #endif
 
 #ifdef TI_AM335X
@@ -80,12 +82,18 @@
  * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
  */
 #define OMAP_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
-#if defined(OMAP_3530) || defined(OMAP_4430)
+#if defined(OMAP_3530)
 #define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
 #define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)
 #define OMAP_L4_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
 #define OMAP_KERNEL_IO_VEND	(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
 #define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
+#elif defined(OMAP_4430)
+#define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
+#define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)
+#define OMAP_L4_ABE_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_L4_ABE_VBASE + OMAP_L4_ABE_SIZE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
 #elif defined(TI_AM335X)
 #define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
 #define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.17 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.18
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.17	Wed Aug 22 22:18:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Wed Aug 29 18:05:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.17 2012/08/22 22:18:22 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.18 2012/08/29 18:05:41 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: beagle_machdep.c,v 1.17 2012/08/22 22:18:22 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: beagle_machdep.c,v 1.18 2012/08/29 18:05:41 matt Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -137,15 +137,17 @@ __KERNEL_RCSID(0, $NetBSD: beagle_machd
 #include prcm.h
 
 #include sys/param.h
-#include sys/device.h
 #include sys/systm.h
-#include sys/kernel.h
+#include sys/bus.h
+#include sys/cpu.h
+#include sys/device.h
 #include sys/exec.h
-#include sys/proc.h
+#include sys/kernel.h
+#include sys/ksyms.h
 #include sys/msgbuf.h
+#include sys/proc.h
 #include sys/reboot.h
 #include sys/termios.h
-#include sys/ksyms.h
 
 #include uvm/uvm_extern.h
 
@@ -161,9 +163,6 @@ __KERNEL_RCSID(0, $NetBSD: beagle_machd
 #endif
 
 #include machine/bootconfig.h
-#include sys/bus.h
-#include machine/cpu.h
-#include machine/frame.h
 #include arm/armreg.h
 #include arm/undefined.h
 
@@ -232,6 +231,12 @@ static void kgdb_port_init(void);
 
 static void setup_real_page_tables(void);
 static void init_clocks(void);
+#if defined(OMAP_3530) || defined(TI_DM37XX)
+static void omap3_cpu_clk(void);
+#endif
+#if defined(OMAP_4430)
+static void omap4_cpu_clk(void);
+#endif
 
 bs_protos(bs_notimpl);
 
@@ -366,9 +371,7 @@ static const struct pmap_devmap devmap[]
 		.pd_prot = VM_PROT_READ|VM_PROT_WRITE,
 		.pd_cache = PTE_NOCACHE
 	},
-#if defined(OMAP_L4_WAKEUP_BASE) \
- (OMAP_L4_WAKEUP_BASE  OMAP_L4_CORE_BASE \
-	|| OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE = OMAP_L4_WAKEUP_BASE)
+#if defined(OMAP_L4_WAKEUP_BASE)  defined(OMAP_L4_WAKEUP_VBASE)
 	{
 		/*
 		 * Map all 256KB of the L4 Wakeup area
@@ -394,6 +397,19 @@ static const struct pmap_devmap devmap[]
 		.pd_cache = PTE_NOCACHE
 	},
 #endif
+#ifdef OMAP_L4_ABE_BASE
+	{
+		/*
+		 * Map all of the L4 Fast area
+		 * this gets us GPIO1, WDT2, GPT1, 32K and power/reset regs
+		 */
+		.pd_va = _A(OMAP_L4_ABE_VBASE),
+		.pd_pa = _A(OMAP_L4_ABE_BASE),

CVS commit: src/sys/arch/arm/arm

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:29:04 UTC 2012

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
always start PMC cycle counter for ARM11 and Cortex.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/arm/arm/cpufunc.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/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.111 src/sys/arch/arm/arm/cpufunc.c:1.112
--- src/sys/arch/arm/arm/cpufunc.c:1.111	Wed Aug 29 07:14:03 2012
+++ src/sys/arch/arm/arm/cpufunc.c	Wed Aug 29 18:29:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.111 2012/08/29 07:14:03 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.112 2012/08/29 18:29:04 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.111 2012/08/29 07:14:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.112 2012/08/29 18:29:04 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -1718,6 +1718,10 @@ set_cpufuncs(void)
 		if (arm_cache_prefer_mask)
 			uvmexp.ncolors = (arm_cache_prefer_mask  PGSHIFT) + 1;
 
+		/*
+		 * Start and reset the PMC Cycle Counter.
+		 */
+		armreg_pmcrv6_write(ARM11_PMCCTL_E | ARM11_PMCCTL_P | ARM11_PMCCTL_C);
 		return 0;
 	}
 #endif /* CPU_ARM11 */
@@ -1901,7 +1905,11 @@ set_cpufuncs(void)
 		pmap_pte_init_armv7();
 		if (arm_cache_prefer_mask)
 			uvmexp.ncolors = (arm_cache_prefer_mask  PGSHIFT) + 1;
-
+		/*
+		 * Start and reset the PMC Cycle Counter.
+		 */
+		armreg_pmcr_write(ARM11_PMCCTL_E | ARM11_PMCCTL_P | ARM11_PMCCTL_C);
+		armreg_pmcntenset_write(CORTEX_CNTENS_C);
 		return 0;
 	}
 #endif /* CPU_CORTEX */



CVS commit: src/sys/arch/arm/arm

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:37:14 UTC 2012

Modified Files:
src/sys/arch/arm/arm: cpufunc.c cpufunc_asm_armv7.S

Log Message:
Recode armv7_dcache_wbinv_all in asm.  Add armv7_dcache_inv_all and
armv7_icache_inv_all as well.
Use dsb/dmb/isb instructions


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/arm/arm/cpufunc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/cpufunc_asm_armv7.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/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.112 src/sys/arch/arm/arm/cpufunc.c:1.113
--- src/sys/arch/arm/arm/cpufunc.c:1.112	Wed Aug 29 18:29:04 2012
+++ src/sys/arch/arm/arm/cpufunc.c	Wed Aug 29 18:37:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.112 2012/08/29 18:29:04 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.113 2012/08/29 18:37:14 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.112 2012/08/29 18:29:04 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.113 2012/08/29 18:37:14 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -2835,53 +2835,6 @@ armv7_setup(char *args)
 	curcpu()-ci_ctrl = cpuctrl;
 	cpu_control(0x, cpuctrl);
 }
-
-/* Clean the data cache to the level of coherency. Slow. */
-void
-armv7_dcache_wbinv_all(void)
-{
-	u_int clidr, loc, level;
-
-	/* Cache Level ID Register */
-	__asm volatile(mrc\tp15, 1, %0, c0, c0, 1 : =r (clidr));
-
-	loc = (clidr  24)  7; /* Level of Coherency */
-
-	for (level = 0; level = loc; level++) {
-		u_int ctype, csid;
-		int line_size, ways, nsets, wayshift, setshift;
-
-		ctype = (clidr  (level * 3))  7;
-		/* We're supposed to stop when ctype == 0, but we
-		 * trust that loc isn't larger than necesssary. */
-		if (ctype  2) continue; /* no cache / only icache */
-
-		csid = get_cachesize_cp15(level  1);
-		line_size = CPU_CSID_LEN(csid);
-		ways = CPU_CSID_ASSOC(csid);
-		nsets = (csid  13)  0x7fff;
-
-		wayshift = __builtin_clz(ways); /* leading zeros */
-		setshift = line_size + 4;
-
-		for (; nsets = 0; nsets--) {
-			int way;
-
-			for (way = ways; way = 0; way--) {
-/* Clean by set/way */
-const u_int sw = (way  wayshift)
-| (nsets  setshift)
-| (level  1);
-
-__asm volatile(mcr\tp15, 0, %0, c7, c10, 2
-:: r(sw));
-			}
-		}
-	}
-
-	__asm volatile(dsb);
-	__asm volatile(isb);
-}
 #endif /* CPU_CORTEX */
 
 

Index: src/sys/arch/arm/arm/cpufunc_asm_armv7.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.2 src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.3
--- src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.2	Sat Jun 19 19:44:57 2010
+++ src/sys/arch/arm/arm/cpufunc_asm_armv7.S	Wed Aug 29 18:37:14 2012
@@ -31,50 +31,55 @@
 #include machine/cpu.h
 #include machine/asm.h
 
-#define entrysize		#32
-
 	.arch	armv7a
 
-
 ENTRY(armv7_cpu_sleep)
-	tst	r0, #0x 	@shouldn't sleep 0
-	wfi
-	RET
+	tst	r0, #0x 	@ shouldn't sleep 0
+	wfene@ this can cheaper when doing MP
+	bx	lr
 END(armv7_cpu_sleep)
 
 ENTRY(armv7_wait)
-	mrc	p15, 0, r0, c2, c0, 0	@arbitrary read of CP15
-	add	r0, r0, #0		@a stall
-	RET
+	mrc	p15, 0, r0, c2, c0, 0	@ arbitrary read of CP15
+	add	r0, r0, #0		@ a stall
+	bx	lr
 END(armv7_wait)
 
 ENTRY(armv7_context_switch)
-	mcr	p15, 0, r0, c7, c10, 4  @drain the write buffer
-	mcr	p15, 0, r0, c2, c0, 0 	@set the new TTB
-	mcr	p15, 0, r0, c8, c7, 0	@flush the I+D
-	RET
+	dsb@ data synchronization barrier
+	mcr	p15, 0, r0, c2, c0, 0 	@ set the new TTB
+#ifdef MULTIPROCESSOR
+	mcr	p15, 0, r0, c8, c3, 0	@ flush I+D tlb single entry
+#else
+	mcr	p15, 0, r0, c8, c7, 0	@ flush the I+D
+#endif
+	dsb
+	isb
+	bx	lr
 END(armv7_context_switch)
 
 ENTRY(armv7_tlb_flushID_SE)
-	mcr	p15, 0, r0, c8, c7, 1	@flush I+D tlb single entry
-	mcr	p15, 0, r0, c7, c10, 4  @drain write buffer
-	RET
+#ifdef MULTIPROCESSOR
+	mcr	p15, 0, r0, c8, c3, 1	@ flush I+D tlb single entry
+#else
+	mcr	p15, 0, r0, c8, c7, 1	@ flush I+D tlb single entry
+#endif
+	dsb@ data synchronization barrier
+	isb
+	bx	lr
 END(armv7_tlb_flushID_SE)
 
 
 ENTRY(armv7_setttb)
-/* Does this even exist on armv7? */
-#ifdef PMAP_CACHE_VIVT
-	stmdb	sp!, {r0, lr}
-	bl	_C_LABEL(armv7_idcache_wbinv_all) @clean the D cache
-	ldmia	sp!, {r0, lr}
+	mcr	p15, 0, r0, c2, c0, 0   @ load new TTB
+#ifdef MULTIPROCESSOR
+	mcr	p15, 0, r0, c8, c3, 0	@ invalidate all I+D TLBs
+#else
+	mcr	p15, 0, r0, c8, c7, 0   @ invalidate all I+D TLBs
 #endif
-
-	mcr	p15, 0, r0, c2, c0, 0   @load new TTB
-	mcr	p15, 0, r0, c8, c7, 0   @invalidate I+D TLBs
-	mcr	p15, 0, r0, c7, c10, 4  @drain the write buffer
-
-	RET
+	dsb@ data synchronization barrier
+	isb
+	bx	lr
 END(armv7_setttb)
 
 /* Cache operations. */
@@ -82,14 +87,20 @@ END(armv7_setttb)
 /* LINTSTUB: void armv7_icache_sync_range(vaddr_t, 

CVS commit: src/sys/arch/arm/include

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:44:56 UTC 2012

Modified Files:
src/sys/arch/arm/include: cpu.h

Log Message:
Remove undeeded struct device;


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/arm/include/cpu.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/arm/include/cpu.h
diff -u src/sys/arch/arm/include/cpu.h:1.70 src/sys/arch/arm/include/cpu.h:1.71
--- src/sys/arch/arm/include/cpu.h:1.70	Wed Aug 29 17:44:25 2012
+++ src/sys/arch/arm/include/cpu.h	Wed Aug 29 18:44:56 2012
@@ -350,8 +350,6 @@ void	cpu_proc_fork(struct proc *, struct
 /*
  * cpu device glue (belongs in cpuvar.h)
  */
-
-struct device;
 void	cpu_attach(device_t, cpuid_t);
 #endif
 



CVS commit: src/lib/libc/gen

2012-08-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 29 18:50:36 UTC 2012

Modified Files:
src/lib/libc/gen: getgrent.c

Log Message:
Check for NULL *before* using ALIGN().

I don't remember what prompted this, but it's obviously a desirable fix
and I've been carrying it on a heavily-used machine for more than a year.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/gen/getgrent.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/libc/gen/getgrent.c
diff -u src/lib/libc/gen/getgrent.c:1.66 src/lib/libc/gen/getgrent.c:1.67
--- src/lib/libc/gen/getgrent.c:1.66	Thu Mar 29 13:05:10 2012
+++ src/lib/libc/gen/getgrent.c	Wed Aug 29 18:50:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $	*/
+/*	$NetBSD: getgrent.c,v 1.67 2012/08/29 18:50:35 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999-2000, 2004-2005 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
 #if 0
 static char sccsid[] = @(#)getgrent.c	8.2 (Berkeley) 3/21/94;
 #else
-__RCSID($NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $);
+__RCSID($NetBSD: getgrent.c,v 1.67 2012/08/29 18:50:35 dholland Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -221,9 +221,9 @@ _gr_parse(const char *entry, struct grou
 	}
 /* grab ALIGNed char **gr_mem from buf */
 	ep = _gr_memfrombuf(memc * sizeof(char *) + ALIGNBYTES, buf, buflen);
-	grp-gr_mem = (char **)ALIGN(ep);
-	if (grp-gr_mem == NULL)
+	if (ep == NULL)
 		return 0;
+	grp-gr_mem = (char **)ALIGN(ep);
 
 	for (memc = 0; *entry != '\0'; memc++) {
 		count = strcspn(entry, ,);	/* parse member */



CVS commit: src/sys/kern

2012-08-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 29 18:56:40 UTC 2012

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

Log Message:
Add missing newline to printf (in the disabled code for $ORIGIN).


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/sys/kern/kern_exec.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_exec.c
diff -u src/sys/kern/kern_exec.c:1.354 src/sys/kern/kern_exec.c:1.355
--- src/sys/kern/kern_exec.c:1.354	Fri Jul 27 20:52:49 2012
+++ src/sys/kern/kern_exec.c	Wed Aug 29 18:56:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.354 2012/07/27 20:52:49 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.355 2012/08/29 18:56:39 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.354 2012/07/27 20:52:49 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_exec.c,v 1.355 2012/08/29 18:56:39 dholland Exp $);
 
 #include opt_exec.h
 #include opt_ktrace.h
@@ -1079,7 +1079,7 @@ execve_runproc(struct lwp *l, struct exe
 #endif
 	else {
 #ifdef notyet
-		printf(Cannot get path for pid %d [%s] (error %d),
+		printf(Cannot get path for pid %d [%s] (error %d)\n,
 		(int)p-p_pid, p-p_comm, error);
 #endif
 		data-ed_pack.ep_path = NULL;



CVS commit: src/sys/arch/arm/arm32

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 18:56:45 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Make all cortex and arm11 cpus uses writeback cached memories for pagetables


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/arch/arm/arm32/pmap.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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.233 src/sys/arch/arm/arm32/pmap.c:1.234
--- src/sys/arch/arm/arm32/pmap.c:1.233	Wed Aug 29 17:08:41 2012
+++ src/sys/arch/arm/arm32/pmap.c	Wed Aug 29 18:56:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.233 2012/08/29 17:08:41 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.234 2012/08/29 18:56:45 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -209,9 +209,10 @@
 #include machine/pmap.h
 #include machine/pcb.h
 #include machine/param.h
+#include arm/cpuconf.h
 #include arm/arm32/katelib.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.233 2012/08/29 17:08:41 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.234 2012/08/29 18:56:45 matt Exp $);
 
 #ifdef PMAP_DEBUG
 
@@ -5989,20 +5990,16 @@ pmap_pte_init_generic(void)
 	 * Cortex CPUs which can read the L1 caches).
 	 */
 	if (cpufuncs.cf_dcache_wb_range == (void *) cpufunc_nullop
-#if ARM_MMU_V7  1
-	|| (CPU_ID_CORTEX_P(curcpu()-ci_arm_cpuid)
-		 !CPU_ID_CORTEX_A8_P(curcpu()-ci_arm_cpuid))
+#if ARM_MMU_V7  0
+	|| CPU_ID_CORTEX_P(curcpu()-ci_arm_cpuid)
+#endif
+#if ARM_MMU_V6  0
+	|| CPU_ID_ARM11_P(curcpu()-ci_arm_cpuid) /* arm116 errata 399234 */
 #endif
 	|| false) {
 		pte_l1_s_cache_mode_pt = L1_S_B|L1_S_C;
 		pte_l2_l_cache_mode_pt = L2_B|L2_C;
 		pte_l2_s_cache_mode_pt = L2_B|L2_C;
-#if ARM_MMU_V6  1
-	} else if (CPU_ID_ARM11_P(curcpu()-ci_arm_cpuid)) {
-		pte_l1_s_cache_mode_pt = L1_S_B|L1_S_C; /* arm116 errata 399234 */
-		pte_l2_l_cache_mode_pt = L2_B|L2_C; /* arm116 errata 399234 */
-		pte_l2_s_cache_mode_pt = L2_B|L2_C; /* arm116 errata 399234 */
-#endif
 	} else {
 		pte_l1_s_cache_mode_pt = L1_S_C;	/* write through */
 		pte_l2_l_cache_mode_pt = L2_C;		/* write through */



CVS commit: src/sys/arch

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 19:10:17 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: cortex_pmc.c
src/sys/arch/arm/include/arm32: machdep.h
src/sys/arch/evbarm/beagle: beagle_machdep.c
src/sys/arch/evbarm/conf: std.beagle
src/sys/arch/evbarm/gumstix: gumstix_machdep.c
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
Since the PMC cycle counter is started in cpufunc no reason to do so here.
Use curcpu()-ci_data.cpu_cc_freq and new armreg* inlines.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm32/cortex_pmc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/arm32/machdep.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/std.beagle
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/netwalker/netwalker_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/arm/arm32/cortex_pmc.c
diff -u src/sys/arch/arm/arm32/cortex_pmc.c:1.1 src/sys/arch/arm/arm32/cortex_pmc.c:1.2
--- src/sys/arch/arm/arm32/cortex_pmc.c:1.1	Sat Jun 19 19:44:57 2010
+++ src/sys/arch/arm/arm32/cortex_pmc.c	Wed Aug 29 19:10:15 2012
@@ -28,12 +28,12 @@
 
 
 /*
- * support for ARM cortexa8 Performance Monitor Counters
+ * support for ARM cortex Performance Monitor Counters
  * based on arm11_pmc.c
  */
 
 #include sys/cdefs.h
-/* __KERNEL_RCSID(0, $NetBSD: cortex_pmc.c,v 1.1 2010/06/19 19:44:57 matt Exp $); */
+/* __KERNEL_RCSID(0, $NetBSD: cortex_pmc.c,v 1.2 2012/08/29 19:10:15 matt Exp $); */
 #include opt_perfctrs.h
 #include sys/types.h
 #include sys/param.h
@@ -41,69 +41,32 @@
 #include sys/kernel.h  
 #include sys/time.h
 #include sys/timetc.h
+
 #include dev/clock_subr.h
+
+#include uvm/uvm_extern.h
+
 #include arm/armreg.h
 #include arm/cpufunc.h
+#include arm/arm32/machdep.h
 
 #ifndef CORTEX_PMC_CCNT_HZ
 # define CORTEX_PMC_CCNT_HZ	4	/* 400MHz */
 #endif
 
-void cortexa8_pmc_ccnt_init(void);
-
-#define COUNTS_PER_USEC	(CORTEX_PMC_CCNT_HZ / 100)
-
-static uint32_t counts_per_wrap = ~0UL;		/* XXX off by 1 */
-
-#define PMNC c9, c12, 0
-#define CCNT c9, c13, 0
-
-static inline uint32_t
-cortexa8_pmc_ctrl_read(void)
-{
-	uint32_t val;
-
-	__asm volatile (mrc p15, 0, %0,  PMNC : =r (val));
-
-	return val;
-}
-
-static inline void
-cortexa8_pmc_ctrl_write(uint32_t val)
-{
-	__asm volatile (mcr p15, 0, %0,  PMNC :: r (val));
-}
-
-static inline uint32_t
-cortexa8_pmc_ccnt_read(void)
-{
-	uint32_t val;
+#define COUNTS_PER_USEC	(curcpu()-ci_data.cpu_cc_freq / (1000*1000))
 
-	__asm volatile (mrc p15, 0, %0,  CCNT : =r (val));
-
-	return val;
-}
-
-static inline void
-cortexa8_pmc_ccnt_write(uint32_t val)
-{
-  __asm volatile (mcr p15, 0, %0, c9, c12, 2  :: r (CORTEX_CNTENC_C));
-  __asm volatile (mcr p15, 0, %0,  CCNT :: r (val));
-  __asm volatile (mcr p15, 0, %0, c9, c12, 1 :: r (CORTEX_CNTENS_C));
-}
+static const uint32_t counts_per_wrap = ~0UL - 1;
 
 /*
  * enable the PMC CCNT for delay()
  */
 void
-cortexa8_pmc_ccnt_init(void)
+cortex_pmc_ccnt_init(void)
 {
-  uint32_t val;
-  
-  val = ARM11_PMCCTL_E | ARM11_PMCCTL_P | ARM11_PMCCTL_C;
-	
-  cortexa8_pmc_ctrl_write(val);
-  __asm volatile (mcr p15, 0, %0, c9, c12, 1 :: r (CORTEX_CNTENS_C));
+	if (curcpu()-ci_data.cpu_cc_freq == 0) {
+		curcpu()-ci_data.cpu_cc_freq = CORTEX_PMC_CCNT_HZ;
+	}
 }
 
 /*
@@ -112,7 +75,6 @@ cortexa8_pmc_ccnt_init(void)
  *	NOTE: at 400MHz we are restricted to (uint32_t)~0 counts
  *	if this is a problem, accumulate counts in LL vars
  */
-#define DELAY_ARG_LIMIT (((uint32_t)~0) / COUNTS_PER_USEC)	/* about 10 sec */
 void
 delay(u_int arg)
 {
@@ -121,29 +83,32 @@ delay(u_int arg)
 	uint32_t last;
 	uint32_t delta = 0;
 	uint32_t usecs = 0;
+	const uint32_t counts_per_usec = COUNTS_PER_USEC;
+	const uint32_t delay_arg_limit = ~0UL / counts_per_usec; /* about 10 sec */
 
-	if (arg  DELAY_ARG_LIMIT)
-		panic(delay: arg %u overflow, limit is %d usec\n, arg, DELAY_ARG_LIMIT);
+	if (arg  delay_arg_limit)
+		panic(%s: arg %u overflow, limit is %u usec\n,
+		__func__, arg, delay_arg_limit);
 
-	last = cortexa8_pmc_ccnt_read();
+	last = armreg_pmccntr_read();
 	delta = usecs = 0;
 	while (arg  usecs) {
-		cur  = cortexa8_pmc_ccnt_read();
+		cur = armreg_pmccntr_read();
 		
 		/* overflow flag is moved to a separate register
 		   and is not read from PMC Control Register */
-		__asm volatile (mrc p15, 0, %0, c9, c12, 3 : =r (ctrl));
-		if(ctrl  CORTEX_CNTOFL_C){
+		ctrl = armreg_pmovsr_read();
+		if (ctrl  CORTEX_CNTOFL_C) {
 		  /* Reset overflow flag for cycle counter in overflow register */
-		  __asm volatile (mcr p15, 0, %0, c9, c12, 3 :: r (CORTEX_CNTOFL_C));
-		  delta += (last + (counts_per_wrap - cur));
+			armreg_pmovsr_write(CORTEX_CNTOFL_C);
+			delta += (last 

CVS commit: src/usr.sbin/makemandb

2012-08-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Aug 29 20:33:02 UTC 2012

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

Log Message:
Add -Q flag:
Print only fatal error messages (i.e., when the database is left in
an inconsistent state and needs manual intervention).

From Abhinav Upadhyay er.abhinav.upadh...@gmail.com.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makemandb/makemandb.8
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/makemandb/makemandb.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/makemandb/makemandb.8
diff -u src/usr.sbin/makemandb/makemandb.8:1.4 src/usr.sbin/makemandb/makemandb.8:1.5
--- src/usr.sbin/makemandb/makemandb.8:1.4	Sat Aug 25 12:37:00 2012
+++ src/usr.sbin/makemandb/makemandb.8	Wed Aug 29 20:33:01 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: makemandb.8,v 1.4 2012/08/25 12:37:00 wiz Exp $
+.\ $NetBSD: makemandb.8,v 1.5 2012/08/29 20:33:01 wiz Exp $
 .\
 .\ Copyright (c) 2011 Abhinav Upadhyay er.abhinav.upadh...@gmail.com
 .\ All rights reserved.
@@ -29,7 +29,7 @@
 .\ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd April 21, 2012
+.Dd August 29, 2012
 .Dt MAKEMANDB 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd parse the manual pages and build a search index over them
 .Sh SYNOPSIS
 .Nm
-.Op Fl floqv
+.Op Fl floQqv
 .Op Fl C Ar path
 .Sh DESCRIPTION
 The
@@ -71,11 +71,15 @@ and also to substantially save disk spac
 Use this option to optimize the index for speed and also
 to significantly reduce disk space usage.
 This is a somewhat expensive operation.
+.It Fl Q
+Print only fatal error messages (i.e., when the database is left in
+an inconsistent state and needs manual intervention).
 .It Fl q
-Print only error messages and no status updates.
+Print only warnings and error messages but no status updates.
 .It Fl v
 Enable verbose output.
-This prints the name of every file being parsed.
+This prints the name of every file being parsed
+and a summary at the end of the index update.
 .El
 .Pp
 As the database file is stored under

Index: src/usr.sbin/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.12 src/usr.sbin/makemandb/makemandb.c:1.13
--- src/usr.sbin/makemandb/makemandb.c:1.12	Sat Aug 25 12:37:12 2012
+++ src/usr.sbin/makemandb/makemandb.c	Wed Aug 29 20:33:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.12 2012/08/25 12:37:12 wiz Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.13 2012/08/29 20:33:01 wiz Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay er.abhinav.upadh...@gmail.com
  * Copyright (c) 2011 Kristaps Dzonsons krist...@bsd.lv
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: makemandb.c,v 1.12 2012/08/25 12:37:12 wiz Exp $);
+__RCSID($NetBSD: makemandb.c,v 1.13 2012/08/29 20:33:01 wiz Exp $);
 
 #include sys/stat.h
 #include sys/types.h
@@ -304,7 +304,7 @@ main(int argc, char *argv[])
 	size_t linesize;
 	struct mandb_rec rec;
 
-	while ((ch = getopt(argc, argv, C:floqv)) != -1) {
+	while ((ch = getopt(argc, argv, C:floQqv)) != -1) {
 		switch (ch) {
 		case 'C':
 			manconf = optarg;
@@ -319,9 +319,12 @@ main(int argc, char *argv[])
 		case 'o':
 			mflags.optimize = 1;
 			break;
-		case 'q':
+		case 'Q':
 			mflags.verbosity = 0;
 			break;
+		case 'q':
+			mflags.verbosity = 1;
+			break;
 		case 'v':
 			mflags.verbosity = 2;
 			break;
@@ -417,6 +420,8 @@ main(int argc, char *argv[])
 		err(EXIT_FAILURE, pclose error);
 	}
 
+	if (mflags.verbosity)
+		printf(Performing index update\n);
 	update_db(db, mp, rec);
 	mparse_free(mp);
 	free_secbuffs(rec);
@@ -451,7 +456,8 @@ traversedir(const char *parent, const ch
 	char *buf;
 
 	if (stat(file, sb)  0) {
-		warn(stat failed: %s, file);
+		if (mflags.verbosity)
+			warn(stat failed: %s, file);
 		return;
 	}
 	
@@ -464,7 +470,8 @@ traversedir(const char *parent, const ch
 	/* If it is a directory, traverse it recursively */
 	if (S_ISDIR(sb.st_mode)) {
 		if ((dp = opendir(file)) == NULL) {
-			warn(opendir error: %s, file);
+			if (mflags.verbosity)
+warn(opendir error: %s, file);
 			return;
 		}
 		
@@ -503,14 +510,16 @@ build_file_cache(sqlite3 *db, const char
 		  :mtime, :parent, :file);
 	rc = sqlite3_prepare_v2(db, sqlstr, -1, stmt, NULL);
 	if (rc != SQLITE_OK) {
-		warnx(%s, sqlite3_errmsg(db));
+		if (mflags.verbosity)
+			warnx(%s, sqlite3_errmsg(db));
 		return;
 	}
 
 	idx = sqlite3_bind_parameter_index(stmt, :device);
 	rc = sqlite3_bind_int64(stmt, idx, device_cache);
 	if (rc != SQLITE_OK) {
-		warnx(%s, sqlite3_errmsg(db));
+		if (mflags.verbosity)
+			warnx(%s, sqlite3_errmsg(db));
 		sqlite3_finalize(stmt);
 		return;
 	}
@@ -518,7 +527,8 @@ build_file_cache(sqlite3 *db, const char
 	idx = sqlite3_bind_parameter_index(stmt, :inode);
 	rc = sqlite3_bind_int64(stmt, idx, inode_cache);
 	if (rc != SQLITE_OK) {
-		warnx(%s, sqlite3_errmsg(db));
+		if 

CVS commit: src/etc

2012-08-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Aug 29 20:34:19 UTC 2012

Modified Files:
src/etc: daily weekly
src/etc/rc.d: makemandb

Log Message:
Use new makemandb -Q flag to be really quiet.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/etc/daily
cvs rdiff -u -r1.28 -r1.29 src/etc/weekly
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/makemandb

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

Modified files:

Index: src/etc/daily
diff -u src/etc/daily:1.86 src/etc/daily:1.87
--- src/etc/daily:1.86	Fri Aug  3 10:52:46 2012
+++ src/etc/daily	Wed Aug 29 20:34:18 2012
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: daily,v 1.86 2012/08/03 10:52:46 christos Exp $
+#	$NetBSD: daily,v 1.87 2012/08/29 20:34:18 wiz Exp $
 #	@(#)daily	8.2 (Berkeley) 1/25/94
 #
 
@@ -304,7 +304,7 @@ if checkyesno run_makemandb; then
 	if [ -f /etc/man.conf -a -x /usr/sbin/makemandb ]; then
 		echo 
 		echo Updating man page index:
-		(umask 022; nice -n 5 /usr/sbin/makemandb -q)
+		(umask 022; nice -n 5 /usr/sbin/makemandb -Q)
 	fi
 fi
 

Index: src/etc/weekly
diff -u src/etc/weekly:1.28 src/etc/weekly:1.29
--- src/etc/weekly:1.28	Tue Jul 31 12:11:50 2012
+++ src/etc/weekly	Wed Aug 29 20:34:19 2012
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: weekly,v 1.28 2012/07/31 12:11:50 jdf Exp $
+#	$NetBSD: weekly,v 1.29 2012/08/29 20:34:19 wiz Exp $
 #	from: @(#)weekly	8.2 (Berkeley) 1/2/94
 #
 
@@ -94,7 +94,7 @@ if checkyesno rebuild_mandb; then
 	echo 
 	if [ -f /etc/man.conf -a -x /usr/sbin/makemandb ]; then
 		echo Rebuilding man page index:
-		(umask 022; nice -n 5 /usr/sbin/makemandb -f -q)
+		(umask 022; nice -n 5 /usr/sbin/makemandb -f -Q)
 	else
 		echo Not rebuilding man page index
 	fi

Index: src/etc/rc.d/makemandb
diff -u src/etc/rc.d/makemandb:1.3 src/etc/rc.d/makemandb:1.4
--- src/etc/rc.d/makemandb:1.3	Sun Jun 17 02:13:13 2012
+++ src/etc/rc.d/makemandb	Wed Aug 29 20:34:19 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makemandb,v 1.3 2012/06/17 02:13:13 isaki Exp $
+# $NetBSD: makemandb,v 1.4 2012/08/29 20:34:19 wiz Exp $
 #
 
 # PROVIDE: makemandb
@@ -18,7 +18,7 @@ stop_cmd=:
 makemandb_start()
 {
 	# Initiate update build in the background
-	nice -n 5 /usr/sbin/makemandb -q  /dev/null 21 
+	nice -n 5 /usr/sbin/makemandb -Q  /dev/null 21 
 }
 
 load_rc_config $name



CVS commit: src/sys/netipsec

2012-08-29 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Wed Aug 29 20:37:51 UTC 2012

Modified Files:
src/sys/netipsec: key.c keydb.h

Log Message:
g/c unused struct member


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/netipsec/key.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netipsec/keydb.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.76 src/sys/netipsec/key.c:1.77
--- src/sys/netipsec/key.c:1.76	Mon Jan  9 15:42:08 2012
+++ src/sys/netipsec/key.c	Wed Aug 29 20:37:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.76 2012/01/09 15:42:08 drochner Exp $	*/
+/*	$NetBSD: key.c,v 1.77 2012/08/29 20:37:50 drochner Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 	
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: key.c,v 1.76 2012/01/09 15:42:08 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: key.c,v 1.77 2012/08/29 20:37:50 drochner Exp $);
 
 /*
  * This code is referd to RFC 2367
@@ -3052,11 +3052,6 @@ key_delsav(struct secasvar *sav)
 		KFREE(sav-key_enc);
 		sav-key_enc = NULL;
 	}
-	if (sav-sched) {
-		memset(sav-sched, 0, sav-schedlen);
-		KFREE(sav-sched);
-		sav-sched = NULL;
-	}
 	if (sav-replay != NULL) {
 		KFREE(sav-replay);
 		sav-replay = NULL;
@@ -3189,8 +3184,6 @@ key_setsaval(struct secasvar *sav, struc
 	sav-replay = NULL;
 	sav-key_auth = NULL;
 	sav-key_enc = NULL;
-	sav-sched = NULL;
-	sav-schedlen = 0;
 	sav-lft_c = NULL;
 	sav-lft_h = NULL;
 	sav-lft_s = NULL;
@@ -3412,10 +3405,6 @@ key_setsaval(struct secasvar *sav, struc
 		KFREE(sav-key_enc);
 		sav-key_enc = NULL;
 	}
-	if (sav-sched) {
-		KFREE(sav-sched);
-		sav-sched = NULL;
-	}
 	if (sav-lft_c != NULL) {
 		KFREE(sav-lft_c);
 		sav-lft_c = NULL;

Index: src/sys/netipsec/keydb.h
diff -u src/sys/netipsec/keydb.h:1.11 src/sys/netipsec/keydb.h:1.12
--- src/sys/netipsec/keydb.h:1.11	Wed Jan 11 14:37:45 2012
+++ src/sys/netipsec/keydb.h	Wed Aug 29 20:37:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: keydb.h,v 1.11 2012/01/11 14:37:45 drochner Exp $	*/
+/*	$NetBSD: keydb.h,v 1.12 2012/08/29 20:37:51 drochner Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/keydb.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$KAME: keydb.h,v 1.14 2000/08/02 17:58:26 sakane Exp $	*/
 
@@ -104,8 +104,6 @@ struct secasvar {
 	struct sadb_key *key_auth;	/* Key for Authentication */
 	struct sadb_key *key_enc;	/* Key for Encryption */
 	u_int ivlen;			/* length of IV */
-	void *sched;			/* intermediate encryption key */
-	size_t schedlen;
 
 	struct secreplay *replay;	/* replay prevention */
 	time_t created;			/* for lifetime */



CVS commit: src/sys/arch/arm/include

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 22:25:05 UTC 2012

Modified Files:
src/sys/arch/arm/include: asm.h

Log Message:
Add __BIT(n) macro


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/include/asm.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/arm/include/asm.h
diff -u src/sys/arch/arm/include/asm.h:1.14 src/sys/arch/arm/include/asm.h:1.15
--- src/sys/arch/arm/include/asm.h:1.14	Thu Jun 30 20:09:20 2011
+++ src/sys/arch/arm/include/asm.h	Wed Aug 29 22:25:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.14 2011/06/30 20:09:20 wiz Exp $	*/
+/*	$NetBSD: asm.h,v 1.15 2012/08/29 22:25:05 matt Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,6 +39,8 @@
 
 #include arm/cdefs.h
 
+#define	__BIT(n)	(1  (n))
+
 #define _C_LABEL(x)	x
 #define	_ASM_LABEL(x)	x
 



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

2012-08-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Aug 29 22:43:35 UTC 2012

Modified Files:
src/sys/arch/i386/i386: i386func.S

Log Message:
tlbflushg/i386: test for the PGE feature flag first, before checking the %cr4.
Add a comment explaining why need to check both and in such order.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/i386/i386func.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/i386/i386/i386func.S
diff -u src/sys/arch/i386/i386/i386func.S:1.16 src/sys/arch/i386/i386/i386func.S:1.17
--- src/sys/arch/i386/i386/i386func.S:1.16	Sun Jun 12 03:35:42 2011
+++ src/sys/arch/i386/i386/i386func.S	Wed Aug 29 22:43:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $	*/
+/*	$NetBSD: i386func.S,v 1.17 2012/08/29 22:43:35 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: i386func.S,v 1.16 2011/06/12 03:35:42 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: i386func.S,v 1.17 2012/08/29 22:43:35 rmind Exp $);
 
 #include machine/specialreg.h
 #include machine/segments.h
@@ -99,9 +99,13 @@ END(lcr3)
  *
  * (the alternatives not quoted above are not an option here.)
  *
- * If PGE is not in use, we reload CR3.
+ * If PGE is not in use, we reload CR3.  Check for the PGE feature
+ * first since i486 does not have CR4.  Note: the feature flag may
+ * be present while the actual PGE functionality not yet enabled.
  */
 ENTRY(tlbflushg)
+	testl	$CPUID_PGE, _C_LABEL(cpu_feature)
+	jz	1f
 	movl	%cr4, %eax
 	testl	$CR4_PGE, %eax
 	jz	1f



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

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 22:43:57 UTC 2012

Modified Files:
src/sys/arch/arm/conf: kern.ldscript.head

Log Message:
Add __stub_start and __stub_end symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/conf/kern.ldscript.head

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/arm/conf/kern.ldscript.head
diff -u src/sys/arch/arm/conf/kern.ldscript.head:1.2 src/sys/arch/arm/conf/kern.ldscript.head:1.3
--- src/sys/arch/arm/conf/kern.ldscript.head:1.2	Sun Dec 11 12:16:45 2005
+++ src/sys/arch/arm/conf/kern.ldscript.head	Wed Aug 29 22:43:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.head,v 1.2 2005/12/11 12:16:45 christos Exp $	*/
+/*	$NetBSD: kern.ldscript.head,v 1.3 2012/08/29 22:43:57 matt Exp $	*/
 
 OUTPUT_FORMAT(elf32-littlearm, elf32-bigarm,
 	  elf32-littlearm)
@@ -12,6 +12,8 @@ SECTIONS
   {
 *(.text)
 *(.text.*)
+__stub_start = .
 *(.stub)
+__stub_end = .
 *(.glue_7t) *(.glue_7)
 *(.rodata) *(.rodata.*)



CVS commit: src/sys/arch/arm

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 29 23:10:31 UTC 2012

Modified Files:
src/sys/arch/arm/arm: arm_machdep.c
src/sys/arch/arm/arm32: exception.S genassym.cf
src/sys/arch/arm/include: cpu.h
src/sys/arch/arm/include/arm32: machdep.h

Log Message:
Don't use locations in .data to store exception temporaries, use decidicated
space in cpu_info instead.  This also moves undefined_handler_address into
cpu_info as well.
Use the new armreg* inlines for getting TPIDRPRW register.
Add MULTIPROCESSOR version of CPU_INFO_FOREACH


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/arm/arm_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/arm32/exception.S
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/arm/arm32/genassym.cf
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/arm32/machdep.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/arm/arm/arm_machdep.c
diff -u src/sys/arch/arm/arm/arm_machdep.c:1.34 src/sys/arch/arm/arm/arm_machdep.c:1.35
--- src/sys/arch/arm/arm/arm_machdep.c:1.34	Wed Aug 29 07:14:03 2012
+++ src/sys/arch/arm/arm/arm_machdep.c	Wed Aug 29 23:10:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_machdep.c,v 1.34 2012/08/29 07:14:03 matt Exp $	*/
+/*	$NetBSD: arm_machdep.c,v 1.35 2012/08/29 23:10:31 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -78,7 +78,7 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(0, $NetBSD: arm_machdep.c,v 1.34 2012/08/29 07:14:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: arm_machdep.c,v 1.35 2012/08/29 23:10:31 matt Exp $);
 
 #include sys/exec.h
 #include sys/proc.h
@@ -100,11 +100,24 @@ __KERNEL_RCSID(0, $NetBSD: arm_machdep.
 char	machine[] = MACHINE;		/* from machine/param.h */
 char	machine_arch[] = MACHINE_ARCH;	/* from machine/param.h */
 
+#ifdef __PROG32
+extern const uint32_t undefinedinstruction_bounce[];
+#endif
+
 /* Our exported CPU info; we can have only one. */
 struct cpu_info cpu_info_store = {
 	.ci_cpl = IPL_HIGH,
 	.ci_curlwp = lwp0,
+#ifdef __PROG32
+	.ci_undefsave[2] = (register_t) undefinedinstruction_bounce,
+#endif
+};
+
+#ifdef MULTIPROCESSOR
+struct cpu_info *cpu_info[MAXCPUS] = {
+	[0] = cpu_info_store
 };
+#endif
 
 const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {
 #if defined(FPU_VFP)

Index: src/sys/arch/arm/arm32/exception.S
diff -u src/sys/arch/arm/arm32/exception.S:1.16 src/sys/arch/arm/arm32/exception.S:1.17
--- src/sys/arch/arm/arm32/exception.S:1.16	Sun Apr 27 18:58:44 2008
+++ src/sys/arch/arm/arm32/exception.S	Wed Aug 29 23:10:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.S,v 1.16 2008/04/27 18:58:44 matt Exp $	*/
+/*	$NetBSD: exception.S,v 1.17 2012/08/29 23:10:31 matt Exp $	*/
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -50,7 +50,7 @@
 #include machine/cpu.h
 #include machine/frame.h
 
-	RCSID($NetBSD: exception.S,v 1.16 2008/04/27 18:58:44 matt Exp $)
+	RCSID($NetBSD: exception.S,v 1.17 2012/08/29 23:10:31 matt Exp $)
 
 	.text	
 	.align	0
@@ -213,16 +213,13 @@ exception_exit:
  */
 ASENTRY_NP(undefined_entry)
 	stmfd	sp!, {r0, r1}
-	ldr	r0, Lundefined_handler_indirection
+	GET_CURCPU(r0)
 	ldr	r1, [sp], #0x0004
-	str	r1, [r0, #0x]
+	str	r1, [r0, #CI_UNDEFSAVE]!
 	ldr	r1, [sp], #0x0004
 	str	r1, [r0, #0x0004]
 	ldmia	r0, {r0, r1, pc}
 
-Lundefined_handler_indirection:
-	.word	Lundefined_handler_indirection_data
-
 /*
  * assembly bounce code for calling the kernel
  * undefined instruction handler. This uses
@@ -236,20 +233,3 @@ ENTRY_NP(undefinedinstruction_bounce)
 	mov	r0, sp
 	adr	lr, exception_exit
 	b	_C_LABEL(undefinedinstruction)
-
-	.data
-	.align	0
-
-/*
- * Indirection data
- * 2 words use for preserving r0 and r1
- * 3rd word contains the undefined handler address.
- */
-
-Lundefined_handler_indirection_data:
-	.word	0
-	.word	0
-
-	.global	_C_LABEL(undefined_handler_address)
-_C_LABEL(undefined_handler_address):
-	.word	_C_LABEL(undefinedinstruction_bounce)

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.50 src/sys/arch/arm/arm32/genassym.cf:1.51
--- src/sys/arch/arm/arm32/genassym.cf:1.50	Wed Aug 29 07:09:12 2012
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Aug 29 23:10:31 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.50 2012/08/29 07:09:12 matt Exp $
+#	$NetBSD: genassym.cf,v 1.51 2012/08/29 23:10:31 matt Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -74,6 +74,7 @@ define	KERNEL_BASE		KERNEL_BASE
 define	VM_MIN_ADDRESS		VM_MIN_ADDRESS
 define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS
 
+define	PV_PA			offsetof(pv_addr_t, pv_pa)
 define	PMAP_DOMAIN_KERNEL	PMAP_DOMAIN_KERNEL
 define	DOMAIN_CLIENT		DOMAIN_CLIENT
 define	L1_S_PROTO_generic	L1_S_PROTO_generic
@@ -163,12 +164,14 @@ define	CI_ASTPENDING		offsetof(struct cp
 define	CI_WANT_RESCHED		

CVS commit: src/sys/arch/arm/include/arm32

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 30 02:10:15 UTC 2012

Modified Files:
src/sys/arch/arm/include/arm32: pmap.h

Log Message:
Add a l1pte_supersection_p macro.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/arm/include/arm32/pmap.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/arm/include/arm32/pmap.h
diff -u src/sys/arch/arm/include/arm32/pmap.h:1.103 src/sys/arch/arm/include/arm32/pmap.h:1.104
--- src/sys/arch/arm/include/arm32/pmap.h:1.103	Mon Aug 20 13:03:41 2012
+++ src/sys/arch/arm/include/arm32/pmap.h	Thu Aug 30 02:10:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.103 2012/08/20 13:03:41 matt Exp $	*/
+/*	$NetBSD: pmap.h,v 1.104 2012/08/30 02:10:15 matt Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -403,8 +403,12 @@ extern int pmap_needs_pte_sync;
  * this at compile time.
  */
 #if (ARM_MMU_SA1 + ARM_MMU_V6 + ARM_MMU_V7 != 0)  (ARM_NMMUS == 1) 
-#define	PMAP_NEEDS_PTE_SYNC	1
 #define	PMAP_INCLUDE_PTE_SYNC
+#if (ARM_MMU_V7  0)
+#define	PMAP_NEEDS_PTE_SYNC	1
+#else
+#define	PMAP_NEEDS_PTE_SYNC	1
+#endif
 #elif (ARM_MMU_SA1 == 0)
 #define	PMAP_NEEDS_PTE_SYNC	0
 #endif
@@ -419,22 +423,23 @@ extern int pmap_needs_pte_sync;
 #define	PMAP_INCLUDE_PTE_SYNC
 #endif
 
-#define	PTE_SYNC(pte)			\
-do {	\
-	if (PMAP_NEEDS_PTE_SYNC)	\
-		cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t));\
-} while (/*CONSTCOND*/0)
+static inline void
+pmap_ptesync(pt_entry_t *ptep, size_t cnt)
+{
+	if (PMAP_NEEDS_PTE_SYNC)
+		cpu_dcache_wb_range((vaddr_t)ptep, cnt * sizeof(pt_entry_t));
+#if ARM_MMU_V7  0
+	__asm(dsb);
+#endif
+}
 
-#define	PTE_SYNC_RANGE(pte, cnt)	\
-do {	\
-	if (PMAP_NEEDS_PTE_SYNC) {	\
-		cpu_dcache_wb_range((vaddr_t)(pte),			\
-		(cnt)  2); /* * sizeof(pt_entry_t) */		\
-	}\
-} while (/*CONSTCOND*/0)
+#define	PTE_SYNC(ptep)			pmap_ptesync((ptep), 1)
+#define	PTE_SYNC_RANGE(ptep, cnt)	pmap_ptesync((ptep), (cnt))
 
 #define	l1pte_valid(pde)	((pde) != 0)
 #define	l1pte_section_p(pde)	(((pde)  L1_TYPE_MASK) == L1_TYPE_S)
+#define	l1pte_supersection_p(pde) (l1pte_section_p(pde)	\
+ ((pde)  L1_S_V6_SUPER) != 0)
 #define	l1pte_page_p(pde)	(((pde)  L1_TYPE_MASK) == L1_TYPE_C)
 #define	l1pte_fpage_p(pde)	(((pde)  L1_TYPE_MASK) == L1_TYPE_F)
 



CVS commit: src/sys/kern

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 30 02:23:14 UTC 2012

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

Log Message:
Use __cacheline_aligned


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/kern/kern_lock.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_lock.c
diff -u src/sys/kern/kern_lock.c:1.152 src/sys/kern/kern_lock.c:1.153
--- src/sys/kern/kern_lock.c:1.152	Sun Nov 27 03:24:00 2011
+++ src/sys/kern/kern_lock.c	Thu Aug 30 02:23:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.152 2011/11/27 03:24:00 jmcneill Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.153 2012/08/30 02:23:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.152 2011/11/27 03:24:00 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.153 2012/08/30 02:23:14 matt Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -53,7 +53,7 @@ __KERNEL_RCSID(0, $NetBSD: kern_lock.c,
 bool	kernel_lock_dodebug;
 
 __cpu_simple_lock_t kernel_lock[CACHE_LINE_SIZE / sizeof(__cpu_simple_lock_t)]
-__aligned(CACHE_LINE_SIZE);
+__cacheline_aligned;
 
 void
 assert_sleepable(void)



CVS commit: src/sys/kern

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 30 02:24:20 UTC 2012

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

Log Message:
Give config thread more descriptive names.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/subr_autoconf.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/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.222 src/sys/kern/subr_autoconf.c:1.223
--- src/sys/kern/subr_autoconf.c:1.222	Mon Jan 30 23:31:27 2012
+++ src/sys/kern/subr_autoconf.c	Thu Aug 30 02:24:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.222 2012/01/30 23:31:27 matt Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.223 2012/08/30 02:24:20 matt Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.222 2012/01/30 23:31:27 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_autoconf.c,v 1.223 2012/08/30 02:24:20 matt Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddb.h
@@ -447,7 +447,7 @@ config_create_interruptthreads(void)
 
 	for (i = 0; i  interrupt_config_threads; i++) {
 		(void)kthread_create(PRI_NONE, 0, NULL,
-		config_interrupts_thread, NULL, NULL, config);
+		config_interrupts_thread, NULL, NULL, configintr);
 	}
 }
 
@@ -474,7 +474,7 @@ config_create_mountrootthreads(void)
 
 	for (i = 0; i  mountroot_config_threads; i++) {
 		(void)kthread_create(PRI_NONE, 0, NULL,
-		config_mountroot_thread, NULL, NULL, config);
+		config_mountroot_thread, NULL, NULL, configroot);
 	}
 }
 



CVS commit: src/sys/kern

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 30 02:26:03 UTC 2012

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

Log Message:
A few more KASSERT/KASSERTMSG.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/kern/kern_lwp.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_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.171 src/sys/kern/kern_lwp.c:1.172
--- src/sys/kern/kern_lwp.c:1.171	Sun Jul 22 22:40:19 2012
+++ src/sys/kern/kern_lwp.c	Thu Aug 30 02:26:02 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.171 2012/07/22 22:40:19 rmind Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.172 2012/08/30 02:26:02 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.171 2012/07/22 22:40:19 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lwp.c,v 1.172 2012/08/30 02:26:02 matt Exp $);
 
 #include opt_ddb.h
 #include opt_lockdebug.h
@@ -919,6 +919,7 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_
 void
 lwp_startup(struct lwp *prev, struct lwp *new)
 {
+	KASSERTMSG(new == curlwp, l %p curlwp %p prevlwp %p, new, curlwp, prev);
 
 	SDT_PROBE(proc,,,lwp_start, new, 0,0,0,0);
 
@@ -983,6 +984,7 @@ lwp_exit(struct lwp *l)
 	mutex_enter(p-p_lock);
 	if (p-p_nlwps - p-p_nzlwps == 1) {
 		KASSERT(current == true);
+		KASSERT(p != proc0);
 		/* XXXSMP kernel_lock not held */
 		exit1(l, 0);
 		/* NOTREACHED */



CVS commit: src/sys/kern

2012-08-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug 30 02:26:38 UTC 2012

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

Log Message:
Add a new more KASSERT/KASSERTMSG


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 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.303 src/sys/kern/kern_synch.c:1.304
--- src/sys/kern/kern_synch.c:1.303	Sat Aug 18 08:54:06 2012
+++ src/sys/kern/kern_synch.c	Thu Aug 30 02:26:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.303 2012/08/18 08:54:06 christos Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.304 2012/08/30 02:26:38 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.303 2012/08/18 08:54:06 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.304 2012/08/30 02:26:38 matt Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -522,6 +522,7 @@ mi_switch(lwp_t *l)
 
 	binuptime(bt);
 
+	KASSERTMSG(l == curlwp, l %p curlwp %p, l, curlwp);
 	KASSERT((l-l_pflag  LP_RUNNING) != 0);
 	KASSERT(l-l_cpu == curcpu());
 	ci = l-l_cpu;
@@ -712,8 +713,13 @@ mi_switch(lwp_t *l)
 		}
 
 		/* Switch to the new LWP.. */
+		KASSERT(curlwp == ci-ci_curlwp);
+		KASSERTMSG(l == curlwp, l %p curlwp %p, l, curlwp);
 		prevlwp = cpu_switchto(l, newl, returning);
 		ci = curcpu();
+		KASSERT(curlwp == ci-ci_curlwp);
+		KASSERTMSG(l == curlwp, l %p curlwp %p prevlwp %p,
+		l, curlwp, prevlwp);
 
 		/*
 		 * Switched away - we have new curlwp.