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

2015-06-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun  4 08:55:24 UTC 2015

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: intel_busclock.c

Log Message:
Pull up the following revisions, requested by sborrill in #1963:

sys/arch/x86/x86/intel_busclock.c   1.10, 1.13-23

Update p[34]_get_bus_clock() to avoid panic in est(4).
Return correct bus clock on some CPUs. Use rdmsr_safe()
to access MSRs safely.


To generate a diff of this commit:
cvs rdiff -u -r1.5.10.5 -r1.5.10.6 src/sys/arch/x86/x86/intel_busclock.c

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

Modified files:

Index: src/sys/arch/x86/x86/intel_busclock.c
diff -u src/sys/arch/x86/x86/intel_busclock.c:1.5.10.5 src/sys/arch/x86/x86/intel_busclock.c:1.5.10.6
--- src/sys/arch/x86/x86/intel_busclock.c:1.5.10.5	Wed Aug 22 21:18:19 2012
+++ src/sys/arch/x86/x86/intel_busclock.c	Thu Jun  4 08:55:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_busclock.c,v 1.5.10.5 2012/08/22 21:18:19 bouyer Exp $	*/
+/*	$NetBSD: intel_busclock.c,v 1.5.10.6 2015/06/04 08:55:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.5 2012/08/22 21:18:19 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.6 2015/06/04 08:55:24 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -91,25 +91,24 @@ p3_get_bus_clock(struct cpu_info *ci)
 {
 	uint64_t msr;
 	int bus, bus_clock = 0;
+	uint32_t model;
 
-	switch (CPUID2MODEL(ci-ci_signature)) {
+	model = CPUID_TO_MODEL(ci-ci_signature);
+		
+	switch (model) {
 	case 0x9: /* Pentium M (130 nm, Banias) */
 		bus_clock = 1;
 		break;
 	case 0xc: /* Core i7, Atom, model 1 */
 		/*
-		 * XXX (See also case 0xe and 0xd)
-		 * Some core i7 CPUs can report model 0xc.
 		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
 		 * In the long-term, use ACPI instead of all this.
 		 */
-		switch (CPUID2EXTMODEL(ci-ci_signature)) {
-		case 0x2:
-			aprint_debug(%s: unable to determine bus speed,
-			device_xname(ci-ci_dev));
+		if (rdmsr_safe(MSR_FSB_FREQ, msr) == EFAULT) {
+			aprint_debug_dev(ci-ci_dev,
+			unable to determine bus speed);
 			goto print_msr;
 		}
-		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {
 		case 1:
@@ -121,20 +120,12 @@ p3_get_bus_clock(struct cpu_info *ci)
 			goto print_msr;
 		}
 		break;
-	case 0xd: /* Pentium M (90 nm, Dothan), some Xeons */
-		/*
-		 * XXX (See also case 0xc and 0xd)
-		 * Some Xeons can report model 0xd, e.g. E5-2630
-		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
-		 * In the long-term, use ACPI instead of all this.
-		 */
-		switch (CPUID2EXTMODEL(ci-ci_signature)) {
-		case 0x2:
-			aprint_debug(%s: unable to determine bus speed,
-			device_xname(ci-ci_dev));
+	case 0xd: /* Pentium M (90 nm, Dothan) */
+		if (rdmsr_safe(MSR_FSB_FREQ, msr) == EFAULT) {
+			aprint_debug_dev(ci-ci_dev,
+			unable to determine bus speed);
 			goto print_msr;
 		}
-		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {
 		case 0:
@@ -150,20 +141,13 @@ p3_get_bus_clock(struct cpu_info *ci)
 		}
 		break;
 	case 0xe: /* Core Duo/Solo */
-		/*
-		 * XXX (See also case 0xc)
-		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
-		 * In the long-term, use ACPI instead of all this.
-		 */
-		switch (CPUID2EXTMODEL(ci-ci_signature)) {
-		case 0x1:
-			aprint_debug(%s: unable to determine bus speed,
-			device_xname(ci-ci_dev));
+	case 0xf: /* Core Xeon */
+	case 0x17: /* Xeon [35]000, Core 2 Quad [89]00 */
+		if (rdmsr_safe(MSR_FSB_FREQ, msr) == EFAULT) {
+			aprint_debug_dev(ci-ci_dev,
+			unable to determine bus speed);
 			goto print_msr;
 		}
-		/* FALLTHROUGH */
-	case 0xf: /* Core Xeon */
-		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {
 		case 5:
@@ -184,6 +168,9 @@ p3_get_bus_clock(struct cpu_info *ci)
 		case 4:
 			bus_clock = 3;
 			break;
+		case 6:
+			bus_clock = 4;
+			break;
 		default:
 			aprint_debug(%s: unknown Core FSB_FREQ value %d,
 			device_xname(ci-ci_dev), bus);
@@ -210,16 +197,135 @@ p3_get_bus_clock(struct cpu_info *ci)
 		case 2:
 			bus_clock = 1;
 			break;
+		case 3:
+			bus_clock = 10666;
+			break;
 		default:
 			aprint_debug(%s: unknown i686 EBL_CR_POWERON 
 			value %d , device_xname(ci-ci_dev), bus);
 			goto print_msr;
 		}
 		break;
+	case 0x1c: /* Atom */
+	case 0x26:
+	case 0x27:
+	case 0x35:
+	case 0x36:
+		if (rdmsr_safe(MSR_FSB_FREQ, msr) == EFAULT) {
+			aprint_debug_dev(ci-ci_dev,
+			unable to determine bus speed);
+			goto print_msr;
+		}
+		bus = (msr  0)  0x7;
+		switch (bus) {
+		case 7:
+			bus_clock =  8333;
+			break;
+		case 5:
+			bus_clock = 1;
+			break;
+		case 1:
+			bus_clock = 1;
+			break;
+		case 3:
+			bus_clock = 16667;
+			break;
+		

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

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 15:45:46 UTC 2015

Modified Files:
src/sys/arch/x86/include [netbsd-5]: specialreg.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1968):
sys/arch/x86/include/specialreg.h: revision 1.72 via patch

Backport CPUID_TO_*() macros. Old macros are kept for compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.3 -r1.31.4.4 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.3 src/sys/arch/x86/include/specialreg.h:1.31.4.4
--- src/sys/arch/x86/include/specialreg.h:1.31.4.3	Wed Jun 19 07:44:42 2013
+++ src/sys/arch/x86/include/specialreg.h	Mon Jun  1 15:45:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.3 2013/06/19 07:44:42 bouyer Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.4 2015/06/01 15:45:46 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -240,13 +240,39 @@
 			\11TM2\12SSSE3\13CID\16CX16\17xTPR\20PDCM\23DCA \
 			\24SSE41\25SSE42\26X2APIC\30POPCNT
 
-#define CPUID2FAMILY(cpuid)	(((cpuid)  8)  0xf)
-#define CPUID2MODEL(cpuid)	(((cpuid)  4)  0xf)
-#define CPUID2STEPPING(cpuid)	((cpuid)  0xf)
-
-/* Extended family and model are defined on amd64 processors */
-#define CPUID2EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
-#define CPUID2EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+/* CPUID Fn0001 %eax */
+
+#define CPUID_TO_BASEFAMILY(cpuid)	(((cpuid)  8)  0xf)
+#define CPUID_TO_BASEMODEL(cpuid)	(((cpuid)  4)  0xf)
+#define CPUID_TO_STEPPING(cpuid)	((cpuid)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2FAMILY(cpuid)	CPUID_TO_BASEFAMILY(cpuid)
+#define CPUID2MODEL(cpuid)	CPUID_TO_BASEMODEL(cpuid)
+#define CPUID2STEPPING(cpuid)	CPUID_TO_STEPPING(cpuid)
+
+/*
+ * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY()
+ * returns 15. They are use to encode family value 16 to 270 (add 15).
+ * The Extended model bits are the high 4 bits of the model.
+ * They are only valid for family = 15 or family 6 (intel, but all amd
+ * family 6 are documented to return zero bits for them).
+ */
+#define CPUID_TO_EXTFAMILY(cpuid)	(((cpuid)  20)  0xff)
+#define CPUID_TO_EXTMODEL(cpuid)	(((cpuid)  16)  0xf)
+
+/* Old macros for compatibility */
+#define CPUID2EXTFAMILY(cpuid)	CPUID_TO_EXTFAMILY(cpuid)
+#define CPUID2EXTMODEL(cpuid)	CPUID_TO_EXTMODEL(cpuid)
+
+/* The macros for the Display Family and the Display Model */
+#define CPUID_TO_FAMILY(cpuid)	(CPUID_TO_BASEFAMILY(cpuid)	\
+	+ ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		? 0 : CPUID_TO_EXTFAMILY(cpuid)))
+#define CPUID_TO_MODEL(cpuid)	(CPUID_TO_BASEMODEL(cpuid)	\
+	| ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f)		\
+		 (CPUID_TO_BASEFAMILY(cpuid) != 0x06)		\
+		? 0 : (CPUID_TO_EXTMODEL(cpuid)  4)))
 
 /*
  * Model-specific registers for the i386 family



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

2015-06-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun  1 14:38:32 UTC 2015

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: cpufunc.S
src/sys/arch/i386/i386 [netbsd-5]: cpufunc.S
src/sys/arch/x86/include [netbsd-5]: cpufunc.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1969):
sys/arch/x86/include/cpufunc.h: revision 1.13
sys/arch/amd64/amd64/cpufunc.S: revision 1.20-1.21 via patch
sys/arch/i386/i386/cpufunc.S:   revision 1.16-1.17, 1.21 via 
patch

Backport rdmsr_safe() to access MSR safely.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.6.1 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.8.10.3 -r1.8.10.4 src/sys/arch/x86/include/cpufunc.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/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.15 src/sys/arch/amd64/amd64/cpufunc.S:1.15.6.1
--- src/sys/arch/amd64/amd64/cpufunc.S:1.15	Tue Jun 24 16:32:53 2008
+++ src/sys/arch/amd64/amd64/cpufunc.S	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.15 2008/06/24 16:32:53 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.15.6.1 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -33,6 +33,8 @@
  * Functions to provide access to i386-specific instructions.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
 #include machine/specialreg.h
 #include machine/segments.h
@@ -215,6 +217,37 @@ ENTRY(wrmsr_locked)
 	wrmsr
 	ret
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$_C_LABEL(msr_onfault), PCB_ONFAULT(%r8)
+
+	movl	%edi, %ecx /* u_int msr */
+	rdmsr			/* Read MSR pointed by %ecx. Returns
+   hi byte in edx, lo in %eax */
+	salq	$32, %rdx	/* sign-shift %rdx left */
+	movl	%eax, %eax	/* zero-extend %eax - %rax */
+	orq	%rdx, %rax
+	movq	%rax, (%rsi)  /* *data */
+	xorq	%rax, %rax/* no error */
+
+	movq	%rax, PCB_ONFAULT(%r8)
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movq	CPUVAR(CURLWP), %r8
+	movq	L_ADDR(%r8), %r8
+	movq	$0, PCB_ONFAULT(%r8)
+	movl	$EFAULT, %eax
+	ret
+
 #ifndef XEN
 ENTRY(wbinvd)
 	wbinvd

Index: src/sys/arch/i386/i386/cpufunc.S
diff -u src/sys/arch/i386/i386/cpufunc.S:1.13 src/sys/arch/i386/i386/cpufunc.S:1.13.4.1
--- src/sys/arch/i386/i386/cpufunc.S:1.13	Tue Sep 23 08:50:11 2008
+++ src/sys/arch/i386/i386/cpufunc.S	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.13.4.1 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -35,8 +35,10 @@
  * These are shared with NetBSD/xen.
  */
 
+#include sys/errno.h
+
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13 2008/09/23 08:50:11 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.S,v 1.13.4.1 2015/06/01 14:38:31 sborrill Exp $);
 
 #include opt_xen.h
 
@@ -141,6 +143,39 @@ ENTRY(wrmsr_locked)
 	ret
 END(wrmsr_locked)
 
+/*
+ * Support for reading MSRs in the safe manner (returns EFAULT on fault)
+ */
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ENTRY(rdmsr_safe)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$_C_LABEL(msr_onfault), PCB_ONFAULT(%ecx)
+
+	movl	4(%esp), %ecx /* u_int msr */
+	rdmsr
+	movl	8(%esp), %ecx /* *data */
+	movl	%eax, (%ecx)  /* low-order bits */
+	movl	%edx, 4(%ecx) /* high-order bits */
+	xorl	%eax, %eax/* no error */
+
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	%eax, PCB_ONFAULT(%ecx)
+
+	ret
+
+/*
+ * MSR operations fault handler
+ */
+NENTRY(msr_onfault)
+	movl	CPUVAR(CURLWP), %ecx
+	movl	L_ADDR(%ecx), %ecx
+	movl	$0, PCB_ONFAULT(%ecx)
+	movl	$EFAULT, %eax
+	ret
+END(msr_onfault)
+
 ENTRY(cpu_counter)
 	rdtsc
 	addl	CPUVAR(CC_SKEW), %eax

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.8.10.3 src/sys/arch/x86/include/cpufunc.h:1.8.10.4
--- src/sys/arch/x86/include/cpufunc.h:1.8.10.3	Mon Feb  2 21:38:50 2009
+++ src/sys/arch/x86/include/cpufunc.h	Mon Jun  1 14:38:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.8.10.3 2009/02/02 21:38:50 snj Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.8.10.4 2015/06/01 14:38:31 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -118,6 +118,7 @@ void	x86_reset(void);
 
 uint64_t	rdmsr(u_int);
 uint64_t	rdmsr_locked(u_int, u_int);
+int		rdmsr_safe(u_int, uint64_t *);
 uint64_t	rdtsc(void);
 uint64_t	rdpmc(u_int);
 void		wrmsr(u_int, uint64_t);



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

2015-05-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri May 22 11:04:28 UTC 2015

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

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1965):
sys/arch/xen/xen/xenevt.c:  revision 1.42

Fix off by one error, addresses port-xen/49919.


To generate a diff of this commit:
cvs rdiff -u -r1.29.4.2 -r1.29.4.3 src/sys/arch/xen/xen/xenevt.c

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

Modified files:

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.29.4.2 src/sys/arch/xen/xen/xenevt.c:1.29.4.3
--- src/sys/arch/xen/xen/xenevt.c:1.29.4.2	Wed Sep 30 00:08:03 2009
+++ src/sys/arch/xen/xen/xenevt.c	Fri May 22 11:04:28 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $  */
+/*  $NetBSD: xenevt.c,v 1.29.4.3 2015/05/22 11:04:28 sborrill Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.29.4.3 2015/05/22 11:04:28 sborrill Exp $);
 
 #include opt_xen.h
 #include sys/param.h
@@ -496,7 +496,7 @@ xenevt_fwrite(struct file *fp, off_t *of
 	if (uio-uio_resid == 0)
 		return (0);
 	nentries = uio-uio_resid / sizeof(uint16_t);
-	if (nentries  NR_EVENT_CHANNELS)
+	if (nentries = NR_EVENT_CHANNELS)
 		return EMSGSIZE;
 	chans = kmem_alloc(nentries * sizeof(uint16_t), KM_SLEEP);
 	if (chans == NULL)
@@ -580,7 +580,7 @@ xenevt_fioctl(struct file *fp, u_long cm
 	{
 		struct ioctl_evtchn_unbind *unbind = addr;
 		
-		if (unbind-port  NR_EVENT_CHANNELS)
+		if (unbind-port = NR_EVENT_CHANNELS)
 			return EINVAL;
 		if (devevent[unbind-port] != d)
 			return ENOTCONN;
@@ -596,7 +596,7 @@ xenevt_fioctl(struct file *fp, u_long cm
 	{
 		struct ioctl_evtchn_notify *notify = addr;
 		
-		if (notify-port  NR_EVENT_CHANNELS)
+		if (notify-port = NR_EVENT_CHANNELS)
 			return EINVAL;
 		if (devevent[notify-port] != d)
 			return ENOTCONN;



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

2015-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Apr 19 06:11:17 UTC 2015

Modified Files:
src/sys/arch/sparc/include [netbsd-5]: openfirm.h
src/sys/arch/sparc/stand/ofwboot [netbsd-5]: Locore.c
loadfile_machdep.c openfirm.h

Log Message:
Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h   1.7
sys/arch/sparc/stand/ofwboot/Locore.c   1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes.  Idea from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.82.1 src/sys/arch/sparc/include/openfirm.h
cvs rdiff -u -r1.10.30.1 -r1.10.30.2 \
src/sys/arch/sparc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.6 -r1.6.4.1 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.3 -r1.3.72.1 src/sys/arch/sparc/stand/ofwboot/openfirm.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/sparc/include/openfirm.h
diff -u src/sys/arch/sparc/include/openfirm.h:1.6 src/sys/arch/sparc/include/openfirm.h:1.6.82.1
--- src/sys/arch/sparc/include/openfirm.h:1.6	Sat Mar  4 02:56:21 2006
+++ src/sys/arch/sparc/include/openfirm.h	Sun Apr 19 06:11:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.6 2006/03/04 02:56:21 uwe Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.6.82.1 2015/04/19 06:11:17 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -49,6 +49,9 @@ typedef uint64_t cell_t;
 #define HDL2CELL(x)	(cell_t)(u_int)(int)(x)
 #define ADR2CELL(x)	(cell_t)(u_int)(int)(x)
 #endif
+#define HDQ2CELL_HI(x)	(cell_t)(0)
+#define HDQ2CELL_LO(x)	(cell_t)(x)
+#define CELL2HDQ(hi,lo)	(lo)
 #else /* SUN4U */
 /* All cells are 4 byte slots */
 typedef uint32_t cell_t;

Index: src/sys/arch/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10.30.1 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10.30.2
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10.30.1	Fri Apr 17 10:49:16 2015
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Sun Apr 19 06:11:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.10.30.1 2015/04/17 10:49:16 msaitoh Exp $	*/
+/*	$NetBSD: Locore.c,v 1.10.30.2 2015/04/19 06:11:17 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -36,15 +36,6 @@
 
 #include machine/cpu.h
 
-vaddr_t	OF_claim_virt(vaddr_t, int);
-vaddr_t	OF_alloc_virt(int, int);
-int	OF_free_virt(vaddr_t, int);
-int	OF_unmap_virt(vaddr_t, int);
-vaddr_t	OF_map_phys(paddr_t, off_t, vaddr_t, int);
-paddr_t	OF_alloc_phys(int, int);
-paddr_t	OF_claim_phys(paddr_t, int);
-int	OF_free_phys(paddr_t, int);
-
 extern int openfirmware(void *);
 
 
@@ -450,9 +441,9 @@ OF_claim_virt(vaddr_t vaddr, int len)
 	args.align = 0;
 	args.len = len;
 	args.vaddr = ADR2CELL(vaddr);
-	if(openfirmware(args) != 0)
+	if (openfirmware(args) != 0)
 		return -1LL;
-	return args.retaddr; /* Kluge till we go 64-bit */
+	return (vaddr_t)args.retaddr;
 }
 
 /* 
@@ -486,13 +477,13 @@ OF_alloc_virt(int len, int align)
 	args.nargs = 4;
 	args.nreturns = 2;
 	args.method = ADR2CELL(claim);
-	args.ihandle = mmuh;
+	args.ihandle = HDL2CELL(mmuh);
 	args.align = align;
 	args.len = len;
 	args.retaddr = ADR2CELL(retaddr);
-	if(openfirmware(args) != 0)
+	if (openfirmware(args) != 0)
 		return -1LL;
-	return (vaddr_t)args.retaddr; /* Kluge till we go 64-bit */
+	return (vaddr_t)args.retaddr;
 }
 
 /* 
@@ -601,8 +592,8 @@ OF_map_phys(paddr_t paddr, off_t size, v
 	args.mode = mode;
 	args.size = size;
 	args.vaddr = ADR2CELL(vaddr);
-	args.paddr_hi = ADR2CELL(paddr32);
-	args.paddr_lo = ADR2CELL(paddr);
+	args.paddr_hi = HDQ2CELL_HI(paddr);
+	args.paddr_lo = HDQ2CELL_LO(paddr);
 
 	if (openfirmware(args) == -1)
 		return -1;
@@ -620,7 +611,6 @@ OF_map_phys(paddr_t paddr, off_t size, v
 paddr_t
 OF_alloc_phys(int len, int align)
 {
-	paddr_t paddr;
 	struct {
 		cell_t name;
 		cell_t nargs;
@@ -647,10 +637,9 @@ OF_alloc_phys(int len, int align)
 	args.ihandle = HDL2CELL(memh);
 	args.align = align;
 	args.len = len;
-	if(openfirmware(args) != 0)
+	if (openfirmware(args) != 0)
 		return -1LL;
-	paddr = (paddr_t)(args.phys_hi32)|((unsigned int)(args.phys_lo));
-	return paddr; /* Kluge till we go 64-bit */
+	return (paddr_t)CELL2HDQ(args.phys_hi, args.phys_lo);
 }
 
 /* 
@@ -661,7 +650,6 @@ OF_alloc_phys(int len, int align)
 paddr_t
 OF_claim_phys(paddr_t phys, int len)
 {
-	paddr_t paddr;
 	struct {
 		cell_t name;
 		cell_t nargs;
@@ -691,12 +679,11 @@ OF_claim_phys(paddr_t phys, int len)
 	args.ihandle = HDL2CELL(memh);
 	args.align = 0;
 	args.len = len;
-	args.phys_hi = HDL2CELL(phys32);
-	args.phys_lo = HDL2CELL(phys);
-	if(openfirmware(args) != 0)
+	args.phys_hi = HDQ2CELL_HI(phys);
+	args.phys_lo = HDQ2CELL_LO(phys);
+	if 

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

2015-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 17 10:49:16 UTC 2015

Modified Files:
src/sys/arch/sparc/stand/ofwboot [netbsd-5]: Locore.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1958):
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.30.1 src/sys/arch/sparc/stand/ofwboot/Locore.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10.30.1
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.10	Wed Oct 17 19:57:16 2007
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Fri Apr 17 10:49:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.10 2007/10/17 19:57:16 garbled Exp $	*/
+/*	$NetBSD: Locore.c,v 1.10.30.1 2015/04/17 10:49:16 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -311,8 +311,8 @@ OF_seek(int handle, u_quad_t pos)
 	args.nargs = 3;
 	args.nreturns = 1;
 	args.handle = HDL2CELL(handle);
-	args.poshi = HDL2CELL(pos  32);
-	args.poslo = HDL2CELL(pos);
+	args.poshi = HDQ2CELL_HI(pos);
+	args.poslo = HDQ2CELL_LO(pos);
 	if (openfirmware(args) == -1) {
 		return -1;
 	}



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

2015-01-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 26 13:34:03 UTC 2015

Modified Files:
src/sys/arch/x86/pci [netbsd-5]: ichlpcib.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1944):
sys/arch/x86/pci/ichlpcib.c: revision 1.46

The PMBASE and GPIOBASE registers are not compltible with the PCI spec
and the map sizes are fixed to 128bytes. The pci_mapreg_submap()
function has a code to check the range of the BAR. The
PCI_MAPREG_IO_SIZE() macro returns lower than 128bytes on some
machines. It makes impossible to use pci_mapreg_submap(). Use
pci_conf_read() and bus_space_map() directly.


To generate a diff of this commit:
cvs rdiff -u -r1.14.4.3 -r1.14.4.4 src/sys/arch/x86/pci/ichlpcib.c

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

Modified files:

Index: src/sys/arch/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.14.4.3 src/sys/arch/x86/pci/ichlpcib.c:1.14.4.4
--- src/sys/arch/x86/pci/ichlpcib.c:1.14.4.3	Fri Jan 23 16:24:55 2015
+++ src/sys/arch/x86/pci/ichlpcib.c	Mon Jan 26 13:34:03 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichlpcib.c,v 1.14.4.3 2015/01/23 16:24:55 martin Exp $	*/
+/*	$NetBSD: ichlpcib.c,v 1.14.4.4 2015/01/26 13:34:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.14.4.3 2015/01/23 16:24:55 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.14.4.4 2015/01/26 13:34:03 martin Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -184,6 +184,7 @@ lpcibattach(device_t parent, device_t se
 	struct pci_attach_args *pa = aux;
 	struct lpcib_softc *sc = device_private(self);
 	struct lpcib_device *lpcib_dev;
+	pcireg_t pmbase;
 
 	sc-sc_pa = *pa;
 
@@ -205,11 +206,16 @@ lpcibattach(device_t parent, device_t se
 	 *
 	 * The PMBASE register is alike PCI BAR but not completely compatible
 	 * with it. The PMBASE define the base address and the type but
-	 * not describe the size.
+	 * not describe the size. The value of the register may be lower
+	 * than LPCIB_PCI_PM_SIZE. It makes impossible to use
+	 * pci_mapreg_submap() because the function does range check.
 	 */
-	if (pci_mapreg_submap(pa, LPCIB_PCI_PMBASE, PCI_MAPREG_TYPE_IO, 0,
-		LPCIB_PCI_PM_SIZE, 0, sc-sc_iot, sc-sc_ioh, NULL, NULL)) {
-		aprint_error_dev(self, can't map power management i/o space\n);
+	sc-sc_iot = pa-pa_iot;
+	pmbase = pci_conf_read(pa-pa_pc, pa-pa_tag, LPCIB_PCI_PMBASE);
+	if (bus_space_map(sc-sc_iot, PCI_MAPREG_IO_ADDR(pmbase),
+	LPCIB_PCI_PM_SIZE, 0, sc-sc_ioh) != 0) {
+		aprint_error_dev(self,
+		can't map power management i/o space\n);
 		return;
 	}
 



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

2015-01-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan  7 13:03:42 UTC 2015

Modified Files:
src/sys/arch/arm/arm [netbsd-5]: disassem.c

Log Message:
Pull up following revision(s) (requested by hick in ticket #1939):
sys/arch/arm/arm/disassem.c: revision 1.26
The mode synonyms are different for stm and ldm - handle this.
PR/49520: arm/disassem.c doesn't use proper address mode name for loads


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.10.1 src/sys/arch/arm/arm/disassem.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/disassem.c
diff -u src/sys/arch/arm/arm/disassem.c:1.18 src/sys/arch/arm/arm/disassem.c:1.18.10.1
--- src/sys/arch/arm/arm/disassem.c:1.18	Sun Apr 27 18:58:43 2008
+++ src/sys/arch/arm/arm/disassem.c	Wed Jan  7 13:03:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: disassem.c,v 1.18 2008/04/27 18:58:43 matt Exp $	*/
+/*	$NetBSD: disassem.c,v 1.18.10.1 2015/01/07 13:03:42 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe.
@@ -49,7 +49,7 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(0, $NetBSD: disassem.c,v 1.18 2008/04/27 18:58:43 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: disassem.c,v 1.18.10.1 2015/01/07 13:03:42 msaitoh Exp $);
 
 #include sys/systm.h
 #include arch/arm/arm/disassem.h
@@ -233,7 +233,8 @@ static char const insn_block_transfers[]
 };
 
 static char const insn_stack_block_transfers[][4] = {
-	ed, ea, fd, fa
+	ed, ea, fd, fa,	/* stm */
+	fa, fd, ea, ed,	/* ldm */
 };
 
 static char const op_shifts[][4] = {
@@ -255,7 +256,7 @@ static char const insn_fpaconstants[][8]
 
 #define insn_condition(x)	arm32_insn_conditions[(x  28)  0x0f]
 #define insn_blktrans(x)	insn_block_transfers[(x  23)  3]
-#define insn_stkblktrans(x)	insn_stack_block_transfers[(x  23)  3]
+#define insn_stkblktrans(x)	insn_stack_block_transfers[((x  (20 - 2))  4)|((x  23)  3)]
 #define op2_shift(x)		op_shifts[(x  5)  3]
 #define insn_fparnd(x)		insn_fpa_rounding[(x  5)  0x03]
 #define insn_fpaprec(x)		insn_fpa_precision[(((x  18)  2)|(x  7))  1]



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

2014-05-21 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed May 21 22:05:40 UTC 2014

Modified Files:
src/sys/arch/x86/pci [netbsd-5]: pci_machdep.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1903):
sys/arch/x86/pci/pci_machdep.c: revision 1.61 via patch
sys/arch/x86/pci/pci_machdep.c: revision 1.66 via patch
Force pci_mode 1 when running as Xen HVM domU to allow cd* to be
detected correctly. Fixes kern/48770. Thanks to cube@
Force PCI mode 1 when running under QEMU, to work around QEMU bug 897771.
This should also make it possible to boot NetBSD under versions of KVM
that have inherited said QEMU bug.  Fixes PR kern/45671.


To generate a diff of this commit:
cvs rdiff -u -r1.34.10.1 -r1.34.10.2 src/sys/arch/x86/pci/pci_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/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.34.10.1 src/sys/arch/x86/pci/pci_machdep.c:1.34.10.2
--- src/sys/arch/x86/pci/pci_machdep.c:1.34.10.1	Sat May 19 16:39:24 2012
+++ src/sys/arch/x86/pci/pci_machdep.c	Wed May 21 22:05:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.34.10.2 2014/05/21 22:05:40 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.34.10.2 2014/05/21 22:05:40 bouyer Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -483,6 +483,8 @@ pci_mode_detect(void)
 	uint32_t sav, val;
 	int i;
 	pcireg_t idreg;
+	extern char cpu_brand_string[];
+	const char *system_vendor, *system_product;
 
 	if (pci_mode != -1)
 		return pci_mode;
@@ -513,6 +515,19 @@ pci_mode_detect(void)
 		}
 	}
 
+	system_vendor = pmf_get_platform(system-manufacturer);
+	system_product = pmf_get_platform(system-product-name);
+if (memcmp(cpu_brand_string, QEMU, 4) == 0 ||
+	(system_vendor != NULL  system_product != NULL 
+	 !strcmp(system_vendor, Xen) 
+	 !strcmp(system_product, HVM domU))) {
+		/* PR 45671, https://bugs.launchpad.net/qemu/+bug/897771 */
+#ifdef DEBUG
+		printf(forcing PCI mode 1 for QEMU\n);
+#endif
+		return (pci_mode);
+	}
+
 	/*
 	 * Strong check for standard compliant mode 1:
 	 * 1. bit 31 (enable) can be set



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

2013-12-11 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Dec 11 16:00:46 UTC 2013

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

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1890):
sys/arch/xen/xen/evtchn.c:  revision 1.70

Remove the evtchn_do_event: handler %p didn't lower ipl %d %d\n printf
as analysis shows it actually isn't a bug in the handler, but related to
spin mutexes. Fixes port-xen/46313


To generate a diff of this commit:
cvs rdiff -u -r1.39.4.2 -r1.39.4.3 src/sys/arch/xen/xen/evtchn.c

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

Modified files:

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.39.4.2 src/sys/arch/xen/xen/evtchn.c:1.39.4.3
--- src/sys/arch/xen/xen/evtchn.c:1.39.4.2	Fri Nov 14 02:59:39 2008
+++ src/sys/arch/xen/xen/evtchn.c	Wed Dec 11 16:00:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.39.4.2 2008/11/14 02:59:39 snj Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.39.4.3 2013/12/11 16:00:46 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -64,7 +64,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.39.4.2 2008/11/14 02:59:39 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.39.4.3 2013/12/11 16:00:46 sborrill Exp $);
 
 #include opt_xen.h
 #include isa.h
@@ -301,13 +301,6 @@ splx:
 	ih_fun = (void *)ih-ih_fun;
 	ih_fun(ih-ih_arg, regs);
 	cli();
-	if (ci-ci_ilevel != i) {
-		printf(evtchn_do_event: 
-		handler %p didn't lower 
-		ipl %d %d\n,
-		ih_fun, ci-ci_ilevel, i);
-		ci-ci_ilevel = i;
-	}
 }
 hypervisor_enable_ipl(i);
 /* more pending IPLs may have been registered */



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

2013-10-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Oct 20 14:05:36 UTC 2013

Modified Files:
src/sys/arch/hp700/hp700 [netbsd-5]: autoconf.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1886):
sys/arch/hp700/hp700/autoconf.c: revision 1.51
Remember to unmap pagezero once we've finished with it. Found by gcc 4.8.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.14.1 src/sys/arch/hp700/hp700/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/arch/hp700/hp700/autoconf.c
diff -u src/sys/arch/hp700/hp700/autoconf.c:1.26 src/sys/arch/hp700/hp700/autoconf.c:1.26.14.1
--- src/sys/arch/hp700/hp700/autoconf.c:1.26	Sun Mar 30 12:39:32 2008
+++ src/sys/arch/hp700/hp700/autoconf.c	Sun Oct 20 14:05:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.26 2008/03/30 12:39:32 skrll Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.26.14.1 2013/10/20 14:05:36 bouyer Exp $	*/
 
 /*	$OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $	*/
 
@@ -86,7 +86,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.26 2008/03/30 12:39:32 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.26.14.1 2013/10/20 14:05:36 bouyer Exp $);
 
 #include opt_kgdb.h
 #include opt_useleds.h
@@ -446,6 +446,8 @@ cpu_rootconf(void)
 	}
 	printf(dp_flags 0x%x pz_class 0x%x\n, PAGE0-mem_boot.pz_dp.dp_flags,
 	PAGE0-mem_boot.pz_class);
+
+	hp700_pagezero_unmap(pagezero_cookie);
 #endif /* DEBUG */
 
 	if (boot_device != NULL)



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

2013-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  7 17:23:39 UTC 2013

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c

Log Message:
Pull up following revision(s) (requested by he in ticket #1872):
sys/arch/i386/stand/lib/bootmenu.c: revision 1.11 via patch
sys/arch/i386/stand/lib/bootmenu.h: revision 1.3 via patch
sys/arch/i386/stand/boot/boot2.c: revision 1.59 via patch
Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:
 * Add a menu command which re-displays the menu and initiates
   the timed countdown
 * Use any default command defined in boot.cfg as default args
   if the user runs boot with no arguments
This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply boot netbsd is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.2 -r1.38.4.3 src/sys/arch/i386/stand/boot/boot2.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/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.3
--- src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2	Sun Feb 14 14:01:08 2010
+++ src/sys/arch/i386/stand/boot/boot2.c	Sat Sep  7 17:23:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.38.4.2 2010/02/14 14:01:08 bouyer Exp $	*/
+/*	$NetBSD: boot2.c,v 1.38.4.3 2013/09/07 17:23:39 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -131,9 +131,16 @@ void	command_quit(char *);
 void	command_boot(char *);
 void	command_dev(char *);
 void	command_consdev(char *);
+#ifndef SMALL
+void	command_menu(char *);
+#endif
 void	command_modules(char *);
 void	command_load(char *);
 void	command_multiboot(char *);
+#ifndef SMALL
+void	bootdefault(void);
+void	docommandchoice(int);
+#endif
 
 const struct bootblk_command commands[] = {
 	{ help,	command_help },
@@ -143,6 +150,9 @@ const struct bootblk_command commands[] 
 	{ boot,	command_boot },
 	{ dev,	command_dev },
 	{ consdev,	command_consdev },
+#ifndef SMALL
+	{ menu,	command_menu },
+#endif
 	{ modules,	command_modules },
 	{ load,	command_load },
 	{ multiboot,	command_multiboot },
@@ -508,10 +518,58 @@ static int getchoicefrominput(char *inpu
 }
 
 void
+docommandchoice(int choice)
+{
+	char input[80], *ic, *oc;
+ 
+	ic = bootconf.command[choice];
+	/* Split command string at ; into separate commands */
+	do {
+		oc = input;
+		/* Look for ; separator */
+		for (; *ic  *ic != COMMAND_SEPARATOR; ic++)
+			*oc++ = *ic;
+		if (*input == '\0')
+			continue;
+		/* Strip out any trailing spaces */
+		oc--;
+		for (; *oc == ' '  oc  input; oc--);
+		*++oc = '\0';
+		if (*ic == COMMAND_SEPARATOR)
+			ic++;
+		/* Stop silly command strings like ;;; */
+		if (*input != '\0')
+			docommand(input);
+		/* Skip leading spaces */
+		for (; *ic == ' '; ic++);
+	} while (*ic);
+}
+
+void
+bootdefault(void)
+{
+int choice;
+static int entered;
+ 
+if (bootconf.nummenu  0) {
+if (entered) {
+printf(default boot twice, skipping...\n);
+return;
+}
+entered = 1;
+choice = bootconf.def;
+printf(command(s): %s\n, bootconf.command[choice]);
+docommandchoice(choice);
+}
+}
+
+
+
+void
 doboottypemenu(void)
 {
 	int choice;
-	char input[80], *ic, *oc;
+	char input[80];
 		
 	printf(\n);
 	/* Display menu */
@@ -567,27 +625,7 @@ doboottypemenu(void)
 			printf(type \?\ or \help\ for help.\n);
 			bootmenu(); /* does not return */
 		} else {
-			ic = bootconf.command[choice];
-			/* Split command string at ; into separate commands */
-			do {
-oc = input;
-/* Look for ; separator */
-for (; *ic  *ic != COMMAND_SEPARATOR; ic++)
-	*oc++ = *ic;
-if (*input == '\0')
-	continue;
-/* Strip out any trailing spaces */
-oc--;
-for (; *oc ==' '  oc  input; oc--);
-*++oc = '\0';
-if (*ic == COMMAND_SEPARATOR)
-	ic++;
-/* Stop silly command strings like ;;; */
-if (*input != '\0')
-	docommand(input);
-/* Skip leading spaces */
-for (; *ic == ' '; ic++);
-			} while (*ic);
+			docommandchoice(choice);
 		}
 			
 	}
@@ -707,6 +745,9 @@ command_help(char *arg)
 	   dev xd[N[x]]:\n
 	   consdev {pc|com[0123]|com[0123]kbd|auto}\n
 	   modules {enabled|disabled}\n
+#ifndef SMALL
+	   menu (reenters boot menu, if defined in boot.cfg)\n
+#endif
 	   load {path_to_module}\n
 	   multiboot [xdNx:][filename] [args]\n
 	   help|?\n
@@ -740,10 +781,25 @@ void
 command_boot(char *arg)
 {
 	char *filename;
-	int howto;
+	int howto, tell;
 
-	if (parseboot(arg, filename, howto))
-		

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

2013-06-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Jun 19 07:44:42 UTC 2013

Modified Files:
src/sys/arch/x86/include [netbsd-5]: mtrr.h specialreg.h
src/sys/arch/x86/x86 [netbsd-5]: mtrr_i686.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1847):
sys/arch/x86/include/mtrr.h: revision 1.5
sys/arch/x86/x86/mtrr_i686.c: revision 1.25
sys/arch/x86/include/specialreg.h: revision 1.55
Increase MTRR_I686_NVAR_MAX from 8 to 16. Avoids
FIXME: more than 8 MTRRs (10) message on booting Thinkpad W520 and
similar. While here replace a magic number with MTRR_I686_NVAR_MAX * 2


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/arch/x86/include/mtrr.h
cvs rdiff -u -r1.31.4.2 -r1.31.4.3 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.19.4.1 -r1.19.4.2 src/sys/arch/x86/x86/mtrr_i686.c

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

Modified files:

Index: src/sys/arch/x86/include/mtrr.h
diff -u src/sys/arch/x86/include/mtrr.h:1.4 src/sys/arch/x86/include/mtrr.h:1.4.6.1
--- src/sys/arch/x86/include/mtrr.h:1.4	Tue Jul  1 15:27:34 2008
+++ src/sys/arch/x86/include/mtrr.h	Wed Jun 19 07:44:42 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: mtrr.h,v 1.4 2008/07/01 15:27:34 mrg Exp $ */
+/* $NetBSD: mtrr.h,v 1.4.6.1 2013/06/19 07:44:42 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define MTRR_I686_FIXED_IDX16K	1
 #define MTRR_I686_FIXED_IDX4K	3
 
-#define MTRR_I686_NVAR_MAX	8	/* could be upto 255? */
+#define MTRR_I686_NVAR_MAX	16	/* could be upto 255? */
 
 #define MTRR_I686_64K_START		0x0
 #define MTRR_I686_16K_START		0x8

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.2 src/sys/arch/x86/include/specialreg.h:1.31.4.3
--- src/sys/arch/x86/include/specialreg.h:1.31.4.2	Wed Nov 28 04:39:03 2012
+++ src/sys/arch/x86/include/specialreg.h	Wed Jun 19 07:44:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.2 2012/11/28 04:39:03 riz Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.3 2013/06/19 07:44:42 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -314,6 +314,22 @@
 #define	MSR_MTRRphysMask6	0x20d
 #define	MSR_MTRRphysBase7	0x20e
 #define	MSR_MTRRphysMask7	0x20f
+#define	MSR_MTRRphysBase8	0x210
+#define	MSR_MTRRphysMask8	0x211
+#define	MSR_MTRRphysBase9	0x212
+#define	MSR_MTRRphysMask9	0x213
+#define	MSR_MTRRphysBase10	0x214
+#define	MSR_MTRRphysMask10	0x215
+#define	MSR_MTRRphysBase11	0x216
+#define	MSR_MTRRphysMask11	0x217
+#define	MSR_MTRRphysBase12	0x218
+#define	MSR_MTRRphysMask12	0x219
+#define	MSR_MTRRphysBase13	0x21a
+#define	MSR_MTRRphysMask13	0x21b
+#define	MSR_MTRRphysBase14	0x21c
+#define	MSR_MTRRphysMask14	0x21d
+#define	MSR_MTRRphysBase15	0x21e
+#define	MSR_MTRRphysMask15	0x21f
 #define	MSR_MTRRfix64K_0	0x250
 #define	MSR_MTRRfix16K_8	0x258
 #define	MSR_MTRRfix16K_A	0x259

Index: src/sys/arch/x86/x86/mtrr_i686.c
diff -u src/sys/arch/x86/x86/mtrr_i686.c:1.19.4.1 src/sys/arch/x86/x86/mtrr_i686.c:1.19.4.2
--- src/sys/arch/x86/x86/mtrr_i686.c:1.19.4.1	Wed Feb 16 20:54:13 2011
+++ src/sys/arch/x86/x86/mtrr_i686.c	Wed Jun 19 07:44:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr_i686.c,v 1.19.4.1 2011/02/16 20:54:13 bouyer Exp $ */
+/*	$NetBSD: mtrr_i686.c,v 1.19.4.2 2013/06/19 07:44:42 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mtrr_i686.c,v 1.19.4.1 2011/02/16 20:54:13 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: mtrr_i686.c,v 1.19.4.2 2013/06/19 07:44:42 bouyer Exp $);
 
 #include opt_multiprocessor.h
 
@@ -84,6 +84,22 @@ mtrr_raw[] = {
 	{ MSR_MTRRphysMask6, 0 },
 	{ MSR_MTRRphysBase7, 0 },
 	{ MSR_MTRRphysMask7, 0 },
+	{ MSR_MTRRphysBase8, 0 },
+	{ MSR_MTRRphysMask8, 0 },
+	{ MSR_MTRRphysBase9, 0 },
+	{ MSR_MTRRphysMask9, 0 },
+	{ MSR_MTRRphysBase10, 0 },
+	{ MSR_MTRRphysMask10, 0 },
+	{ MSR_MTRRphysBase11, 0 },
+	{ MSR_MTRRphysMask11, 0 },
+	{ MSR_MTRRphysBase12, 0 },
+	{ MSR_MTRRphysMask12, 0 },
+	{ MSR_MTRRphysBase13, 0 },
+	{ MSR_MTRRphysMask13, 0 },
+	{ MSR_MTRRphysBase14, 0 },
+	{ MSR_MTRRphysMask14, 0 },
+	{ MSR_MTRRphysBase15, 0 },
+	{ MSR_MTRRphysMask15, 0 },
 	{ MSR_MTRRfix64K_0, 0 },
 	{ MSR_MTRRfix16K_8, 0 },
 	{ MSR_MTRRfix16K_A, 0 },
@@ -306,8 +322,8 @@ i686_mtrr_init_first(void)
 		MTRR_I686_NVAR_MAX);
 	else if (i686_mtrr_vcnt  MTRR_I686_NVAR_MAX) {
 		for (i = MTRR_I686_NVAR_MAX - i686_mtrr_vcnt; i; i--) {
-			mtrr_raw[16 - (i*2)].msraddr = 0;
-			mtrr_raw[17 - (i*2)].msraddr = 0;
+			mtrr_raw[(MTRR_I686_NVAR_MAX - i) * 2].msraddr = 0;
+			mtrr_raw[(MTRR_I686_NVAR_MAX - i) * 2 + 1].msraddr = 0;
 		}
 	}
 



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

2013-06-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Jun  9 11:44:04 UTC 2013

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

Log Message:
Apply patch (requested by sborrill in ticket #1858):
sys/arch/amd64/conf/XEN3_DOMU
sys/arch/i386/conf/Attic/XEN2_DOMU
Add wedge support in DOMU kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.3 -r1.13.4.4 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.19.4.3 -r1.19.4.4 src/sys/arch/i386/conf/XEN2_DOMU

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.3 src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.4
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.3	Sun Jan 13 16:46:22 2013
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sun Jun  9 11:44:04 2013
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.13.4.3 2013/01/13 16:46:22 bouyer Exp $
+# $NetBSD: XEN3_DOMU,v 1.13.4.4 2013/06/09 11:44:04 msaitoh Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -68,6 +68,13 @@ options 	COMPAT_LINUX32	# req. COMPAT_LI
 options 	EXEC_ELF32
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+# The following two options can break /etc/fstab, so handle with care
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)

Index: src/sys/arch/i386/conf/XEN2_DOMU
diff -u src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.3 src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.4
--- src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.3	Sun Jan 13 16:46:22 2013
+++ src/sys/arch/i386/conf/XEN2_DOMU	Sun Jun  9 11:44:04 2013
@@ -1,4 +1,4 @@
-# $NetBSD: XEN2_DOMU,v 1.19.4.3 2013/01/13 16:46:22 bouyer Exp $
+# $NetBSD: XEN2_DOMU,v 1.19.4.4 2013/06/09 11:44:04 msaitoh Exp $
 
 include 	arch/xen/conf/std.xen
 
@@ -86,6 +86,13 @@ options 	COMPAT_FREEBSD	# binary compati
 #options 	COMPAT_PECOFF	# kernel support to run Win32 apps
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+# The following two options can break /etc/fstab, so handle with care
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)



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

2013-01-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 20 12:13:28 UTC 2013

Modified Files:
src/sys/arch/arm/arm32 [netbsd-5]: cpu.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1841):
sys/arch/arm/arm32/cpu.c: revision 1.89
S/,/;/


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.4.1 src/sys/arch/arm/arm32/cpu.c

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

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.71 src/sys/arch/arm/arm32/cpu.c:1.71.4.1
--- src/sys/arch/arm/arm32/cpu.c:1.71	Sat Oct 25 18:15:19 2008
+++ src/sys/arch/arm/arm32/cpu.c	Sun Jan 20 12:13:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.71 2008/10/25 18:15:19 matt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.71.4.1 2013/01/20 12:13:28 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include sys/param.h
 
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.71 2008/10/25 18:15:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.71.4.1 2013/01/20 12:13:28 bouyer Exp $);
 
 #include sys/systm.h
 #include sys/malloc.h
@@ -486,7 +486,7 @@ identify_arm_cpu(struct device *dv, stru
 		if (cpuids[i].cpuid == (cpuid  CPU_ID_CPU_MASK)) {
 			cpu_class = cpuids[i].cpu_class;
 			steppingstr = cpuids[i].cpu_steppings[cpuid 
-			CPU_ID_REVISION_MASK],
+			CPU_ID_REVISION_MASK];
 			sprintf(cpu_model, %s%s%s (%s core),
 			cpuids[i].cpu_name,
 			steppingstr[0] == '*' ?  :  ,



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

2013-01-13 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 13 16:46:23 UTC 2013

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

Log Message:
apply patch(s) (requested by sborrill in ticket #1834):
sys/arch/i386/conf/XEN2_DOMU: patch
sys/arch/amd64/conf/XEN3_DOMU: patch
Add drvctl to Xen DOMU kernels


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.2 -r1.13.4.3 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.19.4.2 -r1.19.4.3 src/sys/arch/i386/conf/XEN2_DOMU

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.2 src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.3
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.2	Mon Feb 15 18:04:11 2010
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sun Jan 13 16:46:22 2013
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.13.4.2 2010/02/15 18:04:11 sborrill Exp $
+# $NetBSD: XEN3_DOMU,v 1.13.4.3 2013/01/13 16:46:22 bouyer Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -223,3 +223,6 @@ pseudo-device	vcoda		4	# coda minicache 
 
 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester
+
+# userland interface to drivers, including autoconf and properties retrieval
+pseudo-device   drvctl

Index: src/sys/arch/i386/conf/XEN2_DOMU
diff -u src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.2 src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.3
--- src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.2	Mon Feb 15 18:04:11 2010
+++ src/sys/arch/i386/conf/XEN2_DOMU	Sun Jan 13 16:46:22 2013
@@ -1,4 +1,4 @@
-# $NetBSD: XEN2_DOMU,v 1.19.4.2 2010/02/15 18:04:11 sborrill Exp $
+# $NetBSD: XEN2_DOMU,v 1.19.4.3 2013/01/13 16:46:22 bouyer Exp $
 
 include 	arch/xen/conf/std.xen
 
@@ -237,3 +237,6 @@ pseudo-device	vcoda		4	# coda minicache 
 
 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester
+
+# userland interface to drivers, including autoconf and properties retrieval
+pseudo-device   drvctl



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

2012-11-27 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov 28 04:39:03 UTC 2012

Modified Files:
src/sys/arch/x86/include [netbsd-5]: specialreg.h

Log Message:
Pull up following revision(s) (requested by christos in ticket #1819):
sys/arch/x86/include/specialreg.h: revision 1.58
Add VIA Eden FCR MSR.


To generate a diff of this commit:
cvs rdiff -u -r1.31.4.1 -r1.31.4.2 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.31.4.1 src/sys/arch/x86/include/specialreg.h:1.31.4.2
--- src/sys/arch/x86/include/specialreg.h:1.31.4.1	Tue Jun 16 02:23:31 2009
+++ src/sys/arch/x86/include/specialreg.h	Wed Nov 28 04:39:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.31.4.1 2009/06/16 02:23:31 snj Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.31.4.2 2012/11/28 04:39:03 riz Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -360,6 +360,11 @@
 #define MSR_VIA_ACE_ENABLE	0x1000
 
 /*
+ * VIA Eden MSRs
+ */
+#define MSR_VIA_FCR 		MSR_VIA_ACE
+
+/*
  * AMD K6/K7 MSRs.
  */
 #define	MSR_K6_UWCCR		0xc085



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

2012-11-26 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Nov 26 19:44:27 UTC 2012

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: identcpu.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1819):
sys/arch/x86/x86/identcpu.c: revision 1.31
PR/41267: Andrius V: 5.0 RC4 does not detect second CPU in VIA. VIA Eden cpuid
lies about it's ability to do cmpxchg8b. Turn the feature on using the FCR MSR.
Needs pullup to both 5 and 6.


To generate a diff of this commit:
cvs rdiff -u -r1.10.4.6 -r1.10.4.7 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.10.4.6 src/sys/arch/x86/x86/identcpu.c:1.10.4.7
--- src/sys/arch/x86/x86/identcpu.c:1.10.4.6	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/x86/x86/identcpu.c	Mon Nov 26 19:44:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.10.4.6 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.10.4.7 2012/11/26 19:44:26 riz Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.10.4.6 2010/04/22 20:02:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.10.4.7 2012/11/26 19:44:26 riz Exp $);
 
 #include opt_enhanced_speedstep.h
 #include opt_intel_odcm.h
@@ -387,13 +387,31 @@ static void
 cpu_probe_winchip(struct cpu_info *ci)
 {
 
-	if (cpu_vendor != CPUVENDOR_IDT ||
-	CPUID2FAMILY(ci-ci_signature) != 5)
+	if (cpu_vendor != CPUVENDOR_IDT)
 		return;
 
-	if (CPUID2MODEL(ci-ci_signature) == 4) {
-		/* WinChip C6 */
-		ci-ci_feature_flags = ~CPUID_TSC;
+	switch (CPUID2FAMILY(ci-ci_signature)) {
+	case 5:
+ 		/* WinChip C6 */
+		if (CPUID2MODEL(ci-ci_signature) == 4)
+			ci-ci_feature_flags = ~CPUID_TSC;
+		break;
+	case 6:
+		/*
+		 * VIA Eden ESP 
+		 *
+		 * Quoting from page 3-4 of: VIA Eden ESP Processor Datasheet
+		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
+		 * 
+		 * 1. The CMPXCHG8B instruction is provided and always enabled,
+		 *however, it appears disabled in the corresponding CPUID
+		 *function bit 0 to avoid a bug in an early version of
+		 *Windows NT. However, this default can be changed via a
+		 *bit in the FCR MSR.
+		 */
+		ci-ci_feature_flags |= CPUID_CX8;
+		wrmsr(MSR_VIA_FCR, rdmsr(MSR_VIA_FCR) | 0x0001);
+		break;
 	}
 }
 



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

2012-11-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Nov  6 20:10:49 UTC 2012

Modified Files:
src/sys/arch/macppc/dev [netbsd-5]: awacs.c

Log Message:
Pull up following revision(s) (requested by phx in ticket #1816):
sys/arch/macppc/dev/awacs.c: revision 1.43
My PowerMac3,1 is using gpio4 to detect a connected headphone, and I would bet
that the same is true for PowerMac3,2.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/macppc/dev/awacs.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/macppc/dev/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.35 src/sys/arch/macppc/dev/awacs.c:1.35.4.1
--- src/sys/arch/macppc/dev/awacs.c:1.35	Wed Aug 27 14:31:46 2008
+++ src/sys/arch/macppc/dev/awacs.c	Tue Nov  6 20:10:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.35 2008/08/27 14:31:46 jmcneill Exp $	*/
+/*	$NetBSD: awacs.c,v 1.35.4.1 2012/11/06 20:10:49 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awacs.c,v 1.35 2008/08/27 14:31:46 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awacs.c,v 1.35.4.1 2012/11/06 20:10:49 riz Exp $);
 
 #include sys/param.h
 #include sys/audioio.h
@@ -281,7 +281,9 @@ static const char *detect_reversed[] = {
 	AAPL,3500,
 	NULL};
 
-static const char *use_gpio4[] = {	PowerMac3,3,
+static const char *use_gpio4[] = {	PowerMac3,1,
+	PowerMac3,2,
+	PowerMac3,3,
 	NULL};
 
 /*



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

2012-10-31 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 31 15:34:58 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: locore.S

Log Message:
Pull up following revision(s) (requested by chs in ticket #1810):
sys/arch/i386/i386/locore.S: revision 1.103
in osyscall, set the PSL_I bit into the correct field of the trapframe.
it was going into tf_eip instead of tf_eflags, which would sometimes
corrupt %eip and always return to user mode with interrupts disabled.
this was found with a netbsd 1.0 binary, and dsl@ points out that
this should also fix PR 41342.


To generate a diff of this commit:
cvs rdiff -u -r1.78.4.3 -r1.78.4.4 src/sys/arch/i386/i386/locore.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/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.78.4.3 src/sys/arch/i386/i386/locore.S:1.78.4.4
--- src/sys/arch/i386/i386/locore.S:1.78.4.3	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/locore.S	Wed Oct 31 15:34:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.78.4.3 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: locore.S,v 1.78.4.4 2012/10/31 15:34:58 riz Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -134,7 +134,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.78.4.3 2009/04/04 17:39:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.78.4.4 2012/10/31 15:34:58 riz Exp $);
 
 #include opt_compat_oldboot.h
 #include opt_ddb.h
@@ -1081,7 +1081,7 @@ IDTVEC(osyscall)
 	cli			# must be first instruction
 	pushfl			# set eflags in trap frame
 	popl	8(%esp)
-	orl	$PSL_I,(%esp)	# re-enable ints on return to user
+	orl	$PSL_I,8(%esp)	# re-enable ints on return to user
 	pushl	$7		# size of instruction for restart
 	jmp	syscall1
 IDTVEC_END(osyscall)



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

2012-10-26 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Oct 26 11:31:50 UTC 2012

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

Log Message:
Pull up the following revisions(s) (requested by royger in ticket #1805):
sys/arch/xen/xen/xengnt.c:  revision 1.25 via patch

Prevents a memory corruption issue that freezes a Xen DomU and can also
cause fs corruption. Addresses PR port-xen/47057 and port-xen/47056


To generate a diff of this commit:
cvs rdiff -u -r1.10.4.1 -r1.10.4.2 src/sys/arch/xen/xen/xengnt.c

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

Modified files:

Index: src/sys/arch/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.10.4.1 src/sys/arch/xen/xen/xengnt.c:1.10.4.2
--- src/sys/arch/xen/xen/xengnt.c:1.10.4.1	Sat Jan 30 19:14:20 2010
+++ src/sys/arch/xen/xen/xengnt.c	Fri Oct 26 11:31:50 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: xengnt.c,v 1.10.4.1 2010/01/30 19:14:20 snj Exp $  */
+/*  $NetBSD: xengnt.c,v 1.10.4.2 2012/10/26 11:31:50 sborrill Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xengnt.c,v 1.10.4.1 2010/01/30 19:14:20 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xengnt.c,v 1.10.4.2 2012/10/26 11:31:50 sborrill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -55,6 +55,9 @@ __KERNEL_RCSID(0, $NetBSD: xengnt.c,v 1
 
 #define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_t))
 
+/* External tools reserve first few grant table entries. */
+#define NR_RESERVED_ENTRIES 8
+
 int gnt_nr_grant_frames;
 int gnt_max_grant_frames;
 
@@ -127,7 +130,7 @@ xengnt_more_entries()
 	gnttab_setup_table_t setup;
 	u_long *pages;
 	int nframes_new = gnt_nr_grant_frames + 1;
-	int i;
+	int i, start_gnt;
 
 	if (gnt_nr_grant_frames == gnt_max_grant_frames)
 		return ENOMEM;
@@ -167,9 +170,14 @@ xengnt_more_entries()
 
 	/*
 	 * add the grant entries associated to the last grant table frame
-	 * and mark them as free
+	 * and mark them as free. Prevent using the first grants (from 0 to 8)
+	 * since they are used by the tools.
 	 */
-	for (i = gnt_nr_grant_frames * NR_GRANT_ENTRIES_PER_PAGE;
+	start_gnt = (gnt_nr_grant_frames * NR_GRANT_ENTRIES_PER_PAGE) 
+	(NR_RESERVED_ENTRIES + 1) ?
+	(NR_RESERVED_ENTRIES + 1) :
+	(gnt_nr_grant_frames * NR_GRANT_ENTRIES_PER_PAGE);
+	for (i = start_gnt;
 	i  nframes_new * NR_GRANT_ENTRIES_PER_PAGE;
 	i++) {
 		KASSERT(gnt_entries[last_gnt_entry] == XENGNT_NO_ENTRY);
@@ -206,7 +214,7 @@ xengnt_get_entry()
 	entry = gnt_entries[last_gnt_entry];
 	gnt_entries[last_gnt_entry] = XENGNT_NO_ENTRY;
 	splx(s);
-	KASSERT(entry != XENGNT_NO_ENTRY);
+	KASSERT(entry != XENGNT_NO_ENTRY  entry  NR_RESERVED_ENTRIES);
 	KASSERT(last_gnt_entry = 0  last_gnt_entry = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE);
 	return entry;
 }
@@ -218,6 +226,7 @@ static void
 xengnt_free_entry(grant_ref_t entry)
 {
 	int s = splvm();
+	KASSERT(entry  NR_RESERVED_ENTRIES);
 	KASSERT(gnt_entries[last_gnt_entry] == XENGNT_NO_ENTRY);
 	KASSERT(last_gnt_entry = 0  last_gnt_entry = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE);
 	gnt_entries[last_gnt_entry] = entry;



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

2012-08-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Aug 22 20:59:47 UTC 2012

Modified Files:
src/sys/arch/vax/include [netbsd-5]: cpu.h

Log Message:
Pull up following revision(s) (requested by abs in ticket #1780):
sys/arch/vax/include/cpu.h: revision 1.94 via patch
Change cpu_idle to be an inline which sets IPL to 1 and then back to 0
so simh can recognize the kernel is idle.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.14.1 src/sys/arch/vax/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/vax/include/cpu.h
diff -u src/sys/arch/vax/include/cpu.h:1.85 src/sys/arch/vax/include/cpu.h:1.85.14.1
--- src/sys/arch/vax/include/cpu.h:1.85	Tue Mar 11 05:34:02 2008
+++ src/sys/arch/vax/include/cpu.h	Wed Aug 22 20:59:47 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: cpu.h,v 1.85 2008/03/11 05:34:02 matt Exp $  */
+/*  $NetBSD: cpu.h,v 1.85.14.1 2012/08/22 20:59:47 bouyer Exp $  */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -165,7 +165,18 @@ extern int cpu_printfataltraps;
 #define	cpu_proc_fork(x, y)	do { } while (/*CONSCOND*/0)
 #define	cpu_lwp_free(l, f)	do { } while (/*CONSCOND*/0)
 #define	cpu_lwp_free2(l)	do { } while (/*CONSCOND*/0)
-#define	cpu_idle()		do { } while (/*CONSCOND*/0)
+
+/*
+ * This allows SIMH to recognize the kernel wants to sleep.
+ */
+static inline void
+cpu_idle(void)
+{
+	int ipl = mfpr(PR_IPL);
+	mtpr(1, PR_IPL);
+	mtpr(ipl, PR_IPL);
+}
+
 static inline bool
 cpu_intr_p(void)
 {



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

2012-08-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Aug 22 21:18:20 UTC 2012

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: intel_busclock.c

Log Message:
sys/arch/x86/x86/intel_busclock.c   patch

Add support for Xeon E5
[sborrill, ticket #1787]


To generate a diff of this commit:
cvs rdiff -u -r1.5.10.4 -r1.5.10.5 src/sys/arch/x86/x86/intel_busclock.c

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

Modified files:

Index: src/sys/arch/x86/x86/intel_busclock.c
diff -u src/sys/arch/x86/x86/intel_busclock.c:1.5.10.4 src/sys/arch/x86/x86/intel_busclock.c:1.5.10.5
--- src/sys/arch/x86/x86/intel_busclock.c:1.5.10.4	Tue Aug 31 10:50:22 2010
+++ src/sys/arch/x86/x86/intel_busclock.c	Wed Aug 22 21:18:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $	*/
+/*	$NetBSD: intel_busclock.c,v 1.5.10.5 2012/08/22 21:18:19 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.5 2012/08/22 21:18:19 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -98,7 +98,7 @@ p3_get_bus_clock(struct cpu_info *ci)
 		break;
 	case 0xc: /* Core i7, Atom, model 1 */
 		/*
-		 * XXX (See also case 0xe)
+		 * XXX (See also case 0xe and 0xd)
 		 * Some core i7 CPUs can report model 0xc.
 		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
 		 * In the long-term, use ACPI instead of all this.
@@ -121,7 +121,19 @@ p3_get_bus_clock(struct cpu_info *ci)
 			goto print_msr;
 		}
 		break;
-	case 0xd: /* Pentium M (90 nm, Dothan) */
+	case 0xd: /* Pentium M (90 nm, Dothan), some Xeons */
+		/*
+		 * XXX (See also case 0xc and 0xd)
+		 * Some Xeons can report model 0xd, e.g. E5-2630
+		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
+		 * In the long-term, use ACPI instead of all this.
+		 */
+		switch (CPUID2EXTMODEL(ci-ci_signature)) {
+		case 0x2:
+			aprint_debug(%s: unable to determine bus speed,
+			device_xname(ci-ci_dev));
+			goto print_msr;
+		}
 		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {



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

2012-06-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jun 15 09:20:00 UTC 2012

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

Log Message:
Fix build fallout from ticket #1772 for Xen kernels


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.3 -r1.52.4.4 src/sys/arch/amd64/amd64/trap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52.4.3 src/sys/arch/amd64/amd64/trap.c:1.52.4.4
--- src/sys/arch/amd64/amd64/trap.c:1.52.4.3	Tue Jun 12 20:43:47 2012
+++ src/sys/arch/amd64/amd64/trap.c	Fri Jun 15 09:20:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.4.4 2012/06/15 09:20:00 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.4.4 2012/06/15 09:20:00 bouyer Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -183,7 +183,9 @@ trap(struct trapframe *frame)
 #if defined(COMPAT_10) || defined(COMPAT_IBCS2)
 	extern char IDTVEC(oosyscall)[];
 #endif
+#ifndef XEN
 	struct trapframe *vframe;
+#endif
 	void *onfault;
 	int error;
 	uint64_t cr2;



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

2012-06-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jun 12 20:43:48 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: trap.c vector.S
src/sys/arch/amd64/include [netbsd-5]: frameasm.h

Log Message:
Pull up following revision(s) (requested by spz in ticket #1772):
sys/arch/amd64/amd64/trap.c: revision 1.71 via patch
sys/arch/amd64/amd64/vector.S: revision 1.41 via patch
sys/arch/amd64/include/frameasm.h: patch

Treat traps in kernel mode during the 'return to user' iret sequence
as user faults.
Based heavily in the i386 code with the correct opcode bytes inserted.
iret path tested, arranging for segment register errors is harder.
User %fs and %gs (32bit apps) are loaded much earlier and any errors
will generate kernel panics - there is probably code to try to stop
the invalid values being set.
If we get a fault setting the user %gs, or on a iret that is returning
to userspace, we must do a 'swapgs' to reload the kernel %gs_base.
Also save the %ds, %es, %fs, %gs selector values in the frame so
they can be restored if we finally return to user (probably after
an application SIGSEGV handler has fixed the error).
Without this any such fault leaves the kernel running with the wrong
%gs offset and it will most likely fault again early in trap().
Repeats until the stack tramples on something important.
iret change works, invalid %gs is a little harder to arrange.


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.2 -r1.52.4.3 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.28.6.1 -r1.28.6.2 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.12 -r1.12.12.1 src/sys/arch/amd64/include/frameasm.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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52.4.2 src/sys/arch/amd64/amd64/trap.c:1.52.4.3
--- src/sys/arch/amd64/amd64/trap.c:1.52.4.2	Fri Aug 14 21:25:34 2009
+++ src/sys/arch/amd64/amd64/trap.c	Tue Jun 12 20:43:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52.4.2 2009/08/14 21:25:34 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.4.2 2009/08/14 21:25:34 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -124,6 +124,7 @@ __KERNEL_RCSID(0, $NetBSD: trap.c,v 1.5
 #endif
 
 void trap(struct trapframe *);
+void trap_return_fault_return(struct trapframe *) __dead;
 
 const char *trap_type[] = {
 	privileged instruction fault,		/*  0 T_PRIVINFLT */
@@ -178,16 +179,11 @@ trap(struct trapframe *frame)
 	struct proc *p;
 	int type = (int)frame-tf_trapno;
 	struct pcb *pcb;
-	extern char fusuintrfailure[], kcopy_fault[],
-		resume_iret[];
+	extern char fusuintrfailure[], kcopy_fault[];
 #if defined(COMPAT_10) || defined(COMPAT_IBCS2)
 	extern char IDTVEC(oosyscall)[];
 #endif
-#if 0
-	extern char resume_pop_ds[], resume_pop_es[];
-#endif
 	struct trapframe *vframe;
-	void *resume;
 	void *onfault;
 	int error;
 	uint64_t cr2;
@@ -274,50 +270,78 @@ copyfault:
 
 		/*
 		 * Check for failure during return to user mode.
+		 * This can happen loading invalid values into the segment
+		 * registers, or during the 'iret' itself.
 		 *
-		 * XXXfvdl check for rex prefix?
-		 *
-		 * We do this by looking at the instruction we faulted on.  The
-		 * specific instructions we recognize only happen when
+		 * We do this by looking at the instruction we faulted on.
+		 * The specific instructions we recognize only happen when
 		 * returning from a trap, syscall, or interrupt.
-		 *
-		 * XXX
-		 * The heuristic used here will currently fail for the case of
-		 * one of the 2 pop instructions faulting when returning from a
-		 * a fast interrupt.  This should not be possible.  It can be
-		 * fixed by rearranging the trap frame so that the stack format
-		 * at this point is the same as on exit from a `slow'
-		 * interrupt.
 		 */
-		switch (*(u_char *)frame-tf_rip) {
-		case 0xcf:	/* iret */
-			vframe = (void *)((uint64_t)frame-tf_rsp - 44);
-			resume = resume_iret;
-			break;
-/*
- * XXXfvdl these are illegal in long mode (not in compat mode, though)
- * and we do not take back the descriptors from the signal context anyway,
- * but may do so later for USER_LDT, in which case we need to intercept
- * other instructions (movl %eax, %Xs).
- */
-#if 0
-		case 0x1f:	/* popl %ds */
-			vframe = (void *)((uint64_t)frame-tf_rsp - 4);
-			resume = resume_pop_ds;
-			break;
-		case 0x07:	/* popl %es */
-			vframe = (void *)((uint64_t)frame-tf_rsp - 0);
-			resume = resume_pop_es;
+
+kernelfault:
+#ifdef XEN
+		/*
+		 * XXX: there has to be an equivalent 'problem'
+		 * but I (dsl) don't know exactly what happens!
+		 * For now panic the kernel.
+		

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

2012-06-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jun 12 20:48:58 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1768):
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.36
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.37
Sort vif and vbd device IDs numerically so that attach order does not depend
on the order they are passed in through xenstore. While this works for
hand-crafted Xen configuration files, it does not work for XenServer, XCP or
EC2 instances. This means that adding an extra virtual disk can make the
domU unbootable.
ID is actually based on the Linux device major/minor so this approach isn't
entirely correct (for instance, you can specify devices to be non-contiguous
which doesn't fit too well with our autoconf approach), but it works as a
first approximation.
Tested by me on XenServer and riz@ on EC2. OK bouyer@
Fix problem where devices with ID 0 were skipped as invalid as it didn't
distinguish between numerical zero and invalid numeric string.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.4 -r1.26.2.5 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.4 src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.5
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.4	Fri Sep 23 12:44:52 2011
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Jun 12 20:48:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.26.2.4 2011/09/23 12:44:52 sborrill Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.26.2.5 2012/06/12 20:48:58 riz Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.4 2011/09/23 12:44:52 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.5 2012/06/12 20:48:58 riz Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -269,7 +269,8 @@ static int
 xenbus_probe_device_type(const char *path, const char *type,
 int (*create)(struct xenbus_device *))
 {
-	int err, i, msize;
+	int err, i, pos, msize;
+	int *lookup = NULL;
 	unsigned long state;
 	char **dir;
 	unsigned int dir_n = 0;
@@ -283,8 +284,62 @@ xenbus_probe_device_type(const char *pat
 	if (err)
 		return err;
 
-	for (i = 0; i  dir_n; i++) {
+	/* Only sort frontend devices i.e. create == NULL*/
+	if (dir_n  1  create == NULL) {
+		int minp;
+		unsigned long minv;
+		unsigned long *id;
+
+		lookup = malloc(sizeof(int) * dir_n, M_DEVBUF,
+		M_WAITOK | M_ZERO);
+		if (lookup == NULL)
+			panic(can't malloc lookup);
+
+		id = malloc(sizeof(unsigned long) * dir_n, M_DEVBUF,
+		M_WAITOK | M_ZERO);
+		if (id == NULL)
+			panic(can't malloc id);
+
+		/* Convert string values to numeric; skip invalid */
+		for (i = 0; i  dir_n; i++) {
+			/*
+			 * Add one to differentiate numerical zero from invalid
+			 * string. Has no effect on sort order.
+			 */
+			id[i] = strtoul(dir[i], ep, 10) + 1;
+			if (dir[i][0] == '\0' || *ep != '\0')
+id[i] = 0;
+		}
+		
+		/* Build lookup table in ascending order */
+		for (pos = 0; pos  dir_n; ) {
+			minv = UINT32_MAX;
+			minp = -1;
+			for (i = 0; i  dir_n; i++) {
+if (id[i]  minv  id[i]  0) {
+	minv = id[i];
+	minp = i;
+}
+			}
+			if (minp = 0) {
+lookup[pos++] = minp;
+id[minp] = 0;
+			}
+			else
+break;
+		}
+		
+		free(id, M_DEVBUF);
+		/* Adjust in case we had to skip non-numeric entries */
+		dir_n = pos;
+	}
+
+	for (pos = 0; pos  dir_n; pos++) {
 		err = 0;
+		if (lookup)
+			i = lookup[pos];
+		else
+			i = pos;
 		/*
 		 * add size of path to size of xenbus_device. xenbus_device
 		 * already has room for one char in xbusd_path.
@@ -361,6 +416,9 @@ xenbus_probe_device_type(const char *pat
 		talk_to_otherend(xbusd);
 	}
 	free(dir, M_DEVBUF);
+	if (lookup)
+		free(lookup, M_DEVBUF);
+	
 	return err;
 }
 



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

2012-06-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jun 12 23:18:13 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by spz in ticket #1773):
sys/arch/amd64/amd64/machdep.c: revision 1.184
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.77
If the user process provided a bogus signal handler address, kill it
now instead of trying to jump to the bogus address.


To generate a diff of this commit:
cvs rdiff -u -r1.102.4.13 -r1.102.4.14 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.55.4.3 -r1.55.4.4 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.102.4.13 src/sys/arch/amd64/amd64/machdep.c:1.102.4.14
--- src/sys/arch/amd64/amd64/machdep.c:1.102.4.13	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/amd64/amd64/machdep.c	Tue Jun 12 23:18:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.102.4.13 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.102.4.14 2012/06/12 23:18:13 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -112,7 +112,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.13 2010/04/22 20:02:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.14 2012/06/12 23:18:13 riz Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -634,6 +634,16 @@ sendsig(const ksiginfo_t *ksi, const sig
 	/* Remember that we're now on the signal stack. */
 	if (onstack)
 		l-l_sigstk.ss_flags |= SS_ONSTACK;
+
+	if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS) {
+		/* 
+		 * process has given an invalid address for the
+		 * handler. Stop it, but do not do it before so
+		 * we can return the right info to userland (or in core dump)
+		 */
+		sigexit(l, SIGILL);
+		/* NOTREACHED */
+	}
 }
 
 void 

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.3 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.4
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.3	Tue Sep  7 19:38:20 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Tue Jun 12 23:18:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.4 2012/06/12 23:18:13 riz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.4 2012/06/12 23:18:13 riz Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_coredump.h
@@ -278,6 +278,16 @@ netbsd32_sendsig_sigcontext(const ksigin
 	/* Remember that we're now on the signal stack. */
 	if (onstack)
 		l-l_sigstk.ss_flags |= SS_ONSTACK;
+
+	if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS32) {
+		/*
+		 * process has given an invalid address for the
+		 * handler. Stop it, but do not do it before so
+		 * we can return the right info to userland (or in core dump)
+		 */
+		sigexit(l, SIGILL);
+		/* NOTREACHED */
+	}
 }
 #endif
 
@@ -366,6 +376,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	/* Remember that we're now on the signal stack. */
 	if (onstack)
 		l-l_sigstk.ss_flags |= SS_ONSTACK;
+
+	if ((vaddr_t)catcher = VM_MAXUSER_ADDRESS32) {
+		/*
+		 * process has given an invalid address for the
+		 * handler. Stop it, but do not do it before so
+		 * we can return the right info to userland (or in core dump)
+		 */
+		sigexit(l, SIGILL);
+		/* NOTREACHED */
+	}
 }
 
 void



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

2012-06-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jun  3 08:46:36 UTC 2012

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

Log Message:
Pull up revision 1.34 (requested by isaki in ticket #1765).

With the freerunnnig mode, set 0 (=256count) not 0xff (=255count)
in Timer-D.  It fixes the clock ticked faster when timecounter uses
mfp (as default choice).  It was introduced in rev 1.24 in 2006.
Thanks tsutsui@ for many comments.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.6.1 src/sys/arch/x68k/x68k/clock.c

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

Modified files:

Index: src/sys/arch/x68k/x68k/clock.c
diff -u src/sys/arch/x68k/x68k/clock.c:1.28 src/sys/arch/x68k/x68k/clock.c:1.28.6.1
--- src/sys/arch/x68k/x68k/clock.c:1.28	Wed Jun 25 08:14:59 2008
+++ src/sys/arch/x68k/x68k/clock.c	Sun Jun  3 08:46:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.28 2008/06/25 08:14:59 isaki Exp $	*/
+/*	$NetBSD: clock.c,v 1.28.6.1 2012/06/03 08:46:36 jdc Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.28 2008/06/25 08:14:59 isaki Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.28.6.1 2012/06/03 08:46:36 jdc Exp $);
 
 #include clock.h
 
@@ -182,7 +182,7 @@ cpu_initclocks(void)
 	mfp_set_tcdr(CLOCKS_PER_SEC / hz);
 	mfp_bit_set_ierb(MFP_INTR_TIMER_C);
 
-	mfp_set_tddr(0xff);	/* maximum free run -- only 8 bits wide */
+	mfp_set_tddr(0);	/* maximum free run -- only 8 bits wide */
 	mfp_set_tcdcr(mfp_get_tcdcr() | 0x07);	/* 1/200 prescaler */
 
 	tc_init(tc);



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

2012-05-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat May 19 16:37:14 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by jym in ticket #1754):
sys/arch/amd64/amd64/db_memrw.c: revision 1.10
sys/arch/amd64/amd64/db_memrw.c: revision 1.11
sys/arch/i386/i386/db_memrw.c: revision 1.29
Use the current destination address to compute PTE, not the address of
origin.
Harmless, except when db_write_text() passes a page boundary.
 From Bug Hunting.
XXX has to be pulled up to -5 and -6.
invlpg on a non canonical address is a noop, so no chance to invalidate
the TLB and the CPU will not notice the access right change.
This results in write protection faults in supervisor mode when patching
kernel code through ddb(4) (originally mapped as read only).
Bug reported by David Laight on port-amd64@ (thanks!), patch and test by
me.
i386 is unaffected as PG_LGFRAME does not mask the sign bits. For the
sake of correctness, use VA_SIGN_NEG(...) anyway.
XXX this is the patch that will be pulled-up to -5 and -6.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/arch/amd64/amd64/db_memrw.c
cvs rdiff -u -r1.24.10.1 -r1.24.10.2 src/sys/arch/i386/i386/db_memrw.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/db_memrw.c
diff -u src/sys/arch/amd64/amd64/db_memrw.c:1.6 src/sys/arch/amd64/amd64/db_memrw.c:1.6.10.1
--- src/sys/arch/amd64/amd64/db_memrw.c:1.6	Mon Apr 28 20:23:12 2008
+++ src/sys/arch/amd64/amd64/db_memrw.c	Sat May 19 16:37:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_memrw.c,v 1.6 2008/04/28 20:23:12 martin Exp $	*/
+/*	$NetBSD: db_memrw.c,v 1.6.10.1 2012/05/19 16:37:14 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_memrw.c,v 1.6 2008/04/28 20:23:12 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_memrw.c,v 1.6.10.1 2012/05/19 16:37:14 riz Exp $);
 
 #include opt_xen.h
 
@@ -115,7 +115,7 @@ db_write_text(vaddr_t addr, size_t size,
 		/*
 		 * Get the PTE for the page.
 		 */
-		pte = kvtopte(addr);
+		pte = kvtopte((vaddr_t)dst);
 		oldpte = *pte;
 
 		if ((oldpte  PG_V) == 0) {
@@ -127,7 +127,7 @@ db_write_text(vaddr_t addr, size_t size,
 		 * Get the VA for the page.
 		 */
 		if (oldpte  PG_PS)
-			pgva = (vaddr_t)dst  PG_LGFRAME;
+			pgva = VA_SIGN_NEG((vaddr_t)dst  PG_LGFRAME);
 		else
 			pgva = x86_trunc_page(dst);
 

Index: src/sys/arch/i386/i386/db_memrw.c
diff -u src/sys/arch/i386/i386/db_memrw.c:1.24.10.1 src/sys/arch/i386/i386/db_memrw.c:1.24.10.2
--- src/sys/arch/i386/i386/db_memrw.c:1.24.10.1	Wed Sep 30 00:08:03 2009
+++ src/sys/arch/i386/i386/db_memrw.c	Sat May 19 16:37:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_memrw.c,v 1.24.10.1 2009/09/30 00:08:03 snj Exp $	*/
+/*	$NetBSD: db_memrw.c,v 1.24.10.2 2012/05/19 16:37:14 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_memrw.c,v 1.24.10.1 2009/09/30 00:08:03 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_memrw.c,v 1.24.10.2 2012/05/19 16:37:14 riz Exp $);
 
 #include opt_xen.h
 
@@ -111,7 +111,7 @@ db_write_text(vaddr_t addr, size_t size,
 		/*
 		 * Get the PTE for the page.
 		 */
-		pte = kvtopte(addr);
+		pte = kvtopte((vaddr_t)dst);
 		oldpte = *pte;
 
 		if ((oldpte  PG_V) == 0) {



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

2012-05-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat May 19 16:39:24 UTC 2012

Modified Files:
src/sys/arch/x86/pci [netbsd-5]: pci_machdep.c

Log Message:
Pull up following revision(s) (requested by gendalia in ticket #1755):
sys/arch/x86/pci/pci_machdep.c: revision 1.36
add SIS 740 to the list of chipsets known to implement PCI configuration
mode 1 incorrectly, from Jason White
(see thread ACPI issue with old Shuttle system on port-i386)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.10.1 src/sys/arch/x86/pci/pci_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/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.34 src/sys/arch/x86/pci/pci_machdep.c:1.34.10.1
--- src/sys/arch/x86/pci/pci_machdep.c:1.34	Mon Apr 28 20:23:40 2008
+++ src/sys/arch/x86/pci/pci_machdep.c	Sat May 19 16:39:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.34 2008/04/28 20:23:40 martin Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.34 2008/04/28 20:23:40 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.34.10.1 2012/05/19 16:39:24 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -168,6 +168,8 @@ struct {
 	/* Parallels Desktop for Mac */
 	_qe(0, 2, 0, PCI_VENDOR_PARALLELS, PCI_PRODUCT_PARALLELS_VIDEO),
 	_qe(0, 3, 0, PCI_VENDOR_PARALLELS, PCI_PRODUCT_PARALLELS_TOOLS),
+	/* SIS 740 */
+	_qe(0, 0, 0, PCI_VENDOR_SIS, PCI_PRODUCT_SIS_740),
 	/* SIS 741 */
 	_qe(0, 0, 0, PCI_VENDOR_SIS, PCI_PRODUCT_SIS_741),
 	{0, 0x} /* patchable */



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

2012-05-08 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue May  8 12:11:46 UTC 2012

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

Log Message:
Pull up the following revisions(s) (requested by riz in ticket #1748):
sys/arch/xen/xen/hypervisor.c:  revision 1.62 via patch

Retrieve and print the hypervisor extra (teeny) version.


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.5 -r1.42.4.6 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.42.4.5 src/sys/arch/xen/xen/hypervisor.c:1.42.4.6
--- src/sys/arch/xen/xen/hypervisor.c:1.42.4.5	Mon Sep 26 09:56:54 2011
+++ src/sys/arch/xen/xen/hypervisor.c	Tue May  8 12:11:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.42.4.5 2011/09/26 09:56:54 sborrill Exp $ */
+/* $NetBSD: hypervisor.c,v 1.42.4.6 2012/05/08 12:11:45 sborrill Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -63,7 +63,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.5 2011/09/26 09:56:54 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.6 2012/05/08 12:11:45 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -239,13 +239,17 @@ hypervisor_attach(device_t parent, devic
 
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;
+	char xen_extra_version[XEN_EXTRAVERSION_LEN];
 
 	xenkernfs_init();
 
 #ifdef XEN3
 	xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
-	aprint_normal(: Xen version %d.%d\n, (xen_version  0x)  16,
-	   xen_version  0x);
+	memset(xen_extra_version, 0, sizeof(xen_extra_version));
+	HYPERVISOR_xen_version(XENVER_extraversion, xen_extra_version);
+	aprint_normal(: Xen version %d.%d%s\n,
+		(xen_version  0x)  16, xen_version  0x,
+		 xen_extra_version);
 
 	xengnt_init();
 



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

2012-05-08 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue May  8 15:51:14 UTC 2012

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

Log Message:
Fix XEN2 build after last pullup


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.6 -r1.42.4.7 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.42.4.6 src/sys/arch/xen/xen/hypervisor.c:1.42.4.7
--- src/sys/arch/xen/xen/hypervisor.c:1.42.4.6	Tue May  8 12:11:45 2012
+++ src/sys/arch/xen/xen/hypervisor.c	Tue May  8 15:51:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.42.4.6 2012/05/08 12:11:45 sborrill Exp $ */
+/* $NetBSD: hypervisor.c,v 1.42.4.7 2012/05/08 15:51:13 sborrill Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -63,7 +63,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.6 2012/05/08 12:11:45 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.7 2012/05/08 15:51:13 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -230,6 +230,7 @@ hypervisor_attach(device_t parent, devic
 {
 #ifdef XEN3
 	int xen_version;
+	char xen_extra_version[XEN_EXTRAVERSION_LEN];
 #endif
 #if NPCI 0
 #ifndef XEN3
@@ -239,7 +240,6 @@ hypervisor_attach(device_t parent, devic
 
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;
-	char xen_extra_version[XEN_EXTRAVERSION_LEN];
 
 	xenkernfs_init();
 



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

2012-04-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Apr 21 16:00:47 UTC 2012

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: ioapic.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1747):
sys/arch/x86/x86/ioapic.c: revision 1.46
sys/arch/x86/x86/ioapic.c: revision 1.47
Mask all i8259 interrupts in ioapic_enable().
Should fix PR kern/45160.
Need i8259.h for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.38.6.1 -r1.38.6.2 src/sys/arch/x86/x86/ioapic.c

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

Modified files:

Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.38.6.1 src/sys/arch/x86/x86/ioapic.c:1.38.6.2
--- src/sys/arch/x86/x86/ioapic.c:1.38.6.1	Tue Sep 29 23:55:49 2009
+++ src/sys/arch/x86/x86/ioapic.c	Sat Apr 21 16:00:47 2012
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.38.6.1 2009/09/29 23:55:49 snj Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.38.6.2 2012/04/21 16:00:47 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ioapic.c,v 1.38.6.1 2009/09/29 23:55:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: ioapic.c,v 1.38.6.2 2012/04/21 16:00:47 riz Exp $);
 
 #include opt_ddb.h
 
@@ -83,6 +83,7 @@ __KERNEL_RCSID(0, $NetBSD: ioapic.c,v 1
 #include machine/i82093var.h
 #include machine/i82489reg.h
 #include machine/i82489var.h
+#include machine/i8259.h
 #include machine/mpbiosvar.h
 #include machine/pio.h
 #include machine/pmap.h
@@ -461,6 +462,8 @@ ioapic_enable(void)
 	if (ioapics == NULL)
 		return;
 
+	i8259_setmask(0x);
+
 	if (ioapics-sc_flags  IOAPIC_PICMODE) {
 		aprint_debug_dev(ioapics-sc_dev,
  writing to IMCR to disable pics\n);



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

2012-03-30 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Mar 30 19:29:24 UTC 2012

Modified Files:
src/sys/arch/hp700/hp700 [netbsd-5]: intr.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1745):
sys/arch/hp700/hp700/intr.c: revision 1.38
Check for HPPA_SID_KERNEL when checking for interrupt in the
mutex_enter critical section.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.10.1 src/sys/arch/hp700/hp700/intr.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/hp700/hp700/intr.c
diff -u src/sys/arch/hp700/hp700/intr.c:1.15 src/sys/arch/hp700/hp700/intr.c:1.15.10.1
--- src/sys/arch/hp700/hp700/intr.c:1.15	Mon Apr 28 20:23:19 2008
+++ src/sys/arch/hp700/hp700/intr.c	Fri Mar 30 19:29:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.15 2008/04/28 20:23:19 martin Exp $	*/
+/*	$NetBSD: intr.c,v 1.15.10.1 2012/03/30 19:29:24 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.15 2008/04/28 20:23:19 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.15.10.1 2012/03/30 19:29:24 bouyer Exp $);
 
 #define __MUTEX_PRIVATE
 
@@ -399,7 +399,8 @@ hppa_intr(struct trapframe *frame)
 	 * handlers need to aquire the mutex, they could
 	 * deadlock if the owner value is left unset.
 	 */
-	if (frame-tf_iioq_head = (u_int)mutex_enter_crit_start 
+	if (frame-tf_iisq_head == HPPA_SID_KERNEL 
+	frame-tf_iioq_head = (u_int)mutex_enter_crit_start 
 	frame-tf_iioq_head = (u_int)mutex_enter_crit_end 
 	frame-tf_ret0 != 0)
 		((kmutex_t *)frame-tf_arg0)-mtx_owner = (uintptr_t)curlwp;



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

2012-03-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Mar 21 21:29:32 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: gdt.c machdep.c
src/sys/arch/i386/include [netbsd-5]: segments.h

Log Message:
Apply patch (requested by bouyer in ticket #1738).

Do not special-case XEN and always use the proper selectors for %fs and %gs
in buildcontext() and setregs(). The consequence was that signal handlers
would have the wrong %fs/%gs. Found by running atf tests under Xen/i386.


To generate a diff of this commit:
cvs rdiff -u -r1.45.10.1 -r1.45.10.2 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.644.4.12 -r1.644.4.13 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/arch/i386/include/segments.h

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

Modified files:

Index: src/sys/arch/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.45.10.1 src/sys/arch/i386/i386/gdt.c:1.45.10.2
--- src/sys/arch/i386/i386/gdt.c:1.45.10.1	Sat Apr  4 17:39:09 2009
+++ src/sys/arch/i386/i386/gdt.c	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.45.10.1 2009/04/04 17:39:09 snj Exp $	*/
+/*	$NetBSD: gdt.c,v 1.45.10.2 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.45.10.1 2009/04/04 17:39:09 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.45.10.2 2012/03/21 21:29:31 jdc Exp $);
 
 #include opt_multiprocessor.h
 #include opt_xen.h
@@ -66,7 +66,7 @@ void gdt_grow(int);
 int gdt_get_slot1(int);
 void gdt_put_slot1(int, int);
 
-static void
+void
 update_descriptor(union descriptor *table, union descriptor *entry)
 {
 #ifndef XEN

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.644.4.12 src/sys/arch/i386/i386/machdep.c:1.644.4.13
--- src/sys/arch/i386/i386/machdep.c:1.644.4.12	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/i386/i386/machdep.c	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.644.4.12 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.644.4.13 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.644.4.12 2010/04/22 20:02:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.644.4.13 2012/03/21 21:29:31 jdc Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -577,6 +577,12 @@ i386_switch_context(lwp_t *l)
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb-pcb_esp0);
 
+	/* Update TLS segment pointers */
+	update_descriptor(ci-ci_gdt[GUFS_SEL],
+			  (union descriptor *) pcb-pcb_fsd);
+	update_descriptor(ci-ci_gdt[GUGS_SEL], 
+			  (union descriptor *) pcb-pcb_gsd);
+
 #ifdef XEN3
 	struct physdev_op physop;
 	physop.cmd = PHYSDEVOP_SET_IOPL;
@@ -754,13 +760,8 @@ buildcontext(struct lwp *l, int sel, voi
 {
 	struct trapframe *tf = l-l_md.md_regs;
 
-#ifndef XEN
 	tf-tf_gs = GSEL(GUGS_SEL, SEL_UPL);
 	tf-tf_fs = GSEL(GUFS_SEL, SEL_UPL);
-#else
-	tf-tf_gs = GSEL(GUDATA_SEL, SEL_UPL);
-	tf-tf_fs = GSEL(GUDATA_SEL, SEL_UPL);
-#endif
 	tf-tf_es = GSEL(GUDATA_SEL, SEL_UPL);
 	tf-tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
 	tf-tf_eip = (int)catcher;
@@ -1034,13 +1035,8 @@ setregs(struct lwp *l, struct exec_packa
 	memcpy(pcb-pcb_gsd, gdt[GUDATA_SEL], sizeof(pcb-pcb_gsd));
 
 	tf = l-l_md.md_regs;
-#ifndef XEN
 	tf-tf_gs = GSEL(GUGS_SEL, SEL_UPL);
 	tf-tf_fs = GSEL(GUFS_SEL, SEL_UPL);
-#else
-	tf-tf_gs = LSEL(LUDATA_SEL, SEL_UPL);
-	tf-tf_fs = LSEL(LUDATA_SEL, SEL_UPL);
-#endif
 	tf-tf_es = LSEL(LUDATA_SEL, SEL_UPL);
 	tf-tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
 	tf-tf_edi = 0;

Index: src/sys/arch/i386/include/segments.h
diff -u src/sys/arch/i386/include/segments.h:1.50.4.1 src/sys/arch/i386/include/segments.h:1.50.4.2
--- src/sys/arch/i386/include/segments.h:1.50.4.1	Tue Nov 18 01:56:59 2008
+++ src/sys/arch/i386/include/segments.h	Wed Mar 21 21:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.50.4.1 2008/11/18 01:56:59 snj Exp $	*/
+/*	$NetBSD: segments.h,v 1.50.4.2 2012/03/21 21:29:31 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -198,6 +198,7 @@ void setsegment(struct segment_descripto
 void setgdt(int, const void *, size_t, int, int, int, int);
 void unsetgate(struct gate_descriptor *);
 void cpu_init_idt(void);
+void update_descriptor(union descriptor *, union descriptor *);
 
 #if !defined(XEN)
 void idt_init(void);



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

2012-03-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 17 18:38:57 UTC 2012

Modified Files:
src/sys/arch/x68k/stand [netbsd-5]: Makefile.booters
src/sys/arch/x68k/stand/boot [netbsd-5]: version
src/sys/arch/x68k/stand/boot_ufs [netbsd-5]: Makefile
src/sys/arch/x68k/stand/boot_ustar [netbsd-5]: Makefile
src/sys/arch/x68k/stand/libsa [netbsd-5]: Makefile

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1731):
sys/arch/x68k/stand/boot_ufs/Makefile: revision 1.26 via patch
sys/arch/x68k/stand/boot/version: revision 1.4 via patch
sys/arch/x68k/stand/libsa/Makefile: revision 1.27 via patch
sys/arch/x68k/stand/Makefile.booters: revision 1.7 via patch
sys/arch/x68k/stand/boot_ustar/Makefile: revision 1.19 via patch
Fix Error occurs, please reset boot problem on
X68030 + 060turbo in 060 mode, found on NetBSD booth
at OSC 2011 Hiroshima:
- use -D__daddr_t=int32_t for all bootloader files
  to avoid 64 bit ops in FFS
- explicitly specify -m68020-60 to avoid 64 bit mulsl/mulul
  instructions which need to be handled by 060SP emulation
  but not available in 060turbo IPL ROM
  (LFS still has uint64_t members even with 32bit daddr_t)
The problem was investigated (at least 1.6.2 bootloaders worked)
by Yasushi Oshima at OSC booth, and fixes have been confirmed
by Y.Sugahara on his 060turbo.  Thanks everyone!
Should also be pulled up to netbsd-5.
Bump version to denote 060turbo boot fix.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.88.1 src/sys/arch/x68k/stand/Makefile.booters
cvs rdiff -u -r1.2 -r1.2.136.1 src/sys/arch/x68k/stand/boot/version
cvs rdiff -u -r1.23 -r1.23.4.1 src/sys/arch/x68k/stand/boot_ufs/Makefile
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/arch/x68k/stand/boot_ustar/Makefile
cvs rdiff -u -r1.22 -r1.22.28.1 src/sys/arch/x68k/stand/libsa/Makefile

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

Modified files:

Index: src/sys/arch/x68k/stand/Makefile.booters
diff -u src/sys/arch/x68k/stand/Makefile.booters:1.4 src/sys/arch/x68k/stand/Makefile.booters:1.4.88.1
--- src/sys/arch/x68k/stand/Makefile.booters:1.4	Sun Dec 11 12:19:44 2005
+++ src/sys/arch/x68k/stand/Makefile.booters	Sat Mar 17 18:38:57 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.booters,v 1.4 2005/12/11 12:19:44 christos Exp $
+#	$NetBSD: Makefile.booters,v 1.4.88.1 2012/03/17 18:38:57 bouyer Exp $
 
 S?=	${.CURDIR}/../../../..
 
@@ -6,6 +6,8 @@ S?=	${.CURDIR}/../../../..
 
 CFLAGS+= -ffreestanding
 
+CPPFLAGS+=	-D__daddr_t=int32_t
+
 machine-links:
 	-rm -f machine  \
 	ln -s $S/arch/${MACHINE}/include machine

Index: src/sys/arch/x68k/stand/boot/version
diff -u src/sys/arch/x68k/stand/boot/version:1.2 src/sys/arch/x68k/stand/boot/version:1.2.136.1
--- src/sys/arch/x68k/stand/boot/version:1.2	Fri Nov  9 19:53:16 2001
+++ src/sys/arch/x68k/stand/boot/version	Sat Mar 17 18:38:56 2012
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.2 2001/11/09 19:53:16 scw Exp $
+$NetBSD: version,v 1.2.136.1 2012/03/17 18:38:56 bouyer Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -7,3 +7,4 @@ is taken as the current.
 0.3:	xxboot, ancient monolithic bootstrap program.
 1.0:	Initial version of the libsa-based bootstrap loader.
 1.1:	loadfile() update to avoid backwards seeks for ELF Program Headers.
+1.1.1:	Avoid exception on 68060 in UFS ops.

Index: src/sys/arch/x68k/stand/boot_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.23 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.23.4.1
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.23	Sat Oct 25 22:27:38 2008
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile	Sat Mar 17 18:38:56 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2008/10/25 22:27:38 apb Exp $
+#	$NetBSD: Makefile,v 1.23.4.1 2012/03/17 18:38:56 bouyer Exp $
 
 NOMAN=		# defined
 
@@ -37,12 +37,13 @@ vers.c:	${VERSIONFILE}
 	${HOST_SH} ${S}/conf/newvers_stand.sh -DM ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT}
 
 CFLAGS=	-Os -fomit-frame-pointer
+CFLAGS+= -m68020-60
 CFLAGS+= -W -Wall -Wstrict-prototypes -Wmissing-prototypes
 CPPFLAGS+= -DTEXTADDR=0x$(TEXT) -DBOOT_TEXTADDR=0x$(BOOT_TEXT)
 CPPFLAGS+= -DBOOT=\$(BOOT)\ -DBOOT_VERS=\$(VERSION)\
 CPPFLAGS+= -DSCSI_ADHOC_BOOTPART
 #CPPFLAGS+= -DBOOT_DEBUG
-CPPFLAGS+= -DUSE_FFS -DUSE_LFS -DUSE_UFS1 -DUSE_UFS2 -D__daddr_t=int32_t
+CPPFLAGS+= -DUSE_FFS -DUSE_LFS -DUSE_UFS1 -DUSE_UFS2
 CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS} -I${S} -I. -D_STANDALONE
 AFLAGS=	   ${CFLAGS:M-[ID]*}
 .if ${OBJECT_FMT} == ELF

Index: src/sys/arch/x68k/stand/boot_ustar/Makefile
diff -u src/sys/arch/x68k/stand/boot_ustar/Makefile:1.15 src/sys/arch/x68k/stand/boot_ustar/Makefile:1.15.4.1
--- src/sys/arch/x68k/stand/boot_ustar/Makefile:1.15	Sat Oct 25 22:27:38 2008
+++ src/sys/arch/x68k/stand/boot_ustar/Makefile	Sat Mar 17 18:38:57 2012
@@ -1,4 +1,4 

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

2012-03-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 17 18:40:20 UTC 2012

Modified Files:
src/sys/arch/x68k/dev [netbsd-5]: kbd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1732):
sys/arch/x68k/dev/kbd.c: revision 1.37
Calling psignal(9) (via EV_WAKEUP()) in interrupt handlers
could cause mutex error panic, so defer it via softint(9).
This should fix panic on heavy key strokes during running Xserver.
Should be pulled up to netbsd-5.
XXX: amiga and atari might have the similar problem?


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/arch/x68k/dev/kbd.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/x68k/dev/kbd.c
diff -u src/sys/arch/x68k/dev/kbd.c:1.35 src/sys/arch/x68k/dev/kbd.c:1.35.6.1
--- src/sys/arch/x68k/dev/kbd.c:1.35	Wed Jun 25 08:14:59 2008
+++ src/sys/arch/x68k/dev/kbd.c	Sat Mar 17 18:40:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.35 2008/06/25 08:14:59 isaki Exp $	*/
+/*	$NetBSD: kbd.c,v 1.35.6.1 2012/03/17 18:40:20 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.35 2008/06/25 08:14:59 isaki Exp $);
+__KERNEL_RCSID(0, $NetBSD: kbd.c,v 1.35.6.1 2012/03/17 18:40:20 bouyer Exp $);
 
 #include ite.h
 #include bell.h
@@ -350,7 +350,7 @@ kbdintr(void *arg)
 	fe-value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
 	getmicrotime(fe-time);
 	sc-sc_events.ev_put = put;
-	EV_WAKEUP(sc-sc_events);
+	softint_schedule(sc-sc_softintr_cookie);
 
 	return 0;
 }
@@ -358,10 +358,14 @@ kbdintr(void *arg)
 void
 kbdsoftint(void *arg)			/* what if ite is not configured? */
 {
+	struct kbd_softc *sc = arg;
 	int s;
 
 	s = spltty();
 
+	if (sc-sc_event_mode)
+		EV_WAKEUP(sc-sc_events);
+
 	while(kbdgetoff  kbdputoff)
 		ite_filter(kbdbuf[kbdgetoff++  KBDBUFMASK]);
 	kbdgetoff = kbdputoff = 0;



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

2012-02-24 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 24 17:29:32 UTC 2012

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: pmap.c
src/sys/arch/xen/x86 [netbsd-5]: x86_xpmap.c

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1729):
sys/arch/x86/x86/pmap.c:revision 1.170 via patch
sys/arch/xen/x86/x86_xpmap.c:   revision 1.40 via patch

Fix random kernel panic on domains with large memory.
May fix PR port-xen/38699


To generate a diff of this commit:
cvs rdiff -u -r1.74.4.3 -r1.74.4.4 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/xen/x86/x86_xpmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.74.4.3 src/sys/arch/x86/x86/pmap.c:1.74.4.4
--- src/sys/arch/x86/x86/pmap.c:1.74.4.3	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/x86/x86/pmap.c	Fri Feb 24 17:29:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.74.4.3 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.74.4.4 2012/02/24 17:29:32 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -154,7 +154,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.74.4.3 2010/04/22 20:02:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.74.4.4 2012/02/24 17:29:32 sborrill Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -535,7 +535,12 @@ static struct pool_cache pmap_pv_cache;
  * special VAs and the PTEs that map them
  */
 static pt_entry_t *csrc_pte, *cdst_pte, *zero_pte, *ptp_pte, *early_zero_pte;
-static char *csrcp, *cdstp, *zerop, *ptpp, *early_zerop;
+static char *csrcp, *cdstp, *zerop, *ptpp;
+#ifdef XEN
+char *early_zerop; /* also referenced from xen_pmap_bootstrap() */
+#else
+static char *early_zerop;
+#endif
 
 /*
  * pool and cache that PDPs are allocated from
@@ -1340,8 +1345,11 @@ pmap_bootstrap(vaddr_t kva_start)
 		 * when it's called for the first time.
 		 * XXXfvdl fix this for MULTIPROCESSOR later.
 		 */
-
+#ifdef XEN
+		/* early_zerop initialized in xen_pmap_bootstrap() */
+#else
 		early_zerop = (void *)(KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2);
+#endif
 		early_zero_pte = PTE_BASE + pl1_i((unsigned long)early_zerop);
 	}
 

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.11 src/sys/arch/xen/x86/x86_xpmap.c:1.11.4.1
--- src/sys/arch/xen/x86/x86_xpmap.c:1.11	Fri Oct 24 21:09:24 2008
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri Feb 24 17:29:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.11 2008/10/24 21:09:24 jym Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.11.4.1 2012/02/24 17:29:32 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert m...@adviseo.fr
@@ -79,7 +79,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.11 2008/10/24 21:09:24 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.11.4.1 2012/02/24 17:29:32 sborrill Exp $);
 
 #include opt_xen.h
 #include opt_ddb.h
@@ -545,6 +545,7 @@ xen_pmap_bootstrap(void)
 	 *  - UAREA
 	 *  - dummy user PGD (x86_64)
 	 *  - HYPERVISOR_shared_info
+	 *  - early_zerop
 	 *  - ISA I/O mem (if needed)
 	 */
 	mapsize += UPAGES * NBPG;
@@ -552,6 +553,7 @@ xen_pmap_bootstrap(void)
 	mapsize += NBPG;
 #endif
 	mapsize += NBPG;
+	mapsize += NBPG;
 
 #ifdef DOM0OPS
 	if (xendomain_is_dom0()) {
@@ -639,6 +641,7 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 	vaddr_t page, avail, text_end, map_end;
 	int i;
 	extern char __data_start;
+	extern char *early_zerop; /* from pmap.c */
 
 	__PRINTK((xen_bootstrap_tables(0x%lx, 0x%lx, %d, %d)\n,
 	old_pgd, new_pgd, old_count, new_count));
@@ -652,6 +655,7 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 	 *  UAREA
 	 *  dummy user PGD (x86_64 only)/gdt page (i386 only)
 	 *  HYPERVISOR_shared_info
+	 *  early_zerop
 	 *  ISA I/O mem (if needed)
 	 */
 	map_end = new_pgd + ((new_count + l2_4_count) * NBPG);
@@ -659,6 +663,8 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 		map_end += (UPAGES + 1) * NBPG;
 		HYPERVISOR_shared_info = (shared_info_t *)map_end;
 		map_end += NBPG;
+		early_zerop = (char *)map_end;
+		map_end += NBPG;
 	}
 	/*
 	 * we always set atdevbase, as it's used by init386 to find the first



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

2012-02-24 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 24 17:45:29 UTC 2012

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

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1730):
sys/arch/xen/xen/if_xennet_xenbus.c:revision 1.59 via patch

Fix receive stall on the domU side when buffers stay a long time in the
network stack or socket buffers.


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.6 -r1.29.2.7 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.6 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.7
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.6	Thu May 19 21:13:07 2011
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Fri Feb 24 17:45:29 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.6 2011/05/19 21:13:07 bouyer Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.7 2012/02/24 17:45:29 sborrill Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.6 2011/05/19 21:13:07 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.7 2012/02/24 17:45:29 sborrill Exp $);
 
 #include opt_xen.h
 #include opt_nfs_boot.h
@@ -130,7 +130,6 @@ int xennet_debug = 0xff;
 #endif
 
 #define GRANT_INVALID_REF -1 /* entry is free */
-#define GRANT_STACK_REF   -2 /* entry owned by the network stack */
 
 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
@@ -192,6 +191,9 @@ struct xennet_xenbus_softc {
 static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
 static u_long xennet_pages[NET_RX_RING_SIZE];
 
+static pool_cache_t if_xennetrxbuf_cache;
+static int if_xennetrxbuf_cache_inited=0;
+
 static int  xennet_xenbus_match(device_t, cfdata_t, void *);
 static void xennet_xenbus_attach(device_t, device_t, void *);
 static int  xennet_xenbus_detach(device_t, int);
@@ -202,6 +204,7 @@ static void xennet_alloc_rx_buffer(struc
 static void xennet_free_rx_buffer(struct xennet_xenbus_softc *);
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
+static void xennet_rx_free_req(struct xennet_rxreq *);
 static int  xennet_handler(void *);
 static int  xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
@@ -278,6 +281,14 @@ xennet_xenbus_attach(device_t parent, de
 	sc-sc_xbusd = xa-xa_xbusd;
 	sc-sc_xbusd-xbusd_otherend_changed = xennet_backend_changed;
 
+	/* xenbus ensure 2 devices can't be probed at the same time */
+	if (if_xennetrxbuf_cache_inited == 0) {
+		if_xennetrxbuf_cache = pool_cache_init(PAGE_SIZE, 0, 0, 0,
+		xnfrx, NULL, IPL_VM, NULL, NULL, NULL);
+		if_xennetrxbuf_cache_inited = 1;
+	}
+		
+
 	/* initialize free RX and RX request lists */
 	SLIST_INIT(sc-sc_txreq_head);
 	for (i = 0; i  NET_TX_RING_SIZE; i++) {
@@ -291,13 +302,10 @@ xennet_xenbus_attach(device_t parent, de
 		struct xennet_rxreq *rxreq = sc-sc_rxreqs[i];
 		rxreq-rxreq_id = i;
 		rxreq-rxreq_sc = sc;
-		rxreq-rxreq_va = uvm_km_alloc(kernel_map,
-		PAGE_SIZE, PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_ZERO);
+		rxreq-rxreq_va = (vaddr_t)pool_cache_get_paddr(
+		if_xennetrxbuf_cache, PR_WAITOK, rxreq-rxreq_pa);
 		if (rxreq-rxreq_va == 0)
 			break;
-		if (!pmap_extract(pmap_kernel(), rxreq-rxreq_va,
-		rxreq-rxreq_pa))
-			panic(%s: no pa for mapped va ?, device_xname(self));
 		rxreq-rxreq_gntref = GRANT_INVALID_REF;
 		SLIST_INSERT_HEAD(sc-sc_rxreq_head, rxreq, rxreq_next);
 	}
@@ -560,7 +568,7 @@ xennet_alloc_rx_buffer(struct xennet_xen
 	RING_IDX i;
 	struct xennet_rxreq *req;
 	struct xen_memory_reservation reservation;
-	int s1, s2, otherend_id;
+	int s1, s2, otherend_id, notify;
 	paddr_t pfn;
 
 	otherend_id = sc-sc_xbusd-xbusd_otherend_id;
@@ -647,9 +655,10 @@ out_loop:
 	}
 
 	sc-sc_rx_ring.req_prod_pvt = req_prod + i;
-	RING_PUSH_REQUESTS(sc-sc_rx_ring);
-
+	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(sc-sc_rx_ring, notify);
 	splx(s1);
+	if (notify)
+		hypervisor_notify_via_evtchn(sc-sc_evtchn);
 	return;
 }
 
@@ -669,14 +678,6 @@ xennet_free_rx_buffer(struct xennet_xenb
 	for (i = 0; i  NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = sc-sc_rxreqs[i];
 
-		/*
-		 * if the buffer is in transit in the network stack, wait for
-		 * the network stack to free it.
-		 */
-		while ((volatile grant_ref_t)rxreq-rxreq_gntref ==
-		GRANT_STACK_REF)
-			tsleep(xennet_xenbus_detach, PRIBIO, xnet_free, hz/2);
-
 		if (rxreq-rxreq_gntref != GRANT_INVALID_REF) {
 			/*
 			 * this req is still granted. Get back the page or
@@ -746,7 +747,20 @@ xennet_free_rx_buffer(struct xennet_xenb

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

2012-02-04 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Feb  4 17:04:09 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1719):
sys/arch/i386/conf/INSTALL_FLOPPY: revision 1.15
Add virtio driver to INSTALL_FLOPPY.
Requested by Matthias Scheler t...@netbsd.org for particular cases like
http://mail-index.netbsd.org/netbsd-users/2011/09/13/msg009128.html


To generate a diff of this commit:
cvs rdiff -u -r1.1.16.2 -r1.1.16.3 src/sys/arch/i386/conf/INSTALL_FLOPPY

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

Modified files:

Index: src/sys/arch/i386/conf/INSTALL_FLOPPY
diff -u src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.2 src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.3
--- src/sys/arch/i386/conf/INSTALL_FLOPPY:1.1.16.2	Tue Nov 18 01:56:58 2008
+++ src/sys/arch/i386/conf/INSTALL_FLOPPY	Sat Feb  4 17:04:09 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_FLOPPY,v 1.1.16.2 2008/11/18 01:56:58 snj Exp $
+#	$NetBSD: INSTALL_FLOPPY,v 1.1.16.3 2012/02/04 17:04:09 bouyer Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -742,6 +742,11 @@ url*	at uhub? port ?		# Realtek RTL8150L
 # Planetconnect Satellite receiver driver.
 #satlink0 at isa? port 0x300 drq 1
 
+# Virtio devices
+virtio*	at pci? dev ? function ?	# Virtio PCI device
+viomb*	at virtio?			# Virtio memory balloon device
+ld*	at virtio?			# Virtio disk device
+vioif*	at virtio?			# Virtio network device
 
 # Pull in optional local configuration
 cinclude arch/i386/conf/INSTALL.local



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

2011-11-18 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Nov 18 21:09:24 UTC 2011

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: vector.S

Log Message:
Pull up the following revisions(s) (requested by dholland in ticket #1687):
sys/arch/i386/i386/vector.S:revision 1.54

Keep interrupts disabled in NMI handler. Addresses PR/43007.


To generate a diff of this commit:
cvs rdiff -u -r1.42.6.3 -r1.42.6.4 src/sys/arch/i386/i386/vector.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/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.42.6.3 src/sys/arch/i386/i386/vector.S:1.42.6.4
--- src/sys/arch/i386/i386/vector.S:1.42.6.3	Thu May 20 05:51:59 2010
+++ src/sys/arch/i386/i386/vector.S	Fri Nov 18 21:09:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.42.6.3 2010/05/20 05:51:59 snj Exp $	*/
+/*	$NetBSD: vector.S,v 1.42.6.4 2011/11/18 21:09:24 sborrill Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.42.6.3 2010/05/20 05:51:59 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.42.6.4 2011/11/18 21:09:24 sborrill Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -841,7 +841,10 @@ IDTVEC(trap00)
 IDTVEC(trap01)
 	BPTTRAP(T_TRCTRAP)
 IDTVEC(trap02)
-	ZTRAP(T_NMI)
+	pushl $0
+	pushl $(T_NMI)
+	INTRENTRY
+	jmp _C_LABEL(calltrap)
 IDTVEC(trap03)
 	BPTTRAP(T_BPTFLT)
 IDTVEC(trap04)



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

2011-11-02 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov  2 20:30:41 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1682):
sys/arch/xen/xen/xbdback_xenbus.c: revision 1.45
Guard against spurious xbdback_backend_changed() calls which would result
in the block device being opened twice. Fixes port-xen/45158,
although the underlying cause (multiple open of the same device not
properly handled any more) is not fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.20.4.6 -r1.20.4.7 src/sys/arch/xen/xen/xbdback_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.6 src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.7
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.6	Fri Aug 12 20:48:47 2011
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Wed Nov  2 20:30:41 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.20.4.6 2011/08/12 20:48:47 riz Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.20.4.7 2011/11/02 20:30:41 riz Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.6 2011/08/12 20:48:47 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.7 2011/11/02 20:30:41 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -674,10 +674,16 @@ xbdback_backend_changed(struct xenbus_wa
 	 */
 	if (err)
 		return;
-	if (xbdi-xbdi_status == CONNECTED  xbdi-xbdi_dev != dev) {
-		printf(xbdback %s: changing physical device from 0x%x to 
-		0x%lx not supported\n, xbusd-xbusd_path, xbdi-xbdi_dev,
-		dev);
+	/*
+	 * we can also fire up after having opened the device, don't try
+	 * to do it twice.
+	 */
+	if (xbdi-xbdi_vp != NULL) {
+		if (xbdi-xbdi_status == CONNECTED  xbdi-xbdi_dev != dev) {
+			printf(xbdback %s: changing physical device from 
+			0x%x to 0x%lx not supported\n,
+			xbusd-xbusd_path, xbdi-xbdi_dev, dev);
+		}
 		return;
 	}
 	xbdi-xbdi_dev = dev;



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

2011-10-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Oct 16 23:38:52 UTC 2011

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-5]: gatea20.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #923):
sys/arch/i386/stand/lib/gatea20.c: revision 1.12
PR# kern/39726: Soekris 5501-60 boot/bootxx 120 second delay
PR# port-i386/41162: A20 gate legacy hook cause long pxeboot delay on Soekris
net5501
Remove calls to delay() before polling KBD registers in gateA20().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/i386/stand/lib/gatea20.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/i386/stand/lib/gatea20.c
diff -u src/sys/arch/i386/stand/lib/gatea20.c:1.11 src/sys/arch/i386/stand/lib/gatea20.c:1.11.4.1
--- src/sys/arch/i386/stand/lib/gatea20.c:1.11	Tue Oct 14 14:18:11 2008
+++ src/sys/arch/i386/stand/lib/gatea20.c	Sun Oct 16 23:38:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gatea20.c,v 1.11 2008/10/14 14:18:11 ad Exp $	*/
+/*	$NetBSD: gatea20.c,v 1.11.4.1 2011/10/16 23:38:52 riz Exp $	*/
 
 /* extracted from freebsd:sys/i386/boot/biosboot/io.c */
 
@@ -67,12 +67,10 @@ gateA20(void)
 
 		outb(K_CMD, KC_CMD_WOUT);
 
-		delay(100);
 		while (inb(K_STATUS)  K_IBUF_FUL);
 
 		outb(K_RDWR, x_20);
 
-		delay(100);
 		while (inb(K_STATUS)  K_IBUF_FUL);
 
 		while (inb(K_STATUS)  K_OBUF_FUL)



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

2011-09-26 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Sep 26 09:56:55 UTC 2011

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

Log Message:
Patch to fix build on Xen 2 (fallout from pullup #1672)


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.4 -r1.42.4.5 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.42.4.4 src/sys/arch/xen/xen/hypervisor.c:1.42.4.5
--- src/sys/arch/xen/xen/hypervisor.c:1.42.4.4	Fri Sep 23 12:44:51 2011
+++ src/sys/arch/xen/xen/hypervisor.c	Mon Sep 26 09:56:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.42.4.4 2011/09/23 12:44:51 sborrill Exp $ */
+/* $NetBSD: hypervisor.c,v 1.42.4.5 2011/09/26 09:56:54 sborrill Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -63,7 +63,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.4 2011/09/23 12:44:51 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.5 2011/09/26 09:56:54 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -100,7 +100,6 @@ __KERNEL_RCSID(0, $NetBSD: hypervisor.c
 #include xen/xen3-public/version.h
 #endif
 
-#if defined(DOM0OPS) || defined(XEN3)
 #include sys/dirent.h
 #include sys/stat.h
 #include sys/tree.h
@@ -108,6 +107,7 @@ __KERNEL_RCSID(0, $NetBSD: hypervisor.c
 #include miscfs/specfs/specdev.h
 #include miscfs/kernfs/kernfs.h
 #include xen/kernfs_machdep.h
+#if defined(DOM0OPS) || defined(XEN3)
 #include dev/isa/isavar.h
 #endif /* DOM0OPS || XEN3 */
 #ifdef XEN3



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

2011-09-23 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Sep 23 12:44:52 UTC 2011

Modified Files:
src/sys/arch/xen/conf [netbsd-5]: files.xen
src/sys/arch/xen/xen [netbsd-5]: hypervisor.c
src/sys/arch/xen/xenbus [netbsd-5]: xenbus_dev.c xenbus_probe.c

Log Message:
Pull up the following revisions(s) (requested by jym in ticket #1672):
sys/arch/xen/conf/files.xen:revision 1.123 via patch
sys/arch/xen/xen/hypervisor.c:  revision 1.58 via patch
sys/arch/xen/xenbus/xenbus_dev.c:   revision 1.9
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.35

Expose Xen kernfs entries inside a domU to make it possible to use pkgsrc's
sysutils/xentools inside a domU to query XenStore entries (or even modify
part of it if the domain has enough rights).


To generate a diff of this commit:
cvs rdiff -u -r1.88.4.6 -r1.88.4.7 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.42.4.3 -r1.42.4.4 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.7 -r1.7.28.1 src/sys/arch/xen/xenbus/xenbus_dev.c
cvs rdiff -u -r1.26.2.3 -r1.26.2.4 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.88.4.6 src/sys/arch/xen/conf/files.xen:1.88.4.7
--- src/sys/arch/xen/conf/files.xen:1.88.4.6	Fri Jan  7 01:42:55 2011
+++ src/sys/arch/xen/conf/files.xen	Fri Sep 23 12:44:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.88.4.6 2011/01/07 01:42:55 riz Exp $
+#	$NetBSD: files.xen,v 1.88.4.7 2011/09/23 12:44:51 sborrill Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -181,7 +181,7 @@
 attach xenbus at xendevbus
 file arch/xen/xenbus/xenbus_client.c xenbus  xen3 needs-flag
 file arch/xen/xenbus/xenbus_comms.c xenbus  xen3 needs-flag
-file arch/xen/xenbus/xenbus_dev.c xenbus  xen3  dom0ops needs-flag
+file arch/xen/xenbus/xenbus_dev.c xenbus  xen3 needs-flag
 file arch/xen/xenbus/xenbus_probe.c xenbus  xen3 needs-flag
 file arch/xen/xenbus/xenbus_xs.c xenbus  xen3 needs-flag
 

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.42.4.3 src/sys/arch/xen/xen/hypervisor.c:1.42.4.4
--- src/sys/arch/xen/xen/hypervisor.c:1.42.4.3	Sun Oct  4 00:02:00 2009
+++ src/sys/arch/xen/xen/hypervisor.c	Fri Sep 23 12:44:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.42.4.3 2009/10/04 00:02:00 snj Exp $ */
+/* $NetBSD: hypervisor.c,v 1.42.4.4 2011/09/23 12:44:51 sborrill Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -63,7 +63,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.3 2009/10/04 00:02:00 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.42.4.4 2011/09/23 12:44:51 sborrill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -240,11 +240,8 @@
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;
 
-#ifdef DOM0OPS
-	if (xendomain_is_privileged()) {
-		xenkernfs_init();
-	}
-#endif
+	xenkernfs_init();
+
 #ifdef XEN3
 	xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
 	aprint_normal(: Xen version %d.%d\n, (xen_version  0x)  16,
@@ -408,8 +405,6 @@
 	return (UNCONF);
 }
 
-#if defined(DOM0OPS)
-
 #define DIR_MODE	(S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
 
 kernfs_parentdir_t *kernxen_pkt;
@@ -424,7 +419,6 @@
 	kernfs_addentry(NULL, dkt);
 	kernxen_pkt = KERNFS_ENTOPARENTDIR(dkt);
 }
-#endif /* DOM0OPS */
 
 #ifndef XEN3
 /* handler for the shutdown messages */

Index: src/sys/arch/xen/xenbus/xenbus_dev.c
diff -u src/sys/arch/xen/xenbus/xenbus_dev.c:1.7 src/sys/arch/xen/xenbus/xenbus_dev.c:1.7.28.1
--- src/sys/arch/xen/xenbus/xenbus_dev.c:1.7	Tue Nov 27 11:37:27 2007
+++ src/sys/arch/xen/xenbus/xenbus_dev.c	Fri Sep 23 12:44:52 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.7 2007/11/27 11:37:27 pooka Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.7.28.1 2011/09/23 12:44:52 sborrill Exp $ */
 /*
  * xenbus_dev.c
  * 
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_dev.c,v 1.7 2007/11/27 11:37:27 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_dev.c,v 1.7.28.1 2011/09/23 12:44:52 sborrill Exp $);
 
 #include opt_xen.h
 
@@ -92,10 +92,13 @@
 	PRIVCMD_MODE);
 	kernfs_addentry(kernxen_pkt, dkt);
 
-	kfst = KERNFS_ALLOCTYPE(xsd_port_fileops);
-	KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
-	KERNFS_INITENTRY(dkt, DT_REG, xsd_port, NULL, kfst, VREG, XSD_MODE);
-	kernfs_addentry(kernxen_pkt, dkt);
+	if (xendomain_is_dom0()) {
+		kfst = KERNFS_ALLOCTYPE(xsd_port_fileops);
+		KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+		KERNFS_INITENTRY(dkt, DT_REG, xsd_port, NULL,
+		kfst, VREG, XSD_MODE);
+		kernfs_addentry(kernxen_pkt, dkt);
+	}
 }
 
 struct xenbus_dev_data {

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.3 

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

2011-08-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Aug 12 20:48:48 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1654):
sys/arch/xen/xen/xbdback_xenbus.c: revision 1.42
sys/arch/xen/xen/xbdback_xenbus.c: revision 1.43
sys/arch/xen/xen/xbdback_xenbus.c: revision 1.44
Make sure to call xbdback_trampoline() at splbio()
Several fixes to the continuation engine:
- make sure to enter the continuation loop at splbio(), and add some
  KASSERT() for this.
- When a flush operation is enqueued to the workqueue, make sure the
  continuation loop can't be restarted by a previous workqueue
  completion or an event. We can't restart it at this point because
  the flush even is still recorded as the current I/O.
  For this add a xbdback_co_cache_doflush_wait() which acts as a noop;
  the workqueue callback will restart the loop once the flush is complete.
Should fix kernel diagnostic assertion xbd_io-xio_mapped == 0 panics
reported by Jeff Rizzo on port-xen@.
Add a comment explaing why a flush workqueue is handled differently from
read/write workqueue requests.


To generate a diff of this commit:
cvs rdiff -u -r1.20.4.5 -r1.20.4.6 src/sys/arch/xen/xen/xbdback_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.5 src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.6
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.5	Sat Jun 18 16:38:26 2011
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Fri Aug 12 20:48:47 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.20.4.5 2011/06/18 16:38:26 bouyer Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.20.4.6 2011/08/12 20:48:47 riz Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.5 2011/06/18 16:38:26 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.6 2011/08/12 20:48:47 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -283,6 +283,7 @@
 static void *xbdback_co_cache_flush(struct xbdback_instance *, void *);
 static void *xbdback_co_cache_flush2(struct xbdback_instance *, void *);
 static void *xbdback_co_cache_doflush(struct xbdback_instance *, void *);
+static void *xbdback_co_cache_doflush_wait(struct xbdback_instance *, void *);
 
 static void *xbdback_co_io(struct xbdback_instance *, void *);
 static void *xbdback_co_io_gotreq(struct xbdback_instance *, void *);
@@ -941,6 +942,8 @@
 {
 	(void)obj;
 	if (xbdi-xbdi_io != NULL) {
+		KASSERT(xbdi-xbdi_io-xio_operation == BLKIF_OP_READ ||
+		xbdi-xbdi_io-xio_operation == BLKIF_OP_WRITE);
 		xbdi-xbdi_cont = xbdback_co_flush;
 		xbdi-xbdi_cont_aux = xbdback_co_main_done2;
 	} else {
@@ -966,8 +969,13 @@
 xbdback_co_cache_flush(struct xbdback_instance *xbdi, void *obj)
 {
 	(void)obj;
+	KASSERT(curcpu()-ci_ilevel = IPL_BIO);
 	XENPRINTF((xbdback_co_cache_flush %p %p\n, xbdi, obj));
 	if (xbdi-xbdi_io != NULL) {
+		/* Some I/Os are required for this instance. Process them. */
+		KASSERT(xbdi-xbdi_io-xio_operation == BLKIF_OP_READ ||
+		xbdi-xbdi_io-xio_operation == BLKIF_OP_WRITE);
+		KASSERT(xbdi-xbdi_pendingreqs == 0);
 		xbdi-xbdi_cont = xbdback_co_flush;
 		xbdi-xbdi_cont_aux = xbdback_co_cache_flush2;
 	} else {
@@ -982,7 +990,10 @@
 	(void)obj;
 	XENPRINTF((xbdback_co_cache_flush2 %p %p\n, xbdi, obj));
 	if (xbdi-xbdi_pendingreqs  0) {
-		/* event or iodone will restart processing */
+		/*
+		 * There are pending requests.
+		 * Event or iodone() will restart processing
+		 */
 		xbdi-xbdi_cont = NULL;
 		xbdi_put(xbdi);
 		return NULL;
@@ -1002,8 +1013,23 @@
 	xbd_io-xio_operation = xbdi-xbdi_xen_req.operation;
 	xbd_io-xio_flush_id = xbdi-xbdi_xen_req.id;
 	workqueue_enqueue(xbdback_workqueue, xbdi-xbdi_io-xio_work, NULL);
-	/* xbdback_do_io() will advance req pointer and restart processing */
-	xbdi-xbdi_cont = xbdback_co_cache_doflush;
+	/*
+	 * xbdback_do_io() will advance req pointer and restart processing.
+	 * Note that we could probably set xbdi-xbdi_io to NULL and
+	 * let the processing continue, but we really want to wait
+	 * for the flush to complete before doing any more work.
+	 */
+	xbdi-xbdi_cont = xbdback_co_cache_doflush_wait;
+	return NULL;
+}
+
+/* wait for the flush work to complete */
+static void *
+xbdback_co_cache_doflush_wait(struct xbdback_instance *xbdi, void *obj)
+{
+	(void)obj;
+	/* abort the continuation loop; xbdback_do_io() will restart it */
+	xbdi-xbdi_cont = xbdback_co_cache_doflush_wait;
 	return NULL;
 }
 
@@ -1027,7 +1053,9 @@
 		goto end;
 	}
 
-	if (xbdi-xbdi_xen_req.operation == BLKIF_OP_WRITE) {
+	KASSERT(req-operation == BLKIF_OP_READ ||
+	req-operation == BLKIF_OP_WRITE);
+	if (req-operation == 

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

2011-07-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jul 15 22:43:59 UTC 2011

Modified Files:
src/sys/arch/mvme68k/stand/libsa [netbsd-5]: exec_mvme.c
src/sys/arch/sun68k/stand/tapeboot [netbsd-5]: boot.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1639):
sys/arch/sun68k/stand/tapeboot/boot.c: revision 1.7 via patch
sys/arch/mvme68k/stand/libsa/exec_mvme.c: revision 1.16 via patch
Disable LOAD_BACKWARDS on tapeboot which can't seek backwards.
Fixes bootstrap tapeboot installation failure on TME reported from ryoon@.
Should be pulled up to netbsd-5.
(note netbsd-5 uses LOAD_NOTE instead of LOAD_BACKWARDS)
Avoid backward seek on tape boot.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.20.1 src/sys/arch/mvme68k/stand/libsa/exec_mvme.c
cvs rdiff -u -r1.5 -r1.5.88.1 src/sys/arch/sun68k/stand/tapeboot/boot.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/mvme68k/stand/libsa/exec_mvme.c
diff -u src/sys/arch/mvme68k/stand/libsa/exec_mvme.c:1.15 src/sys/arch/mvme68k/stand/libsa/exec_mvme.c:1.15.20.1
--- src/sys/arch/mvme68k/stand/libsa/exec_mvme.c:1.15	Sat Jan 12 09:54:32 2008
+++ src/sys/arch/mvme68k/stand/libsa/exec_mvme.c	Fri Jul 15 22:43:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_mvme.c,v 1.15 2008/01/12 09:54:32 tsutsui Exp $ */
+/*	$NetBSD: exec_mvme.c,v 1.15.20.1 2011/07/15 22:43:59 riz Exp $ */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -56,7 +56,7 @@
 
 	lflags = LOAD_KERNEL;
 	if ((flag  RB_NOSYM) != 0 )
-		lflags = ~LOAD_SYM;
+		lflags = ~(LOAD_SYM | LOAD_NOTE);
 
 	marks[MARK_START] = KERN_LOADADDR;
 	if ((fd = loadfile(file, marks, lflags)) == -1)

Index: src/sys/arch/sun68k/stand/tapeboot/boot.c
diff -u src/sys/arch/sun68k/stand/tapeboot/boot.c:1.5 src/sys/arch/sun68k/stand/tapeboot/boot.c:1.5.88.1
--- src/sys/arch/sun68k/stand/tapeboot/boot.c:1.5	Sun Dec 11 12:19:29 2005
+++ src/sys/arch/sun68k/stand/tapeboot/boot.c	Fri Jul 15 22:43:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.5 2005/12/11 12:19:29 christos Exp $ */
+/*	$NetBSD: boot.c,v 1.5.88.1 2011/07/15 22:43:59 riz Exp $ */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -107,7 +107,8 @@
 			printf(tapeboot: loading segment %s\n, file);
 
 		marks[MARK_START] = mark_start;
-		if ((fd = loadfile(file, marks, LOAD_KERNEL)) != -1) {
+		if ((fd = loadfile(file, marks,
+		LOAD_KERNEL  ~LOAD_NOTE)) != -1) {
 			break;
 		}
 		printf(tapeboot: segment %s: %s\n, file, strerror(errno));



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

2011-07-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jul 15 22:46:06 UTC 2011

Modified Files:
src/sys/arch/x68k/x68k [netbsd-5]: locore.s

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1640):
sys/arch/x68k/x68k/locore.s: revision 1.102
Defer fpu_probe() call until curlwp and related variables are initialized.
Fixes pre-consinit KASSERT() in trap() caused by fnop instruction in
fpu_probe() on machines without FPU, including XM6i.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.84.6.1 src/sys/arch/x68k/x68k/locore.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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.84 src/sys/arch/x68k/x68k/locore.s:1.84.6.1
--- src/sys/arch/x68k/x68k/locore.s:1.84	Mon Jun 23 08:33:38 2008
+++ src/sys/arch/x68k/x68k/locore.s	Fri Jul 15 22:46:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.84 2008/06/23 08:33:38 isaki Exp $	*/
+/*	$NetBSD: locore.s,v 1.84.6.1 2011/07/15 22:46:06 riz Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -955,9 +955,6 @@
 /* select the software page size now */
 	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
 	jbsr	_C_LABEL(uvm_setpagesize)  | select software page size
-/* detect FPU type */
-	jbsr	_C_LABEL(fpu_probe)
-	movl	%d0,_C_LABEL(fputype)
 /* set kernel stack, user SP, and initial pcb */
 	movl	_C_LABEL(proc0paddr),%a1 | get lwp0 pcb addr
 	lea	%a1@(USPACE-4),%sp	| set kernel stack to end of area
@@ -968,6 +965,9 @@
 	movl	%a2,%usp		| init user SP
 	movl	%a1,_C_LABEL(curpcb)	| lwp0 is running
 
+/* detect FPU type */
+	jbsr	_C_LABEL(fpu_probe)
+	movl	%d0,_C_LABEL(fputype)
 	tstl	_C_LABEL(fputype)	| Have an FPU?
 	jeq	Lenab2			| No, skip.
 	clrl	%a1@(PCB_FPCTX)		| ensure null FP context



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

2011-07-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Jul 16 00:14:57 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1641):
sys/arch/sparc64/dev/lom.c: revision 1.8
Limit reading from registers at most once every second with using
ratecheck(9).


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.7 src/sys/arch/sparc64/dev/lom.c:1.1.2.8
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.7	Sun Mar 20 21:23:32 2011
+++ src/sys/arch/sparc64/dev/lom.c	Sat Jul 16 00:14:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.8 2011/07/16 00:14:57 riz Exp $	*/
 /*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.8 2011/07/16 00:14:57 riz Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -171,6 +171,12 @@
 
 	int32_t			sc_sysctl_num[LOM_MAX_ALARM];
 
+	struct timeval		sc_alarm_lastread;
+	uint8_t			sc_alarm_lastval;
+	struct timeval		sc_fan_lastread[LOM_MAX_FAN];
+	struct timeval		sc_psu_lastread[LOM_MAX_PSU];
+	struct timeval		sc_temp_lastread[LOM_MAX_TEMP];
+
 	uint8_t			sc_fan_cal[LOM_MAX_FAN];
 	uint8_t			sc_fan_low[LOM_MAX_FAN];
 
@@ -239,6 +245,7 @@
 static const char *nodedesc[LOM_MAX_ALARM] =
 { Fault LED status, Alarm1 status, Alarm2 status , Alarm3 status };
 #endif
+static const struct timeval refresh_interval = { 1, 0 };
 
 static int
 lom_match(device_t parent, cfdata_t match, void *aux)
@@ -1002,24 +1009,31 @@
 	/* Fault LED or Alarms */
 	KASSERT(i  sc-sc_num_alarm);
 
-	if (lom_read(sc, LOM_IDX_ALARM, val)) {
-		edata-state = ENVSYS_SINVALID;
-	} else {
-		if (i == 0) {
-			/* Fault LED */
-			if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
-edata-value_cur = 0;
-			else
-edata-value_cur = 1;
-		} else {
-			/* Alarms */
-			if ((val  (LOM_ALARM_1  (i - 1))) == 0)
-edata-value_cur = 0;
-			else
-edata-value_cur = 1;
+	/* Read new value at most once every second. */
+	if (ratecheck(sc-sc_alarm_lastread, refresh_interval)) {
+		if (lom_read(sc, LOM_IDX_ALARM, val)) {
+			edata-state = ENVSYS_SINVALID;
+			return;
 		}
-		edata-state = ENVSYS_SVALID;
+		sc-sc_alarm_lastval = val;
+	} else {
+		val = sc-sc_alarm_lastval;
+	}
+
+	if (i == 0) {
+		/* Fault LED */
+		if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
+			edata-value_cur = 0;
+		else
+			edata-value_cur = 1;
+	} else {
+		/* Alarms */
+		if ((val  (LOM_ALARM_1  (i - 1))) == 0)
+			edata-value_cur = 0;
+		else
+			edata-value_cur = 1;
 	}
+	edata-state = ENVSYS_SVALID;
 }
 
 static void
@@ -1030,6 +1044,10 @@
 	/* Fan speed */
 	KASSERT(i  sc-sc_num_fan);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_fan_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
 		edata-state = ENVSYS_SINVALID;
 	} else {
@@ -1049,6 +1067,10 @@
 	/* PSU status */
 	KASSERT(i  sc-sc_num_psu);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_psu_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_PSU1 + i, val) ||
 	!ISSET(val, LOM_PSU_PRESENT)) {
 		edata-state = ENVSYS_SINVALID;
@@ -1076,6 +1098,10 @@
 	/* Temperature */
 	KASSERT(i  sc-sc_num_temp);
 
+	/* Read new value at most once every second. */
+	if (!ratecheck(sc-sc_temp_lastread[i], refresh_interval))
+		return;
+
 	if (lom_read(sc, LOM_IDX_TEMP1 + i, val)) {
 		edata-state = ENVSYS_SINVALID;
 	} else {



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

2011-06-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Jun 18 16:26:58 UTC 2011

Modified Files:
src/sys/arch/m68k/fpe [netbsd-5]: fpu_emulate.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1626):
sys/arch/m68k/fpe/fpu_emulate.c: revision 1.31
Fix botch in rev 1.28 that causes wrong results of fcmp and ftst in FPE.
fpu_upd_fpsr() should be called even in discard_result case if an emulated
instruction gets proper result without signal.
Fixes weird behavior of awk(1) seen on /etc/rc.d/postfix on XM6i and
TME emulating sun3 without 68881.
Should be pulled up to all netbsd-4 and netbsd-5 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.27.54.1 -r1.27.54.2 src/sys/arch/m68k/fpe/fpu_emulate.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/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.1 src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.2
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.27.54.1	Mon Jan 26 00:24:55 2009
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sat Jun 18 16:26:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.27.54.1 2009/01/26 00:24:55 snj Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.27.54.2 2011/06/18 16:26:58 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fpu_emulate.c,v 1.27.54.1 2009/01/26 00:24:55 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: fpu_emulate.c,v 1.27.54.2 2011/06/18 16:26:58 bouyer Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -922,27 +922,34 @@
 if (res == NULL)
 	sig = SIGILL;
 
-if (!discard_result  sig == 0) {
-	fpu_implode(fe, res, FTYPE_EXT, fpregs[regnum * 3]);
+if (sig == 0) {
+	if (!discard_result)
+	fpu_implode(fe, res, FTYPE_EXT, fpregs[regnum * 3]);
 
 	/* update fpsr according to the result of operation */
 	fpu_upd_fpsr(fe, res);
 #if DEBUG_FPE
-	printf(fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n,
-	   fpregs[regnum*3], fpregs[regnum*3+1],
-	   fpregs[regnum*3+2], regnum);
-} else if (sig == 0) {
-	static const char *class_name[] =
-	{ SNAN, QNAN, ZERO, NUM, INF };
-	printf(fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x) discarded\n,
-	   class_name[res-fp_class + 2],
-	   res-fp_sign ? '-' : '+', res-fp_exp,
-	   res-fp_mant[0], res-fp_mant[1],
-	   res-fp_mant[2]);
-} else {
-	printf(fpu_emul_arith: received signal %d\n, sig);
+	if (!discard_result) {
+	printf(fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n,
+		fpregs[regnum*3], fpregs[regnum*3+1],
+		fpregs[regnum*3+2], regnum);
+	} else {
+	static const char *class_name[] =
+		{ SNAN, QNAN, ZERO, NUM, INF };
+	printf(fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x)
+		 discarded\n,
+		class_name[res-fp_class + 2],
+		res-fp_sign ? '-' : '+', res-fp_exp,
+		res-fp_mant[0], res-fp_mant[1],
+		res-fp_mant[2]);
+	}
 #endif
 }
+#if DEBUG_FPE
+else {
+	printf(fpu_emul_arith: received signal %d\n, sig);
+}
+#endif
 
 #if DEBUG_FPE
 printf(fpu_emul_arith: FPSR = %08x, FPCR = %08x\n,



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

2011-05-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri May 20 19:28:06 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1617):
sys/arch/x68k/dev/fd.c: revision 1.94 via patch
Fix hangup on the first floppy access since 2008.
Problem was reported by isaki@.
On X680x0 (and most other machines other than ISA FDC),
the ready line from FDD is connected to FDC and fdc driver can
be notified of the ready state after fd_set_motor() by interrupts.
In this case no need to use callout(9) to wait the FDD motor stabilized,
and the callout(9) method used in ISA fdc(4) driver rather caused
infinite unhandled interrupts since callout(9) was no longer invoked
during interrupt storm after vmlocking2 merge, I guess.
Should be pulled up to netbsd-5.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.6.1 src/sys/arch/x68k/dev/fd.c

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

Modified files:

Index: src/sys/arch/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.85 src/sys/arch/x68k/dev/fd.c:1.85.6.1
--- src/sys/arch/x68k/dev/fd.c:1.85	Sun Jun 29 09:44:11 2008
+++ src/sys/arch/x68k/dev/fd.c	Fri May 20 19:28:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.85 2008/06/29 09:44:11 isaki Exp $	*/
+/*	$NetBSD: fd.c,v 1.85.6.1 2011/05/20 19:28:05 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.85 2008/06/29 09:44:11 isaki Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.85.6.1 2011/05/20 19:28:05 bouyer Exp $);
 
 #include rnd.h
 #include opt_ddb.h
@@ -212,7 +212,9 @@
 	struct fd_type *sc_deftype;	/* default type descriptor */
 	struct fd_type *sc_type;	/* current type descriptor */
 
+#if 0	/* see comments in fd_motor_on() */
 	struct callout sc_motoron_ch;
+#endif
 	struct callout sc_motoroff_ch;
 
 	daddr_t	sc_blkno;	/* starting block number */
@@ -278,7 +280,9 @@
 
 void fd_set_motor(struct fdc_softc *, int);
 void fd_motor_off(void *);
+#if 0
 void fd_motor_on(void *);
+#endif
 int fdcresult(struct fdc_softc *);
 int out_fdc(bus_space_tag_t, bus_space_handle_t, u_char);
 void fdcstart(struct fdc_softc *);
@@ -566,7 +570,9 @@
 	struct fd_type *type = fd_types[0];	/* XXX 1.2MB */
 	int drive = fa-fa_drive;
 
+#if 0
 	callout_init(fd-sc_motoron_ch, 0);
+#endif
 	callout_init(fd-sc_motoroff_ch, 0);
 
 	fd-sc_dev = self;
@@ -790,6 +796,7 @@
 	splx(s);
 }
 
+#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */
 void
 fd_motor_on(void *arg)
 {
@@ -805,6 +812,7 @@
 		(void) fdcintr(fdc);
 	splx(s);
 }
+#endif
 
 int
 fdcresult(struct fdc_softc *fdc)
@@ -1078,9 +1086,11 @@
 			fd-sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
 			fd_set_motor(fdc, 0);
 			fdc-sc_state = MOTORWAIT;
+#if 0	/* no need to callout on x68k; motor on will trigger interrupts */
 			/* allow .5s for motor to stabilize */
 			callout_reset(fd-sc_motoron_ch, hz / 2,
 			fd_motor_on, fd);
+#endif
 			return 1;
 		}
 		/* Make sure the right drive is selected. */
@@ -1434,8 +1444,21 @@
 		goto doseek;
 
 	case MOTORWAIT:
+#if 0 /* on x68k motor on triggers interrupts by state change of ready line. */
 		if (fd-sc_flags  FD_MOTOR_WAIT)
 			return 1;		/* time's not up yet */
+#else
+		/* check drive ready by state change interrupt */
+		KASSERT(fd-sc_flags  FD_MOTOR_WAIT);
+		out_fdc(iot, ioh, NE7CMD_SENSEI);
+		tmp = fdcresult(fdc);
+		if (tmp != 2 || (st0  0xc0) != 0xc0 /* ready changed */) {
+			printf(%s: unexpected interrupt during MOTORWAIT\n,
+			device_xname(fd-sc_dev));
+			return 1;
+		}
+		fd-sc_flags = ~FD_MOTOR_WAIT;
+#endif
 		goto doseek;
 
 	default:



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

2011-05-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri May 20 19:32:44 UTC 2011

Modified Files:
src/sys/arch/x68k/x68k [netbsd-5]: disksubr.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1621):
sys/arch/x68k/x68k/disksubr.c: revision 1.34
Fix buffer overrun in readdisklabel(9) (and writedisklabel(9))
that causes unexpected panic during installation and
DIAGNOSTIC pool assertions.
Also fix bp-b_flags in writedisklabel(9) error path.
The problem was reported from Y.Sugahara during XM6i development,
and this fix is confirmed on both X68030 (by me) and XM6i (by Sugahara).
XXX: broken dkbad support (which makes struct cpu_disklabel larger
XXX: than 512 bytes) should be removed...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.20.1 src/sys/arch/x68k/x68k/disksubr.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/x68k/x68k/disksubr.c
diff -u src/sys/arch/x68k/x68k/disksubr.c:1.33 src/sys/arch/x68k/x68k/disksubr.c:1.33.20.1
--- src/sys/arch/x68k/x68k/disksubr.c:1.33	Wed Jan  2 11:48:32 2008
+++ src/sys/arch/x68k/x68k/disksubr.c	Fri May 20 19:32:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.33 2008/01/02 11:48:32 ad Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.33.20.1 2011/05/20 19:32:44 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.33 2008/01/02 11:48:32 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.33.20.1 2011/05/20 19:32:44 bouyer Exp $);
 
 #include opt_compat_netbsd.h
 
@@ -69,7 +69,7 @@
 	struct buf *bp;
 	struct disklabel *dlp;
 	const char *msg = NULL;
-	int i, labelsz;
+	int i, bsdlabelsz, humanlabelsz;
 
 	if (osdep)
 		dp = osdep-dosparts;
@@ -90,15 +90,19 @@
 	lp-d_partitions[0].p_offset = 0;
 
 	/* get a buffer and initialize it */
-	bp = geteblk((int)lp-d_secsize);
+	bsdlabelsz =
+	howmany(LABELOFFSET + sizeof(struct disklabel), lp-d_secsize)
+	* lp-d_secsize;
+	humanlabelsz =
+	howmany(sizeof(struct cpu_disklabel), lp-d_secsize)
+	* lp-d_secsize;
+	bp = geteblk(MAX(bsdlabelsz, humanlabelsz));
 	bp-b_dev = dev;
 
 	/* read BSD disklabel first */
 	bp-b_blkno = LABELSECTOR;
 	bp-b_cylinder = LABELSECTOR/lp-d_secpercyl;
-	labelsz = howmany(LABELOFFSET+sizeof(struct disklabel), lp-d_secsize)
-		* lp-d_secsize;
-	bp-b_bcount = labelsz;	/* to support  512B/sector disks */
+	bp-b_bcount = bsdlabelsz;	/* to support  512B/sector disks */
 	bp-b_flags |= B_READ;
 	(*strat)(bp);
 
@@ -109,7 +113,7 @@
 	}
 	for (dlp = (struct disklabel *)bp-b_data;
 	 dlp = (struct disklabel *)
-		((char *)bp-b_data + labelsz - sizeof(*dlp));
+		((char *)bp-b_data + bsdlabelsz - sizeof(*dlp));
 	 dlp = (struct disklabel *)((uint8_t *)dlp + sizeof(long))) {
 		if (dlp-d_magic != DISKMAGIC || dlp-d_magic2 != DISKMAGIC) {
 			if (msg == NULL)
@@ -135,9 +139,7 @@
 	bp-b_blkno = DOSPARTOFF * DEF_BSIZE / lp-d_secsize;
 /* DOSPARTOFF in DEV_BSIZE unit */
 	bp-b_cylinder = DOSBBSECTOR / lp-d_secpercyl;
-	labelsz = howmany(sizeof(struct cpu_disklabel),
-			  lp-d_secsize) * lp-d_secsize;
-	bp-b_bcount = labelsz;	/* to support  512B/sector disks */
+	bp-b_bcount = humanlabelsz;	/* to support  512B/sector disks */
 	bp-b_oflags = ~(BO_DONE);
 	(*strat)(bp);
 
@@ -313,7 +315,7 @@
 	struct dos_partition *dp = 0;
 	struct buf *bp;
 	struct disklabel *dlp;
-	int error, labelsz, i;
+	int error, bsdlabelsz, humanlabelsz, i;
 	const char *np;
 
 	if (osdep)
@@ -326,15 +328,19 @@
 		parttbl_consistency_check(lp, dp);
 
 	/* get a buffer and initialize it */
-	bp = geteblk((int)lp-d_secsize);
+	bsdlabelsz =
+	howmany(LABELOFFSET + sizeof(struct disklabel), lp-d_secsize)
+	* lp-d_secsize;
+	humanlabelsz =
+	howmany(sizeof(struct cpu_disklabel), lp-d_secsize)
+	* lp-d_secsize;
+	bp = geteblk(MAX(bsdlabelsz, humanlabelsz));
 	bp-b_dev = dev;
 
 	/* attempt to write BSD disklabel first */
 	bp-b_blkno = LABELSECTOR;
 	bp-b_cylinder = LABELSECTOR / lp-d_secpercyl;
-	labelsz = howmany(LABELOFFSET+sizeof(struct disklabel), lp-d_secsize)
-		* lp-d_secsize;
-	bp-b_bcount = labelsz;	/* to support  512B/sector disks */
+	bp-b_bcount = bsdlabelsz;	/* to support  512B/sector disks */
 	bp-b_flags |= B_READ;
 	(*strat)(bp);
 
@@ -344,7 +350,7 @@
 	error = ESRCH;
 	for (dlp = (struct disklabel *)bp-b_data;
 	 dlp = (struct disklabel *)
-		((char *)bp-b_data + labelsz - sizeof(*dlp));
+		((char *)bp-b_data + bsdlabelsz - sizeof(*dlp));
 	 dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
 		if (dlp-d_magic == DISKMAGIC  dlp-d_magic2 == DISKMAGIC 
 		dkcksum(dlp) == 0) {
@@ -370,6 +376,7 @@
 		bp-b_blkno = DOSBBSECTOR;
 		bp-b_bcount = lp-d_secsize;
 		bp-b_oflags = ~(BO_DONE);
+		bp-b_flags = ~(B_WRITE);
 		bp-b_flags |= B_READ;
 		bp-b_cylinder = DOSBBSECTOR / lp-d_secpercyl;
 		

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

2011-05-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 19 21:11:15 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by jym in ticket #1608):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.49
Separate xennet(4) backend initialization code (resume) from the part
that talks with Xenstore to query backend's information. Resuming is now
performed just after xennet(4) attachment instead of waiting for backend
to announce its features in Xenstore and change it state.
This fixes the race observed by Urban Boquist when the domU boots with
root on NFS.
FWIW, the boot code (when root is NFS-backed) can innit() the xennet(4)
interface very early: it tried to access ifnet structures that were not
yet allocated.
Will ask for a pullup. Thanks to Urban for reporting the issue and
investigate it. Confirmed fixed. No regression observed by me for
dynamic attach/detach of xvif(4) and xennet(4) interfaces.
See also http://mail-index.netbsd.org/port-xen/2011/04/18/msg006647.html


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.4 -r1.29.2.5 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.4 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.5
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.4	Sun Nov 21 23:55:58 2010
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu May 19 21:11:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.4 2010/11/21 23:55:58 riz Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.5 2011/05/19 21:11:15 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.4 2010/11/21 23:55:58 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.5 2011/05/19 21:11:15 bouyer Exp $);
 
 #include opt_xen.h
 #include opt_nfs_boot.h
@@ -203,6 +203,7 @@
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
 static int  xennet_handler(void *);
+static int  xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
 static void xennet_hex_dump(const unsigned char *, size_t, const char *, int);
 #endif
@@ -350,6 +351,9 @@
 	rnd_attach_source(sc-sc_rnd_source, device_xname(sc-sc_dev),
 	RND_TYPE_NET, 0);
 #endif
+
+	/* resume shared structures and tell backend that we are ready */
+	xennet_xenbus_resume(sc);
 }
 
 static int
@@ -410,13 +414,10 @@
 xennet_xenbus_resume(void *p)
 {
 	struct xennet_xenbus_softc *sc = p;
-	struct xenbus_transaction *xbt;
-	unsigned long rx_copy;
 	int error;
 	netif_tx_sring_t *tx_ring;
 	netif_rx_sring_t *rx_ring;
 	paddr_t ma;
-	const char *errmsg;
 
 	sc-sc_tx_ring_gntref = GRANT_INVALID_REF;
 	sc-sc_rx_ring_gntref = GRANT_INVALID_REF;
@@ -450,6 +451,17 @@
 	event_set_handler(sc-sc_evtchn, xennet_handler, sc,
 	IPL_NET, device_xname(sc-sc_dev));
 
+	return 0;
+}
+
+static int
+xennet_talk_to_backend(struct xennet_xenbus_softc *sc)
+{
+	int error;
+	unsigned long rx_copy;
+	struct xenbus_transaction *xbt;
+	const char *errmsg;
+
 	error = xenbus_read_ul(NULL, sc-sc_xbusd-xbusd_otherend,
 	feature-rx-copy, rx_copy, 10);
 	if (error)
@@ -529,7 +541,7 @@
 		xenbus_switch_state(sc-sc_xbusd, NULL, XenbusStateClosed);
 		break;
 	case XenbusStateInitWait:
-		if (xennet_xenbus_resume(sc) == 0)
+		if (xennet_talk_to_backend(sc) == 0)
 			xenbus_switch_state(sc-sc_xbusd, NULL,
 			XenbusStateConnected);
 		break;



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

2011-05-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May 19 21:13:07 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by jym in ticket #1609):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.50
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.43
Check that xvif(4) is not already connected before proceeding in the
XenbusStateConnected mode. Under rare occasions, the xenbus watcher
can fire multiple times, overwriting the I/O ring memory mappings with
invalid values. This will lead sooner or later to dom0 panic().
Will ask for pullup. FWIW, xbdback(4) is not affected.
Check status before proceeding further. Avoids spurious watch calls.


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.5 -r1.29.2.6 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.24.4.3 -r1.24.4.4 src/sys/arch/xen/xen/xennetback_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.5 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.6
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.5	Thu May 19 21:11:15 2011
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu May 19 21:13:07 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.5 2011/05/19 21:11:15 bouyer Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.6 2011/05/19 21:13:07 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.5 2011/05/19 21:11:15 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.6 2011/05/19 21:13:07 bouyer Exp $);
 
 #include opt_xen.h
 #include opt_nfs_boot.h
@@ -541,6 +541,8 @@
 		xenbus_switch_state(sc-sc_xbusd, NULL, XenbusStateClosed);
 		break;
 	case XenbusStateInitWait:
+		if (sc-sc_backend_status == BEST_CONNECTED)
+			break;
 		if (xennet_talk_to_backend(sc) == 0)
 			xenbus_switch_state(sc-sc_xbusd, NULL,
 			XenbusStateConnected);

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.3 src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.4
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.24.4.3	Sat Jan 30 19:14:20 2010
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Thu May 19 21:13:07 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.24.4.3 2010/01/30 19:14:20 snj Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.24.4.4 2011/05/19 21:13:07 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -444,6 +444,8 @@
 		break;
 
 	case XenbusStateConnected:
+		if (xneti-xni_status == CONNECTED)
+			break;
 		/* read comunication informations */
 		err = xenbus_read_ul(NULL, xbusd-xbusd_otherend,
 		tx-ring-ref, tx_ring_ref, 10);



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

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:16:51 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by cegger in ticket #1598):
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.30
Continue scanning for other frontends when initialization
of one frontend failed. Bug reported by Konrad Wilk on port-xen@.
Fix this for all error pathes within the loop.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.1 src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.1	Fri Jan 16 01:17:49 2009
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Sun Apr 24 16:16:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.26.2.1 2009/01/16 01:17:49 snj Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.1 2009/01/16 01:17:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -284,6 +284,7 @@
 		return err;
 
 	for (i = 0; i  dir_n; i++) {
+		err = 0;
 		/*
 		 * add size of path to size of xenbus_device. xenbus_device
 		 * already has room for one char in xbusd_path.



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

2011-04-24 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 24 16:20:22 UTC 2011

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

Log Message:
Pull up following revision(s) (requested by cegger in ticket #1599):
sys/arch/xen/xenbus/xenbus_probe.c: revision 1.31
previous fix does not work if there is exactly only one entry where continue
exits the loop.
Apply fix from Konrad Wilke on port-xen@
That makes NetBSD DomU boot on Linux Dom0 with xl.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.2 -r1.26.2.3 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2 src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.3
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.26.2.2	Sun Apr 24 16:16:51 2011
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Sun Apr 24 16:20:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.2 2011/04/24 16:16:51 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenbus_probe.c,v 1.26.2.3 2011/04/24 16:20:22 riz Exp $);
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -307,6 +307,7 @@
 			printf(xenbus: can't get state 
 			for %s (%d)\n, xbusd-xbusd_path, err);
 			free(xbusd, M_DEVBUF);
+			err = 0;
 			continue;
 		}
 		if (state != XenbusStateInitialising) {



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

2011-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Mar 20 21:23:32 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1570):
sys/arch/sparc64/dev/lom.c: revision 1.7
lom_refresh():
Update only the sensor status specified by the edata as noted in
sysmon_envsys(9).
lom_sysctl_alarm():
Update alarm status before reading via sysctl to make it usable at
a boot time.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.6 src/sys/arch/sparc64/dev/lom.c:1.1.2.7
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.6	Sun Mar 28 16:48:36 2010
+++ src/sys/arch/sparc64/dev/lom.c	Sun Mar 20 21:23:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $	*/
 /*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.7 2011/03/20 21:23:32 bouyer Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -217,6 +217,10 @@
 
 static int	lom_init_desc(struct lom_softc *);
 static void	lom_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	lom_refresh_alarm(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_fan(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_psu(struct lom_softc *, envsys_data_t *, uint32_t);
+static void	lom_refresh_temp(struct lom_softc *, envsys_data_t *, uint32_t);
 static void	lom1_write_hostname(struct lom_softc *);
 static void	lom2_write_hostname(struct lom_softc *);
 
@@ -947,88 +951,136 @@
 lom_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
 {
 	struct lom_softc *sc = sme-sme_cookie;
+	uint32_t i;
+
+	/* Sensor number */
+	i = edata-sensor;
+
+	/* Sensor type */
+	switch (edata-units) {
+	case ENVSYS_INDICATOR:
+		if (i  sc-sc_num_alarm)
+			lom_refresh_alarm(sc, edata, i);
+		else
+			lom_refresh_psu(sc, edata,
+			i - sc-sc_num_alarm - sc-sc_num_fan);
+		break;
+	case ENVSYS_SFANRPM:
+		lom_refresh_fan(sc, edata, i - sc-sc_num_alarm);
+		break;
+	case ENVSYS_STEMP:
+		lom_refresh_temp(sc, edata,
+		i - sc-sc_num_alarm - sc-sc_num_fan - sc-sc_num_psu);
+		break;
+	default:
+		edata-state = ENVSYS_SINVALID;
+		break;
+	}
+
+	/*
+	 * If our hostname is set and differs from what's stored in
+	 * the LOM, write the new hostname back to the LOM.  Note that
+	 * we include the terminating NUL when writing the hostname
+	 * back to the LOM, otherwise the LOM will print any trailing
+	 * garbage.
+	 */
+	if (i == 0  hostnamelen  0 
+	strncmp(sc-sc_hostname, hostname, sizeof(hostname)) != 0) {
+		if (sc-sc_type  LOM_LOMLITE2)
+			lom1_write_hostname(sc);
+		else
+			lom2_write_hostname(sc);
+		strlcpy(sc-sc_hostname, hostname, sizeof(hostname));
+	}
+}
+
+static void
+lom_refresh_alarm(struct lom_softc *sc, envsys_data_t *edata, uint32_t i)
+{
 	uint8_t val;
-	int i;
+
+	/* Fault LED or Alarms */
+	KASSERT(i  sc-sc_num_alarm);
 
 	if (lom_read(sc, LOM_IDX_ALARM, val)) {
-		for (i = 0; i  sc-sc_num_alarm; i++)
-			sc-sc_alarm[i].state = ENVSYS_SINVALID;
+		edata-state = ENVSYS_SINVALID;
 	} else {
-		/* Fault LED */
-		if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
-			sc-sc_alarm[0].value_cur = 0;
-		else
-			sc-sc_alarm[0].value_cur = 1;
-		sc-sc_alarm[0].state = ENVSYS_SVALID;
-
-		/* Alarms */
-		for (i = 1; i  sc-sc_num_alarm; i++) {
+		if (i == 0) {
+			/* Fault LED */
+			if ((val  LOM_ALARM_FAULT) == LOM_ALARM_FAULT)
+edata-value_cur = 0;
+			else
+edata-value_cur = 1;
+		} else {
+			/* Alarms */
 			if ((val  (LOM_ALARM_1  (i - 1))) == 0)
-sc-sc_alarm[i].value_cur = 0;
+edata-value_cur = 0;
 			else
-sc-sc_alarm[i].value_cur = 1;
-			sc-sc_alarm[i].state = ENVSYS_SVALID;
+edata-value_cur = 1;
 		}
+		edata-state = ENVSYS_SVALID;
 	}
+}
 
-	for (i = 0; i  sc-sc_num_fan; i++) {
-		if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
-			sc-sc_fan[i].state = ENVSYS_SINVALID;
-			continue;
-		}
+static void
+lom_refresh_fan(struct lom_softc *sc, envsys_data_t *edata, uint32_t i)
+{
+	uint8_t val;
+
+	/* Fan speed */
+	KASSERT(i  sc-sc_num_fan);
 
-		sc-sc_fan[i].value_cur = (60 * sc-sc_fan_cal[i] * val) / 100;
+	if (lom_read(sc, LOM_IDX_FAN1 + i, val)) {
+		edata-state = ENVSYS_SINVALID;
+	} else {
+		edata-value_cur = (60 * sc-sc_fan_cal[i] * val) / 100;
 		if (val  sc-sc_fan_low[i])
-			sc-sc_fan[i].state = ENVSYS_SCRITICAL;
+			edata-state = ENVSYS_SCRITICAL;
 		else
-			sc-sc_fan[i].state = ENVSYS_SVALID;
+			edata-state = ENVSYS_SVALID;
 	}
+}

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

2011-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Mar 20 21:31:33 UTC 2011

Modified Files:
src/sys/arch/mips/mips [netbsd-5]: fp.S

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1572):
sys/arch/mips/mips/fp.S: revision 1.40 via patch
Fix cvt.d.s per analysis by Marcus Comstedt in PR port-mips/36251.
Confirmed on ews4800mips.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.30.1 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.33 src/sys/arch/mips/mips/fp.S:1.33.30.1
--- src/sys/arch/mips/mips/fp.S:1.33	Wed Oct 17 19:55:37 2007
+++ src/sys/arch/mips/mips/fp.S	Sun Mar 20 21:31:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.33 2007/10/17 19:55:37 garbled Exp $	*/
+/*	$NetBSD: fp.S,v 1.33.30.1 2011/03/20 21:31:32 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1619,6 +1619,8 @@
 	beq	t2, zero, result_fs_d		# is FS zero?
 	jal	_C_LABEL(renorm_fs_s)
 	move	t8, zero
+	sll	t3, t2, 32 - 3			# convert S fraction to D
+	srl	t2, t2, 3
 	b	norm_d
 2:
 	addu	t1, t1, DEXP_BIAS - SEXP_BIAS	# bias exponent correctly



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

2011-03-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Mar  8 17:29:46 UTC 2011

Modified Files:
src/sys/arch/sparc/dev [netbsd-5]: zs.c
src/sys/arch/sparc/include [netbsd-5]: cpu.h z8530var.h
src/sys/arch/sparc/sparc [netbsd-5]: cpu.c cpuvar.h db_interface.c
genassym.cf intr.c locore.s machdep.c timer.c timer_sun4m.c
timervar.h trap.c vm_machdep.c

Log Message:
Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c:patch
sys/arch/sparc/include/cpu.h:   patch
sys/arch/sparc/include/z8530var.h:  patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h:  patch
sys/arch/sparc/sparc/db_interface.c:patch
sys/arch/sparc/sparc/genassym.cf:   patch
sys/arch/sparc/sparc/intr.c:patch
sys/arch/sparc/sparc/locore.s:  patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c:   patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h:patch
sys/arch/sparc/sparc/trap.c:patch
sys/arch/sparc/sparc/vm_machdep.c:  patch

- fix a panic in savefpstate.  idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED.  the old spl/simple_lock code ran at
  splsched(), and this significantly helps with stability under load when
  running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
  soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command mach xcall
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
  make sure we have space for %g2...%g5.  now entering ddb via eg,
  serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs


To generate a diff of this commit:
cvs rdiff -u -r1.111.6.3 -r1.111.6.4 src/sys/arch/sparc/dev/zs.c
cvs rdiff -u -r1.84.14.1 -r1.84.14.2 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.9 -r1.9.14.1 src/sys/arch/sparc/include/z8530var.h
cvs rdiff -u -r1.211.8.4 -r1.211.8.5 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.75.10.4 -r1.75.10.5 src/sys/arch/sparc/sparc/cpuvar.h
cvs rdiff -u -r1.79.4.2 -r1.79.4.3 src/sys/arch/sparc/sparc/db_interface.c
cvs rdiff -u -r1.56.4.1 -r1.56.4.2 src/sys/arch/sparc/sparc/genassym.cf
cvs rdiff -u -r1.100.20.2 -r1.100.20.3 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.244.8.3 -r1.244.8.4 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.282.4.3 -r1.282.4.4 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.16.56.2 -r1.16.56.3 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.8 -r1.8.74.1 src/sys/arch/sparc/sparc/timervar.h
cvs rdiff -u -r1.176 -r1.176.4.1 src/sys/arch/sparc/sparc/trap.c
cvs rdiff -u -r1.95.4.2 -r1.95.4.3 src/sys/arch/sparc/sparc/vm_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/sparc/dev/zs.c
diff -u src/sys/arch/sparc/dev/zs.c:1.111.6.3 src/sys/arch/sparc/dev/zs.c:1.111.6.4
--- src/sys/arch/sparc/dev/zs.c:1.111.6.3	Sun Jan 16 12:54:42 2011
+++ src/sys/arch/sparc/dev/zs.c	Tue Mar  8 17:29:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.111.6.3 2011/01/16 12:54:42 bouyer Exp $	*/
+/*	$NetBSD: zs.c,v 1.111.6.4 2011/03/08 17:29:45 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.111.6.3 2011/01/16 12:54:42 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: zs.c,v 1.111.6.4 2011/03/08 17:29:45 riz Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -171,12 +171,8 @@
 
 extern struct cfdriver zs_cd;
 
-/* softintr(9) cookie, shared by all instances of this driver */
-static void *zs_sicookie;
-
 /* Interrupt handlers. */
 static int zshard(void *);
-static void zssoft(void *);
 
 static int zs_get_speed(struct zs_chanstate *);
 
@@ -396,7 +392,6 @@
 	struct zsc_attach_args zsc_args;
 	struct zs_chanstate *cs;
 	int channel;
-	static int didintr, prevpri;
 #if (NKBD  0) || (NMS  0)
 	int ch0_is_cons = 0;
 #endif
@@ -407,12 +402,11 @@
 		return;
 	}
 
-	if (!didintr) {
-		zs_sicookie = softint_establish(SOFTINT_SERIAL, zssoft, NULL);
-		if (zs_sicookie == NULL) {
-			aprint_error(: cannot establish soft int handler\n);
-			return;
-		}
+	zsc-zsc_sicookie = softint_establish(SOFTINT_SERIAL,
+	(void (*)(void *))zsc_intr_soft, zsc);
+	if (zsc-zsc_sicookie == NULL) {
+		aprint_error(: 

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

2011-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 16 20:54:13 UTC 2011

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: mtrr_i686.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1547):
sys/arch/x86/x86/mtrr_i686.c: revisions 1.23, 1.24
allows overlapping uncached and cached mappings
corrects an off-by-one which prevents adjacent mappings from being setup.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/arch/x86/x86/mtrr_i686.c

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

Modified files:

Index: src/sys/arch/x86/x86/mtrr_i686.c
diff -u src/sys/arch/x86/x86/mtrr_i686.c:1.19 src/sys/arch/x86/x86/mtrr_i686.c:1.19.4.1
--- src/sys/arch/x86/x86/mtrr_i686.c:1.19	Mon Oct 13 10:27:10 2008
+++ src/sys/arch/x86/x86/mtrr_i686.c	Wed Feb 16 20:54:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtrr_i686.c,v 1.19 2008/10/13 10:27:10 sborrill Exp $ */
+/*	$NetBSD: mtrr_i686.c,v 1.19.4.1 2011/02/16 20:54:13 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mtrr_i686.c,v 1.19 2008/10/13 10:27:10 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: mtrr_i686.c,v 1.19.4.1 2011/02/16 20:54:13 bouyer Exp $);
 
 #include opt_multiprocessor.h
 
@@ -64,7 +64,7 @@
 static void i686_raw2soft(void);
 static void i686_mtrr_commit(void);
 static int i686_mtrr_setone(struct mtrr *, struct proc *p);
-
+static int i686_mtrr_conflict(uint8_t, uint8_t);
 
 static struct mtrr_state
 mtrr_raw[] = {
@@ -482,6 +482,14 @@
 	|| mtrrp-type  MTRR_TYPE_WB)  (mtrrp-flags  MTRR_VALID))
 		return EINVAL;
 
+	/* 
+	 * If write-combining is requested, make sure that the WC feature   
+	 * is supported by the processor.
+	 */
+	if (mtrrp-type == MTRR_TYPE_WC 
+	!(i686_mtrr_cap  MTRR_I686_CAP_WC_MASK))
+		return ENODEV;
+
 	/*
 	 * Only use fixed ranges  1M.
 	 */
@@ -605,7 +613,7 @@
 	 * XXX could be more sophisticated here by merging ranges.
 	 */
 	low = mtrrp-base;
-	high = low + mtrrp-len;
+	high = low + mtrrp-len - 1;
 	freep = NULL;
 	for (i = 0; i  i686_mtrr_vcnt; i++) {
 		if (!(mtrr_var[i].flags  MTRR_VALID)) {
@@ -613,7 +621,7 @@
 			continue;
 		}
 		curlow = mtrr_var[i].base;
-		curhigh = curlow + mtrr_var[i].len;
+		curhigh = curlow + mtrr_var[i].len - 1;
 		if (low == curlow  high == curhigh 
 		(!(mtrr_var[i].flags  MTRR_PRIVATE) ||
 		 ((mtrrp-flags  MTRR_PRIVATE)  (p != NULL) 
@@ -623,7 +631,7 @@
 		}
 		if (((high = curlow  high  curhigh) ||
 		(low = curlow  low  curhigh)) 
-	 	((mtrr_var[i].type != mtrrp-type) ||
+	 	(i686_mtrr_conflict(mtrr_var[i].type, mtrrp-type) ||
 		 ((mtrr_var[i].flags  MTRR_PRIVATE) 
  		  (!(mtrrp-flags  MTRR_PRIVATE) || (p == NULL) ||
 		   (mtrr_var[i].owner != p-p_pid) {
@@ -639,6 +647,17 @@
 	return 0;
 }
 
+static int
+i686_mtrr_conflict(uint8_t type1, uint8_t type2)
+{
+	if (type1 == MTRR_TYPE_UC || type2 == MTRR_TYPE_UC)
+		return 0;
+	if ((type1 == MTRR_TYPE_WT  type2 == MTRR_TYPE_WB) ||
+	(type1 == MTRR_TYPE_WB  type2 == MTRR_TYPE_WT))
+		return 0;
+	return 1;
+}
+
 static void
 i686_mtrr_clean(struct proc *p)
 {



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

2011-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 16 21:16:14 UTC 2011

Modified Files:
src/sys/arch/powerpc/powerpc [netbsd-5]: sig_machdep.c

Log Message:
Pull up following revision(s) (requested by jmmv in ticket #1551):
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.39 via patch
PR port-macppc/43619
Save handler before calling sendsig_reset before it will reset to SIG_DFL
is SA_RESETHAND is set.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.12.1 src/sys/arch/powerpc/powerpc/sig_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/powerpc/powerpc/sig_machdep.c
diff -u src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32 src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32.12.1
--- src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32	Thu Apr 24 18:39:21 2008
+++ src/sys/arch/powerpc/powerpc/sig_machdep.c	Wed Feb 16 21:16:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.32 2008/04/24 18:39:21 ad Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.32.12.1 2011/02/16 21:16:13 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sig_machdep.c,v 1.32 2008/04/24 18:39:21 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: sig_machdep.c,v 1.32.12.1 2011/02/16 21:16:13 bouyer Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_ppcarch.h
@@ -58,9 +58,11 @@
 	struct lwp * const l = curlwp;
 	struct proc * const p = l-l_proc;
 	struct trapframe * const tf = trapframe(l);
-	struct sigaltstack *ss = l-l_sigstk;
-	const struct sigact_sigdesc *sd =
+	struct sigaltstack * const ss = l-l_sigstk;
+	const struct sigact_sigdesc * const sd =
 	p-p_sigacts-sa_sigdesc[ksi-ksi_signo];
+	/* save handler before sendsig_reset trashes it! */
+	const void * const handler = sd-sd_sigact.sa_handler;
 	ucontext_t uc;
 	vaddr_t sp, sip, ucp;
 	int onstack, error;
@@ -130,7 +132,7 @@
 		/* Preserve ucp across call to signal function */
 		tf-fixreg[30] = (register_t)ucp;
 		tf-lr = (register_t)sd-sd_tramp;
-		tf-srr0   = (register_t)sd-sd_sigact.sa_handler;
+		tf-srr0   = (register_t)handler;
 		break;
 
 	default:



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

2011-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 16 21:21:21 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: psycho.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1555):
sys/arch/sparc64/dev/psycho.c: revision 1.102 via patch
Don't enable the powerfail interrupt on Netra X1 since it may hang.
Discussed on port-sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.4.1 src/sys/arch/sparc64/dev/psycho.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/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.91 src/sys/arch/sparc64/dev/psycho.c:1.91.4.1
--- src/sys/arch/sparc64/dev/psycho.c:1.91	Sat Oct 18 03:31:10 2008
+++ src/sys/arch/sparc64/dev/psycho.c	Wed Feb 16 21:21:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.91 2008/10/18 03:31:10 nakayama Exp $	*/
+/*	$NetBSD: psycho.c,v 1.91.4.1 2011/02/16 21:21:21 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.91 2008/10/18 03:31:10 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.91.4.1 2011/02/16 21:21:21 bouyer Exp $);
 
 #include opt_ddb.h
 
@@ -288,6 +288,7 @@
 	int psycho_br[2], n, i;
 	bus_space_handle_t pci_ctl;
 	char *model = prom_getpropstring(ma-ma_node, model);
+	extern char machine_model[];
 
 	aprint_normal(\n);
 
@@ -519,10 +520,15 @@
 		psycho_set_intr(sc, 15, psycho_bus_a,
 			sc-sc_regs-pciaerr_int_map, 
 			sc-sc_regs-pciaerr_clr_int);
-		psycho_set_intr(sc, 15, psycho_powerfail,
-			sc-sc_regs-power_int_map, 
-			sc-sc_regs-power_clr_int);
-		psycho_register_power_button(sc);
+		/*
+		 * Netra X1 may hang when the powerfail interrupt is enabled.
+		 */
+		if (strcmp(machine_model, SUNW,UltraAX-i2) != 0) {
+			psycho_set_intr(sc, 15, psycho_powerfail,
+sc-sc_regs-power_int_map,
+sc-sc_regs-power_clr_int);
+			psycho_register_power_button(sc);
+		}
 		if (sc-sc_mode != PSYCHO_MODE_SABRE) {
 			/* sabre doesn't have these interrupts */
 			psycho_set_intr(sc, 15, psycho_bus_b,



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

2011-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 16 21:33:25 UTC 2011

Modified Files:
src/sys/arch/sparc/sparc [netbsd-5]: cpu.c cpuvar.h pmap.c
timer_sun4m.c

Log Message:
Apply patch, requested my mrg in ticket 1553:
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h:  patch
sys/arch/sparc/sparc/pmap.c:patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
- print the curpcb in ddb mach cpu output as well.
- bump the size of cpus[] by one, so we have a NULL pointer at the end,
  from tsutsui
- for MP kernels, copy the loop to find the bootcpu in mainbus_attach()
  into getcacheinfo_obp() so we can get cache properties on the bootcpu
  before calling main()
- in getcpuinfo(), move the call of getmid() before the call to
  getcacheinfo() so that the above change to getcacheinfo_obp() can work
- move the struct cpu_info setup to the end of the initial kernel page
  setup and don't access this space until after we have switched to the
  kernel pagetables
- revive most of the old CPUINFO_VA alignment/congruency code from the
  old alloc_cpuinfo_global_va() function, and ensure that all cpuinfo
  structures are sanely aligned.  this makes hypersparc work again
- introduce a new way to free the wasted pages back to UVM, as we can't
  simply uvm_unmap() them this early in bootstrap
- make sure to initialise the cpuinfo sz in all cases.  noted by martin.
- add per-cpu event counters for lev10 and lev14 interrupts.
- make CPU_INFO_FOREACH() set the iterator count to '0' in the !MP case.
- add some disabled MP code to poke other cpus on level 14 interrupts.
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info-ci_self
- if a cpu doesn't have any mappings allocated, don't copy them.  this
  occurs if a cpu isn't attached (such as a MP kernel with only cpu0
  listed in the config file..)
- fix the previous to compile !MULTIPROCESSOR.


To generate a diff of this commit:
cvs rdiff -u -r1.211.8.3 -r1.211.8.4 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.75.10.3 -r1.75.10.4 src/sys/arch/sparc/sparc/cpuvar.h
cvs rdiff -u -r1.322.20.4 -r1.322.20.5 src/sys/arch/sparc/sparc/pmap.c
cvs rdiff -u -r1.16.56.1 -r1.16.56.2 src/sys/arch/sparc/sparc/timer_sun4m.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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.211.8.3 src/sys/arch/sparc/sparc/cpu.c:1.211.8.4
--- src/sys/arch/sparc/sparc/cpu.c:1.211.8.3	Fri Jan 28 07:16:13 2011
+++ src/sys/arch/sparc/sparc/cpu.c	Wed Feb 16 21:33:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.211.8.3 2011/01/28 07:16:13 snj Exp $ */
+/*	$NetBSD: cpu.c,v 1.211.8.4 2011/02/16 21:33:25 bouyer Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.3 2011/01/28 07:16:13 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.4 2011/02/16 21:33:25 bouyer Exp $);
 
 #include opt_multiprocessor.h
 #include opt_lockdebug.h
@@ -102,7 +102,7 @@
 extern char machine_model[];
 
 int	sparc_ncpus;			/* # of CPUs detected by PROM */
-struct cpu_info *cpus[_MAXNCPU];	/* we only support 4 CPUs. */
+struct cpu_info *cpus[_MAXNCPU+1];	/* we only support 4 CPUs. */
 
 /* The CPU configuration driver. */
 static void cpu_mainbus_attach(struct device *, struct device *, void *);
@@ -424,7 +424,7 @@
 	}
 
 	/*
-	 * Note: `eintstack' is set in init_cpuinfo() above.
+	 * Note: `eintstack' is set in cpu_attach_non_boot() above.
 	 * The %wim register will be initialized in cpu_hatch().
 	 */
 	cpi-ci_curlwp = cpi-ci_data.cpu_idlelwp;
@@ -1123,6 +1123,35 @@
 	struct cacheinfo *ci = sc-cacheinfo;
 	int i, l;
 
+#if defined(MULTIPROCESSOR)
+	/*
+	 * We really really want the cache info early for MP systems,
+	 * so figure out the boot node, if we can.
+	 *
+	 * XXX this loop stolen from mainbus_attach()
+	 */
+	if (node == 0  CPU_ISSUN4M  bootmid != 0) {
+		const char *cp;
+		char namebuf[32];
+		int mid, node2;
+
+		for (node2 = firstchild(findroot());
+		 node2;
+		 node2 = nextsibling(node2)) {
+			cp = prom_getpropstringA(node2, device_type,
+	namebuf, sizeof namebuf);
+			if (strcmp(cp, cpu) != 0)
+continue;
+
+			mid = prom_getpropint(node2, mid, -1);
+			if (mid == bootmid) {
+node = node2;
+break;
+			}
+		}
+	}
+#endif
+
 	if (node == 0)
 		/* Bootstrapping */
 		return;
@@ -1862,6 +1891,9 @@
 		if (sc-cacheinfo.c_vactype == VAC_UNKNOWN)
 			sc-cacheinfo.c_vactype = mp-minfo-vactype;
 
+		if (sc-master  mp-minfo-getmid != NULL)
+			bootmid = mp-minfo-getmid();
+
 		mp-minfo-getcacheinfo(sc, node);
 
 		if (node  sc-hz == 0  !CPU_ISSUN4/*XXX*/) {
@@ -1875,9 +1907,6 @@
 			}
 		}
 
-		if (sc-master  mp-minfo-getmid != NULL)
-			bootmid = mp-minfo-getmid();
-
 		/*
 		 * Copy CPU/MMU/Cache specific routines into cpu_info.
 		 */
@@ -2015,16 +2044,17 @@
 	struct 

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

2011-01-27 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jan 28 07:16:14 UTC 2011

Modified Files:
src/sys/arch/sparc/sparc [netbsd-5]: cpu.c cpuvar.h genassym.cf intr.c
locore.s pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1532):
sys/arch/sparc/sparc/cpu.c: revision 1.215 via patch
sys/arch/sparc/sparc/cpuvar.h: revision 1.78 via patch
sys/arch/sparc/sparc/genassym.cf: revision 1.57 via patch
sys/arch/sparc/sparc/intr.c: revision 1.103-1.105 via patch
sys/arch/sparc/sparc/locore.s: revision 1.247, 1.250 via patch
sys/arch/sparc/sparc/pmap.c: revision 1.329 via patch

- print the cpu_number() when we get a strayintr().

- use _MAXNCPU instead of 4
- convert xpmsg_lock from a simplelock to a kmutex
- don't wait for sparc_noop IPI calls
- remove xmpsg_func's retval parameter and usage
- remove the IPI at high IPL message
- rework cpu_attach() a bunch, refactoring calls to getcpuinfo() and setting
 of cpi, and split most of the non-boot CPU handling into a new function
- make CPU_INFO_FOREACH() work whether modular or not
- move the MP cpu_info pages earlier
- move a few things in cpu.c around to colsolidate the MP code together
- remove useless if (cpus == NULL) tests -- cpus is an array now

with these changes, and an additional change to crazyintr() to not printf(),
i can get to single user shell on my SS20 again.  i can run a few commands
but some of them cause hangs.  ps auxw works, but top -b does not.

convert sparc intrcnt counters to evcnt(9) style.  XXX some of the names
could be better, but i just copied them from the old intrnames in locore.

i benchmarked this with a simple test of ircii ./configure  make, to see
if the additional load/store  arith would cause any noticeable degradation
as the change also converts 32 bit counters to 64 bits.  amusingly, the
only trend i saw in this was that for both portions, i see a consistent
(across at least 8 runs) benefit of about 0.8% improvement.  ie, the newer
larger code size / counter size code actually runs faster for some reason..
maybe there's a cacheline effect in the size of the code?

XXX the current implementation depends on a couple of things:
XXX   - ev_count member of evcnt{} is first and has offset 0
XXX   - that sizeof(struct evcnt) equals 32
XXX if these are not true, locore.s has #error's to catch it

- remove unused ft_want_ast()
- give nmi_sun* ENTRY() points so they show up in symbols properly
- add some disabled code to use this cpu's idlelwp area when hatching
 a cpu, but right now it makes this worse not better...


To generate a diff of this commit:
cvs rdiff -u -r1.211.8.2 -r1.211.8.3 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.75.10.2 -r1.75.10.3 src/sys/arch/sparc/sparc/cpuvar.h
cvs rdiff -u -r1.56 -r1.56.4.1 src/sys/arch/sparc/sparc/genassym.cf
cvs rdiff -u -r1.100.20.1 -r1.100.20.2 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.244.8.2 -r1.244.8.3 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.322.20.3 -r1.322.20.4 src/sys/arch/sparc/sparc/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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.211.8.2 src/sys/arch/sparc/sparc/cpu.c:1.211.8.3
--- src/sys/arch/sparc/sparc/cpu.c:1.211.8.2	Sun Jan 16 12:58:23 2011
+++ src/sys/arch/sparc/sparc/cpu.c	Fri Jan 28 07:16:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.211.8.2 2011/01/16 12:58:23 bouyer Exp $ */
+/*	$NetBSD: cpu.c,v 1.211.8.3 2011/01/28 07:16:13 snj Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.2 2011/01/16 12:58:23 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.3 2011/01/28 07:16:13 snj Exp $);
 
 #include opt_multiprocessor.h
 #include opt_lockdebug.h
@@ -102,10 +102,7 @@
 extern char machine_model[];
 
 int	sparc_ncpus;			/* # of CPUs detected by PROM */
-#ifdef MULTIPROCESSOR
-struct cpu_info *cpus[4];		/* we only support 4 CPUs. */
-u_int	cpu_ready_mask;			/* the set of CPUs marked as READY */
-#endif
+struct cpu_info *cpus[_MAXNCPU];	/* we only support 4 CPUs. */
 
 /* The CPU configuration driver. */
 static void cpu_mainbus_attach(struct device *, struct device *, void *);
@@ -136,43 +133,6 @@
 #define SRMMU_VERS(mmusr)	(((mmusr)  24)  0xf)
 
 int bootmid;		/* Module ID of boot CPU */
-#if defined(MULTIPROCESSOR)
-void cpu_spinup(struct cpu_info *);
-static void init_cpuinfo(struct cpu_info *, int);
-
-int go_smp_cpus = 0;	/* non-primary CPUs wait for this to go */
-
-/* lock this to send IPI's */
-struct simplelock xpmsg_lock = SIMPLELOCK_INITIALIZER;
-
-static void
-init_cpuinfo(struct cpu_info *cpi, int node)
-{
-	vaddr_t intstack, va;
-
-	/*
-	 * Finish initialising this cpu_info.
-	 */
-	getcpuinfo(cpi, node);
-
-	/*
-	 * Arrange interrupt stack.  This cpu will also abuse the bottom
-	 * half 

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

2011-01-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 16 12:45:30 UTC 2011

Modified Files:
src/sys/arch/amiga/include [netbsd-5]: vmparam.h

Log Message:
Pull up following revision(s) (requested by mhitch in ticket #1518):
sys/arch/amiga/include/vmparam.h: revision 1.41
Raise address of user stack to the highest safe (for 68040 mmu) address,
which increases available user address space by 256MB.  One file in
pkgsrc/lang/php53 was too large for the amiga.  Also remove an old
presumably outdated comment.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.30.1 src/sys/arch/amiga/include/vmparam.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/amiga/include/vmparam.h
diff -u src/sys/arch/amiga/include/vmparam.h:1.36 src/sys/arch/amiga/include/vmparam.h:1.36.30.1
--- src/sys/arch/amiga/include/vmparam.h:1.36	Wed Oct 17 19:53:26 2007
+++ src/sys/arch/amiga/include/vmparam.h	Sun Jan 16 12:45:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.36 2007/10/17 19:53:26 garbled Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.36.30.1 2011/01/16 12:45:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -98,9 +98,8 @@
  * These are a mixture of i386, sun3 and hp settings.. 
  */
 
-/* Sun settings. Still hope, that I might get sun3 binaries to work... */
 #ifndef USRSTACK
-#define	USRSTACK	0x0E00
+#define	USRSTACK	0x1E00
 #endif
 #define KUSER_AREA	(-UPAGES*PAGE_SIZE)
 /*



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

2011-01-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 16 12:58:24 UTC 2011

Modified Files:
src/sys/arch/sparc/sparc [netbsd-5]: cpu.c cpuvar.h db_interface.c
locore.s pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1527):
sys/arch/sparc/sparc/pmap.c: revision 1.327, 1.328
sys/arch/sparc/sparc/cpuvar.h: revision 1.77
sys/arch/sparc/sparc/locore.s: revision 1.245
sys/arch/sparc/sparc/cpu.c: revision 1.214
sys/arch/sparc/sparc/db_interface.c: revision 1.84
- retire union cpu_info_pg
- allocate space for each cpu_info{} in pmap_bootstrap
- remap cpu0's space into the PA currently in CPUINFO_VA
- cpus[] becomes an array of pointers to cpu_info{}, easy to traverse
- only call kernel lock for IPL_VM interrupts (?  as implemented on
  x86 and sparc64)
- revert a minor part of locore.s:1.241
- in cpu_hatch(), set %sp to near the middle of the interrupt stack.
  we only need a %sp until we get to run an MI thread (own idlelwp or
  real code)
we still waste one page of space, but this gets SMP much closer to
actually working again.
fix a LOCKDEBUG problem from the previous: need to call pmap_kremove()
on a pre-existing mapping, before installing a new one.


To generate a diff of this commit:
cvs rdiff -u -r1.211.8.1 -r1.211.8.2 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.75.10.1 -r1.75.10.2 src/sys/arch/sparc/sparc/cpuvar.h
cvs rdiff -u -r1.79.4.1 -r1.79.4.2 src/sys/arch/sparc/sparc/db_interface.c
cvs rdiff -u -r1.244.8.1 -r1.244.8.2 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.322.20.2 -r1.322.20.3 src/sys/arch/sparc/sparc/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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.211.8.1 src/sys/arch/sparc/sparc/cpu.c:1.211.8.2
--- src/sys/arch/sparc/sparc/cpu.c:1.211.8.1	Sat May 30 16:57:18 2009
+++ src/sys/arch/sparc/sparc/cpu.c	Sun Jan 16 12:58:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.211.8.1 2009/05/30 16:57:18 snj Exp $ */
+/*	$NetBSD: cpu.c,v 1.211.8.2 2011/01/16 12:58:23 bouyer Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.1 2009/05/30 16:57:18 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.211.8.2 2011/01/16 12:58:23 bouyer Exp $);
 
 #include opt_multiprocessor.h
 #include opt_lockdebug.h
@@ -103,7 +103,7 @@
 
 int	sparc_ncpus;			/* # of CPUs detected by PROM */
 #ifdef MULTIPROCESSOR
-union cpu_info_pg *cpus;
+struct cpu_info *cpus[4];		/* we only support 4 CPUs. */
 u_int	cpu_ready_mask;			/* the set of CPUs marked as READY */
 #endif
 
@@ -156,10 +156,10 @@
 	getcpuinfo(cpi, node);
 
 	/*
-	 * Arrange pcb and interrupt stack.
+	 * Arrange interrupt stack.  This cpu will also abuse the bottom
+	 * half of the interrupt stack before it gets to run its idle LWP.
 	 */
-	intstack = uvm_km_alloc(kernel_map, INT_STACK_SIZE,
-		0, UVM_KMF_WIRED);
+	intstack = uvm_km_alloc(kernel_map, INT_STACK_SIZE, 0, UVM_KMF_WIRED);
 	if (intstack == 0)
 		panic(%s: no uspace/intstack, __func__);
 	cpi-eintstack = (void*)(intstack + INT_STACK_SIZE);
@@ -339,7 +339,7 @@
 		getcpuinfo(cpuinfo, node);
 
 #if defined(MULTIPROCESSOR)
-		cpi = sc-sc_cpuinfo = cpuinfo.ci_self;
+		cpi = sc-sc_cpuinfo = cpus[idx];
 #else
 		/* The `local' VA is global for uniprocessor. */
 		cpi = sc-sc_cpuinfo = (struct cpu_info *)CPUINFO_VA;
@@ -362,7 +362,7 @@
 		/*
 		 * Initialise this cpu's cpu_info.
 		 */
-		cpi = sc-sc_cpuinfo = cpus[idx].ci;
+		cpi = sc-sc_cpuinfo = cpus[idx];
 		init_cpuinfo(cpi, node);
 
 		/*

Index: src/sys/arch/sparc/sparc/cpuvar.h
diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.75.10.1 src/sys/arch/sparc/sparc/cpuvar.h:1.75.10.2
--- src/sys/arch/sparc/sparc/cpuvar.h:1.75.10.1	Sat May 30 16:57:18 2009
+++ src/sys/arch/sparc/sparc/cpuvar.h	Sun Jan 16 12:58:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.75.10.1 2009/05/30 16:57:18 snj Exp $ */
+/*	$NetBSD: cpuvar.h,v 1.75.10.2 2011/01/16 12:58:23 bouyer Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -416,7 +416,7 @@
 
 #define CPU_INFO_ITERATOR		int
 #ifdef MULTIPROCESSOR
-#define CPU_INFO_FOREACH(cii, cp)	cii = 0; cp = cpus[cii].ci, cii  sparc_ncpus; cii++
+#define CPU_INFO_FOREACH(cii, cp)	cii = 0; cp = cpus[cii], cii  sparc_ncpus; cii++
 #else
 #define	CPU_INFO_FOREACH(cii, cp)	(void)cii, cp = curcpu(); cp != NULL; cp = NULL
 #endif
@@ -473,11 +473,7 @@
 #define CPU_MID2CPUNO(mid)		((mid) != 0 ? (mid) - 8 : 0)
 
 #ifdef MULTIPROCESSOR
-union cpu_info_pg {
-	struct cpu_info ci;	/* cpu info (aliased (per cpu) to CPUINFO_VA */
-	char pad[32 * 1024];	/* XXX: force 32K alignment for now */
-};/* SMP capable cpu types */
-extern union cpu_info_pg *cpus;
+extern struct cpu_info *cpus[];
 extern u_int cpu_ready_mask;		/* the set of CPUs marked as READY */
 #endif
 

Index: 

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

2011-01-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jan  7 01:01:44 UTC 2011

Modified Files:
src/sys/arch/vax/include [netbsd-5]: clock.h
src/sys/arch/vax/vax [netbsd-5]: clock.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1500):
sys/arch/vax/vax/clock.c: revision 1.54
sys/arch/vax/include/clock.h: revision 1.8
Correct definition of leap year.  Make yeartonum and numtoyear use
full years so that year 2000 is correctly counted as a leap year.
Now NetBSD under SIMH picks up correct time-of-day clock value.  It
used to be a day behind, since 2000 - 1900 = 100 and naive leap year
test wouldn't count it as a leap year.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.70.1 src/sys/arch/vax/include/clock.h
cvs rdiff -u -r1.49.20.1 -r1.49.20.2 src/sys/arch/vax/vax/clock.c

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

Modified files:

Index: src/sys/arch/vax/include/clock.h
diff -u src/sys/arch/vax/include/clock.h:1.6 src/sys/arch/vax/include/clock.h:1.6.70.1
--- src/sys/arch/vax/include/clock.h:1.6	Tue Sep  5 19:32:57 2006
+++ src/sys/arch/vax/include/clock.h	Fri Jan  7 01:01:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.h,v 1.6 2006/09/05 19:32:57 matt Exp $ */
+/*	$NetBSD: clock.h,v 1.6.70.1 2011/01/07 01:01:44 riz Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -37,7 +37,7 @@
 /*
  * Time constants. These are unlikely to change.
  */
-#define IS_LEAPYEAR(y) (((y % 4) == 0)  (y % 100))
+#define IS_LEAPYEAR(y) y % 4) == 0)  ((y % 100) != 0)) || ((y % 400) == 0))
 
 #define SEC_PER_MIN	(60)
 #define SEC_PER_HOUR	(SEC_PER_MIN * 60)

Index: src/sys/arch/vax/vax/clock.c
diff -u src/sys/arch/vax/vax/clock.c:1.49.20.1 src/sys/arch/vax/vax/clock.c:1.49.20.2
--- src/sys/arch/vax/vax/clock.c:1.49.20.1	Wed Sep 16 04:46:14 2009
+++ src/sys/arch/vax/vax/clock.c	Fri Jan  7 01:01:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $	 */
+/*	$NetBSD: clock.c,v 1.49.20.2 2011/01/07 01:01:44 riz Exp $	 */
 /*
  * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49.20.1 2009/09/16 04:46:14 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.49.20.2 2011/01/07 01:01:44 riz Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -194,18 +194,18 @@
 {
 	int n;
 
-	for (n = 0, y -= 1; y  69; y--)
+	for (n = 0, y -= 1; y  1969; y--)
 		n += SECPERYEAR(y);
 	return n;
 }
 
 /* 
- * Converts tick number to a year 70 -
+ * Converts tick number to a year 1970 -
  */
 int
 numtoyear(int num)
 {
-	int y = 70, j;
+	int y = 1970, j;
 	while(num = (j = SECPERYEAR(y))) {
 		y++;
 		num -= j;



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

2011-01-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jan  7 01:42:55 UTC 2011

Modified Files:
src/sys/arch/xen/conf [netbsd-5]: files.xen

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1503):
sys/arch/xen/conf/files.xen: revision 1.110
Make maxpartitions 16 on !i386. Fixes hardwiring root on device autoconf
index  0 on amd64. Problem reported and patch tested by Tobias Nygren.


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

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

Modified files:

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.88.4.5 src/sys/arch/xen/conf/files.xen:1.88.4.6
--- src/sys/arch/xen/conf/files.xen:1.88.4.5	Sat Oct  3 23:54:04 2009
+++ src/sys/arch/xen/conf/files.xen	Fri Jan  7 01:42:55 2011
@@ -1,10 +1,14 @@
-#	$NetBSD: files.xen,v 1.88.4.5 2009/10/03 23:54:04 snj Exp $
+#	$NetBSD: files.xen,v 1.88.4.6 2011/01/07 01:42:55 riz Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
 version 20071109
 
+ifdef i386
 maxpartitions 8
+else
+maxpartitions 16
+endif
 
 maxusers 2 16 128
 



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

2010-12-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Dec 21 22:20:12 UTC 2010

Modified Files:
src/sys/arch/acorn32/stand/lib [netbsd-5]: riscospart.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1495):
sys/arch/acorn32/stand/lib/riscospart.c: revision 1.3
Use partition_cyl_high and partition_cyl_low to find the RiscBSD
partition.
Makes nbfs somewhat work on my RiscPC.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.76.1 src/sys/arch/acorn32/stand/lib/riscospart.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/acorn32/stand/lib/riscospart.c
diff -u src/sys/arch/acorn32/stand/lib/riscospart.c:1.2 src/sys/arch/acorn32/stand/lib/riscospart.c:1.2.76.1
--- src/sys/arch/acorn32/stand/lib/riscospart.c:1.2	Sun Jun 25 21:32:41 2006
+++ src/sys/arch/acorn32/stand/lib/riscospart.c	Tue Dec 21 22:20:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: riscospart.c,v 1.2 2006/06/25 21:32:41 christos Exp $	*/
+/*	$NetBSD: riscospart.c,v 1.2.76.1 2010/12/21 22:20:11 riz Exp $	*/
 
 /*-
  * Copyright (c) 2006 Ben Harris
@@ -160,7 +160,7 @@
 	bb = (struct filecore_bootblock *) buf;
 	if (bb-checksum == filecore_checksum((u_char *)bb)) {
 		if (bb-partition_type == PARTITION_FORMAT_RISCBSD)
-			labelsect = (daddr_t)bb-partition_cyl_low *
+			labelsect = ((bb-partition_cyl_high  8) + bb-partition_cyl_low) *
 			bb-heads * bb-secspertrack + LABELSECTOR;
 		else {
 			err = EUNLAB;



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

2010-11-26 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 26 17:11:47 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev [netbsd-5]: gdrom.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1483):
sys/arch/dreamcast/dev/gdrom.c: revision 1.27
Set bp-b_resid properly after data transfer is complete.
Fixes unexpected Bad address errors on file read ops since January 2006.
The problem is reported and tracked by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.26 src/sys/arch/dreamcast/dev/gdrom.c:1.26.4.1
--- src/sys/arch/dreamcast/dev/gdrom.c:1.26	Fri Aug  1 20:19:49 2008
+++ src/sys/arch/dreamcast/dev/gdrom.c	Fri Nov 26 17:11:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.26.4.1 2010/11/26 17:11:47 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.26.4.1 2010/11/26 17:11:47 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -118,10 +118,12 @@
 #define GDROM_COND	GDROM(0x9c)
 
 int	gdrom_getstat(void);
-int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int);
-int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int);
+int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
+int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
 int	gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
-int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int);
+int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int, int *);
 int	gdrom_mount_disk(struct gdrom_softc *);
 int	gdrom_intr(void *);
 
@@ -202,7 +204,7 @@
 
 
 int gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	int i, s;
 	short *ptr = req;
@@ -239,12 +241,15 @@
 
 	splx(s);
 
+	if (resid != NULL)
+		*resid = sc-cmd_result_size;
+
 	return sc-cmd_cond;
 }
 
 
 int gdrom_command_sense(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	/* 76543210 76543210
 	   0   0x13  -
@@ -257,7 +262,7 @@
 	unsigned char cmd[12];
 	int sense_key, sense_specific;
 
-	int cond = gdrom_do_command(sc, req, buf, nbyt);
+	int cond = gdrom_do_command(sc, req, buf, nbyt, resid);
 
 	if (cond  0) {
 #ifdef GDROMDEBUG
@@ -278,7 +283,7 @@
 	cmd[0] = 0x13;
 	cmd[4] = sizeof(sense_data);
 	
-	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data));
+	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data), NULL);
 	
 	sense_key = sense_data[1]  0xf;
 	sense_specific = sense_data[4];
@@ -314,10 +319,11 @@
 	cmd[3] = sizeof(struct gd_toc)  8;
 	cmd[4] = sizeof(struct gd_toc)  0xff;
 	
-	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc));
+	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc), NULL);
 }
 
-int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt)
+int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt,
+int *resid)
 {
 	/* 76543210 76543210
 	   0   0x30datafmt
@@ -339,7 +345,7 @@
 	cmd[9] = cnt8;
 	cmd[10] = cnt;
 
-	return gdrom_command_sense(sc, cmd, buf, cnt  11);
+	return gdrom_command_sense(sc, cmd, buf, cnt  11, resid);
 }
 
 int gdrom_mount_disk(struct gdrom_softc *sc)
@@ -358,7 +364,7 @@
 	cmd[0] = 0x70;
 	cmd[1] = 0x1f;
 	
-	return gdrom_command_sense(sc, cmd, NULL, 0);
+	return gdrom_command_sense(sc, cmd, NULL, 0, NULL);
 }
 
 int
@@ -468,7 +474,7 @@
 gdromstrategy(struct buf *bp)
 {
 	struct gdrom_softc *sc;
-	int s, unit, error;
+	int s, unit, error, resid;
 #ifdef GDROMDEBUG
 	printf(GDROM: strategy\n);
 #endif
@@ -493,11 +499,14 @@
 	splx(s);
 
 	if ((error = gdrom_read_sectors(sc, bp-b_data, bp-b_rawblkno,
-	bp-b_bcount  11)))
+	bp-b_bcount  11, resid)))
 		bp-b_error = error;
 
 	sc-is_busy = 0;
 	wakeup(sc-is_busy);
+	bp-b_resid = resid;
+	biodone(bp);
+	return;
 
  done:
 	bp-b_resid = bp-b_bcount;



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

2010-11-26 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 26 17:14:01 UTC 2010

Modified Files:
src/sys/arch/hpcmips/dev [netbsd-5]: plumohci.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1484):
sys/arch/hpcmips/dev/plumohci.c: revision 1.13
Remove (possibly) unnecessary boundary arg from bus_space_alloc(9)
for DMA shared memory. PR port-hpcmips/43473 by Risto Sainio.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.14.1 src/sys/arch/hpcmips/dev/plumohci.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/hpcmips/dev/plumohci.c
diff -u src/sys/arch/hpcmips/dev/plumohci.c:1.12 src/sys/arch/hpcmips/dev/plumohci.c:1.12.14.1
--- src/sys/arch/hpcmips/dev/plumohci.c:1.12	Thu Apr  3 17:04:40 2008
+++ src/sys/arch/hpcmips/dev/plumohci.c	Fri Nov 26 17:14:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumohci.c,v 1.12 2008/04/03 17:04:40 drochner Exp $ */
+/*	$NetBSD: plumohci.c,v 1.12.14.1 2010/11/26 17:14:01 riz Exp $ */
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: plumohci.c,v 1.12 2008/04/03 17:04:40 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: plumohci.c,v 1.12.14.1 2010/11/26 17:14:01 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -241,7 +241,7 @@
 	 */
 	error = bus_space_alloc(sc-sc.iot, PLUM_OHCI_SHMEMBASE,
 	PLUM_OHCI_SHMEMBASE + PLUM_OHCI_SHMEMSIZE - 1,
-	size, OHCI_PAGE_SIZE, OHCI_PAGE_SIZE, 0,
+	size, OHCI_PAGE_SIZE, 0, 0,
 	(bus_addr_t *)(void *)caddr, bsh);
 	if (error)
 		return (1);



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

2010-11-26 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 26 17:16:03 UTC 2010

Modified Files:
src/sys/arch/hpcmips/tx [netbsd-5]: txcom.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1485):
sys/arch/hpcmips/tx/txcom.c: revision 1.42
sys/arch/hpcmips/tx/txcom.c: revision 1.43
Add missing callout_init(9) calls. PR port-hpcmips/43472
Fix a wrong arg for callout_reset(9) in txcom_txintr(). PR port-hpcmips/43474


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.6.1 src/sys/arch/hpcmips/tx/txcom.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/hpcmips/tx/txcom.c
diff -u src/sys/arch/hpcmips/tx/txcom.c:1.40 src/sys/arch/hpcmips/tx/txcom.c:1.40.6.1
--- src/sys/arch/hpcmips/tx/txcom.c:1.40	Thu Jun 12 16:50:53 2008
+++ src/sys/arch/hpcmips/tx/txcom.c	Fri Nov 26 17:16:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: txcom.c,v 1.40 2008/06/12 16:50:53 tsutsui Exp $ */
+/*	$NetBSD: txcom.c,v 1.40.6.1 2010/11/26 17:16:03 riz Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: txcom.c,v 1.40 2008/06/12 16:50:53 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: txcom.c,v 1.40.6.1 2010/11/26 17:16:03 riz Exp $);
 
 #include opt_tx39uart_debug.h
 
@@ -252,6 +252,10 @@
 
 	printf(\n);
 
+	/* initialize callouts */
+	callout_init(sc-sc_txsoft_ch, 0);
+	callout_init(sc-sc_rxsoft_ch, 0);
+
 	/* 
 	 * Enable interrupt
 	 */
@@ -748,7 +752,7 @@
 		sc-sc_tbc--;
 		sc-sc_tba++;
 	} else {
-		callout_reset(sc-sc_rxsoft_ch, 1, txcom_txsoft, sc);
+		callout_reset(sc-sc_txsoft_ch, 1, txcom_txsoft, sc);
 	}
 
 	return 0;



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

2010-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Nov 21 17:43:03 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1419):
sys/arch/i386/conf/XEN2_DOM0: patch
sys/arch/amd64/conf/XEN3_DOM0: revision 1.55
Sync DKWEDGE options with GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.33.4.5 -r1.33.4.6 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.53.2.5 -r1.53.2.6 src/sys/arch/i386/conf/XEN2_DOM0

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.5 src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.6
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.5	Sun Nov 21 03:05:09 2010
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sun Nov 21 17:43:03 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.33.4.5 2010/11/21 03:05:09 riz Exp $
+# $NetBSD: XEN3_DOM0,v 1.33.4.6 2010/11/21 17:43:03 riz Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -69,6 +69,13 @@
 options 	EXEC_ELF32
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+# The following two options can break /etc/fstab, so handle with care
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)

Index: src/sys/arch/i386/conf/XEN2_DOM0
diff -u src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.5 src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.6
--- src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.5	Sun Nov 21 03:05:05 2010
+++ src/sys/arch/i386/conf/XEN2_DOM0	Sun Nov 21 17:43:03 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN2_DOM0,v 1.53.2.5 2010/11/21 03:05:05 riz Exp $
+# $NetBSD: XEN2_DOM0,v 1.53.2.6 2010/11/21 17:43:03 riz Exp $
 
 include 	arch/xen/conf/std.xen
 
@@ -89,6 +89,13 @@
 #options 	COMPAT_PECOFF	# kernel support to run Win32 apps
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+# The following two options can break /etc/fstab, so handle with care
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)



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

2010-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Nov 21 23:55:58 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by jym in ticket #1473):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.42
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.43
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.45
Features (like feature-rx-copy) are set during XenbusStateInitWait in
backend. So delay xennet_xenbus_resume() up to notification of
backend state change.
This avoids a race that happens during dynamic attach/detach of network
interfaces with xm(1), where frontend queries xenstore for features not
yet reported by backend. This does not happen during normal domU boot,
as the backend has enough time to fill in these entries before frontend
asks for them.
Issue was reported by sborrill@: detaching xennet interfaces with RX copy
mode enabled turns them back during attach to RX flip mode due to the race.
feature-rx-copy support is part of another patch.
Handle error case (avoid changing to XenbusStateConnected when resume
failed)
Implement feature-rx-copy support in xennet (domU network frontend).
Instead of flipping pages back and forth between dom0 and domU for the
network RX queue, feature-rx-copy tells frontend to use content copy
instead.
This is the only mode supported by the dom0 Linux pv_ops backend. NetBSD
domU and dom0 can still fall back to flipping, when needed.
Copy is supposed to be faster than flipping, as it does not require
MMU manipulation and TLB shootdowns.
Based on patch provided by Hideki ONO. Thanks!
See also http://mail-index.netbsd.org/port-xen/2010/09/24/msg006265.html
and http://mail-index.netbsd.org/port-xen/2010/10/16/msg006312.html
ok bou...@.
XXX will ask for a pull-up after 5.1 is branched.


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.3 -r1.29.2.4 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.3 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.4
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.29.2.3	Mon Sep 28 01:31:46 2009
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Nov 21 23:55:58 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.3 2009/09/28 01:31:46 snj Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.29.2.4 2010/11/21 23:55:58 riz Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.3 2009/09/28 01:31:46 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet_xenbus.c,v 1.29.2.4 2010/11/21 23:55:58 riz Exp $);
 
 #include opt_xen.h
 #include opt_nfs_boot.h
@@ -178,6 +178,9 @@
 #define BEST_DISCONNECTED	1
 #define BEST_CONNECTED		2
 #define BEST_SUSPENDED		3
+	unsigned long sc_rx_feature;
+#define FEATURE_RX_FLIP		0
+#define FEATURE_RX_COPY		1
 #if NRND  0
 	rndsource_element_t sc_rnd_source;
 #endif
@@ -347,9 +350,6 @@
 	rnd_attach_source(sc-sc_rnd_source, device_xname(sc-sc_dev),
 	RND_TYPE_NET, 0);
 #endif
-
-	/* initialise shared structures and tell backend that we are ready */
-	xennet_xenbus_resume(sc);
 }
 
 static int
@@ -411,6 +411,7 @@
 {
 	struct xennet_xenbus_softc *sc = p;
 	struct xenbus_transaction *xbt;
+	unsigned long rx_copy;
 	int error;
 	netif_tx_sring_t *tx_ring;
 	netif_rx_sring_t *rx_ring;
@@ -420,7 +421,6 @@
 	sc-sc_tx_ring_gntref = GRANT_INVALID_REF;
 	sc-sc_rx_ring_gntref = GRANT_INVALID_REF;
 
-
 	/* setup device: alloc event channel and shared rings */
 	tx_ring = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
 	 UVM_KMF_WIRED | UVM_KMF_ZERO);
@@ -450,6 +450,19 @@
 	event_set_handler(sc-sc_evtchn, xennet_handler, sc,
 	IPL_NET, device_xname(sc-sc_dev));
 
+	error = xenbus_read_ul(NULL, sc-sc_xbusd-xbusd_otherend,
+	feature-rx-copy, rx_copy, 10);
+	if (error)
+		rx_copy = 0; /* default value if key is absent */
+
+	if (rx_copy == 1) {
+		aprint_normal_dev(sc-sc_dev, using RX copy mode\n);
+		sc-sc_rx_feature = FEATURE_RX_COPY;
+	} else {
+		aprint_normal_dev(sc-sc_dev, using RX flip mode\n);
+		sc-sc_rx_feature = FEATURE_RX_FLIP;
+	}
+
 again:
 	xbt = xenbus_transaction_start();
 	if (xbt == NULL)
@@ -467,21 +480,21 @@
 		goto abort_transaction;
 	}
 	error = xenbus_printf(xbt, sc-sc_xbusd-xbusd_path,
-	feature-rx-notify, %u, 1);
+	request-rx-copy, %lu, rx_copy);
 	if (error) {
-		errmsg = writing feature-rx-notify;
+		errmsg = writing request-rx-copy;
 		goto abort_transaction;
 	}
 	error = xenbus_printf(xbt, sc-sc_xbusd-xbusd_path,
-	event-channel, %u, sc-sc_evtchn);
+	feature-rx-notify, %u, 1);
 	if (error) {
-		errmsg = writing event channel;
+		errmsg = writing feature-rx-notify;
 		goto abort_transaction;
 	}
 	error = xenbus_printf(xbt, 

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

2010-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Nov 22 01:43:59 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1475):
sys/arch/xen/x86/cpu.c: revision 1.52
Boot vs AP processors don't make sense for physical CPUs, these are
handled by the hypervisor and all CPUs are running when the dom0 is started.
In addition, we don't have a reliable way to determine the boot CPU as
- we may not be running on the boot CPU
- we don't have access to the lapic id
So simplify by ignoring the information and assign phycpu_info_primary to the
first attached CPU.


To generate a diff of this commit:
cvs rdiff -u -r1.28.4.2 -r1.28.4.3 src/sys/arch/xen/x86/cpu.c

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

Modified files:

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.28.4.2 src/sys/arch/xen/x86/cpu.c:1.28.4.3
--- src/sys/arch/xen/x86/cpu.c:1.28.4.2	Thu Apr 22 20:02:49 2010
+++ src/sys/arch/xen/x86/cpu.c	Mon Nov 22 01:43:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.28.4.2 2010/04/22 20:02:49 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.28.4.3 2010/11/22 01:43:58 riz Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.28.4.2 2010/04/22 20:02:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.28.4.3 2010/11/22 01:43:58 riz Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -231,26 +231,22 @@
 	struct cpu_softc *sc = device_private(self);
 	struct cpu_attach_args *caa = aux;
 	struct cpu_info *ci;
-	int cpunum = caa-cpu_number;
+	static int nphycpu = 0;
 
 	sc-sc_dev = self;
 
 	/*
-	 * If we're an Application Processor, allocate a cpu_info
-	 * structure, otherwise use the primary's.
+	 * If we're the first attached CPU use the primary cpu_info,
+	 * otherwise allocate a new one.
 	 */
-	if (caa-cpu_role == CPU_ROLE_AP) {
+	if (nphycpu  0) {
 		ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
 		ci-ci_curldt = -1;
-		if (phycpu_info[cpunum] != NULL)
-			panic(cpu at apic id %d already attached?, cpunum);
-		phycpu_info[cpunum] = ci;
+		if (phycpu_info[nphycpu] != NULL)
+			panic(cpu%d already attached?, nphycpu);
+		phycpu_info[nphycpu] = ci;
 	} else {
 		ci = phycpu_info_primary;
-		if (cpunum != 0) {
-			phycpu_info[0] = NULL;
-			phycpu_info[cpunum] = ci;
-		}
 	}
 
 	ci-ci_self = ci;
@@ -259,29 +255,9 @@
 	ci-ci_dev = self;
 	ci-ci_cpuid = caa-cpu_number;
 	ci-ci_vcpu = NULL;
+	ci-ci_index = nphycpu++;
 
-	printf(: );
-	switch (caa-cpu_role) {
-	case CPU_ROLE_SP:
-		printf((uniprocessor)\n);
-		ci-ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
-		break;
-
-	case CPU_ROLE_BP:
-		printf((boot processor)\n);
-		ci-ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
-		break;
-
-	case CPU_ROLE_AP:
-		/*
-		 * report on an AP
-		 */
-		printf((application processor)\n);
-		break;
-
-	default:
-		panic(unknown processor type??\n);
-	}
+	printf(\n);
 	return;
 #else
 	cpu_attach_common(parent, self, aux);



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

2010-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Nov 22 03:05:59 UTC 2010

Modified Files:
src/sys/arch/arc/pci [netbsd-5]: necpb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1481):
sys/arch/arc/pci/necpb.c: revision 1.33
Use fixed pci_intr_handle_t per device number regardless of pin and swiz.
Tested the following multifunction card and devices over ppb(4)
on Express5800/230 (JC94):
---
uhci0 at pci0 dev 4 function 0: VIA Technologies VT83C572 USB Controller (rev. 
0x61)
uhci0: interrupting at int C
usb0 at uhci0: USB revision 1.0
uhci1 at pci0 dev 4 function 1: VIA Technologies VT83C572 USB Controller (rev. 
0x61)
uhci1: interrupting at int C
usb1 at uhci1: USB revision 1.0
ehci0 at pci0 dev 4 function 2: VIA Technologies VT8237 EHCI USB Controller 
(rev. 0x63)
ehci0: interrupting at int C
ehci0: dropped intr workaround enabled
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1
usb2 at ehci0: USB revision 2.0
fwohci0 at pci0 dev 4 function 3: VIA Technologies VT6306 IEEE 1394 Host 
Controller (rev. 0x46)
fwohci0: interrupting at int C
fwohci0: OHCI version 1.0 (ROM=1)
fwohci0: No. of Isochronous channels is 4.
fwohci0: EUI64 00:01:08:00:37:02:79:4f
fwohci0: Phy 1394a available S400, 3 ports.
fwohci0: Link S400, max_rec 1024 bytes.
fwohci0: max_rec 1024 - 2048
ieee1394if0 at fwohci0: IEEE1394 bus
fwip0 at ieee1394if0: IP over IEEE1394
fwohci0: Initiate bus reset
vge0 at pci0 dev 4 function 4: VIA VT612X Gigabit Ethernet (rev. 0x11)
vge0: interrupting at int C
vge0: Ethernet address: 00:01:08:00:b1:71
ciphy0 at vge0 phy 1: Cicada CS8201 10/100/1000TX PHY, rev. 2
ciphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto
 :
---
ppb0 at pci0 dev 4 function 0: Digital Equipment DC21154 PCI-PCI Bridge (rev. 
0x05)
pci1 at ppb0 bus 1
pci1: i/o space, memory space enabled
ex0 at pci1 dev 4 function 0: 3Com 3c980C-TXM 10/100 Ethernet (rev. 0x78)
ex0: interrupting at int C
ex0: MAC address 00:01:03:ce:74:48
bmtphy0 at ex0 phy 24: Broadcom 3c905C internal PHY, rev. 7
bmtphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ex1 at pci1 dev 5 function 0: 3Com 3c980C-TXM 10/100 Ethernet (rev. 0x78)
ex1: interrupting at int C
ex1: MAC address 00:01:03:ce:74:49
bmtphy1 at ex1 phy 24: Broadcom 3c905C internal PHY, rev. 7
bmtphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 :


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/arch/arc/pci/necpb.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/arc/pci/necpb.c
diff -u src/sys/arch/arc/pci/necpb.c:1.32 src/sys/arch/arc/pci/necpb.c:1.32.6.1
--- src/sys/arch/arc/pci/necpb.c:1.32	Sat Jul  5 08:46:25 2008
+++ src/sys/arch/arc/pci/necpb.c	Mon Nov 22 03:05:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: necpb.c,v 1.32 2008/07/05 08:46:25 tsutsui Exp $	*/
+/*	$NetBSD: necpb.c,v 1.32.6.1 2010/11/22 03:05:58 riz Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: necpb.c,v 1.32 2008/07/05 08:46:25 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: necpb.c,v 1.32.6.1 2010/11/22 03:05:58 riz Exp $);
 
 #include opt_pci.h
 
@@ -339,7 +339,6 @@
 	pci_chipset_tag_t pc = pa-pa_pc;
 	pcitag_t intrtag = pa-pa_intrtag;
 	int pin = pa-pa_intrpin;
-	int swiz = pa-pa_intrswiz % 4;
 	int bus, dev;
 
 	if (pin == 0) {
@@ -363,13 +362,13 @@
 
 	switch (dev) {
 	case 3:
-		*ihp = (pin - swiz + 2) % 4;
+		*ihp = 3;
 		break;
 	case 4:
-		*ihp = (pin - swiz + 1) % 4;
+		*ihp = 2;
 		break;
 	case 5:
-		*ihp = (pin - swiz + 0) % 4;
+		*ihp = 1;
 		break;
 	default:
 		*ihp = -1;



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

2010-11-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Nov 21 02:46:24 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: autoconf.c
src/sys/arch/x86/conf [netbsd-5]: files.x86
src/sys/arch/x86/x86 [netbsd-5]: intr.c

Log Message:
Pull up following revision(s) (requested by hubertf in ticket #1403):
sys/arch/x86/conf/files.x86: revision 1.49
sys/arch/i386/i386/autoconf.c: revision 1.94
sys/arch/x86/x86/intr.c: revision 1.60
Add opt_intrdebug.h for the INTRDEBUG option, and #include it here and
there.  Fixes GENERIC/i386 compilation with 'options INTRDEBUG'.


To generate a diff of this commit:
cvs rdiff -u -r1.92.8.1 -r1.92.8.2 src/sys/arch/i386/i386/autoconf.c
cvs rdiff -u -r1.44.4.2 -r1.44.4.3 src/sys/arch/x86/conf/files.x86
cvs rdiff -u -r1.57 -r1.57.6.1 src/sys/arch/x86/x86/intr.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/i386/i386/autoconf.c
diff -u src/sys/arch/i386/i386/autoconf.c:1.92.8.1 src/sys/arch/i386/i386/autoconf.c:1.92.8.2
--- src/sys/arch/i386/i386/autoconf.c:1.92.8.1	Mon Nov 17 18:53:54 2008
+++ src/sys/arch/i386/i386/autoconf.c	Sun Nov 21 02:46:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.92.8.1 2008/11/17 18:53:54 snj Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.92.8.2 2010/11/21 02:46:24 riz Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -46,9 +46,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.92.8.1 2008/11/17 18:53:54 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.92.8.2 2010/11/21 02:46:24 riz Exp $);
 
 #include opt_compat_oldboot.h
+#include opt_intrdebug.h
 #include opt_multiprocessor.h
 
 #include sys/param.h
@@ -60,6 +61,7 @@
 #include machine/pte.h
 #include machine/cpu.h
 #include machine/gdt.h
+#include machine/intr.h
 #include machine/pcb.h
 #include machine/cpufunc.h
 

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.44.4.2 src/sys/arch/x86/conf/files.x86:1.44.4.3
--- src/sys/arch/x86/conf/files.x86:1.44.4.2	Mon Oct  5 11:37:14 2009
+++ src/sys/arch/x86/conf/files.x86	Sun Nov 21 02:46:23 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.44.4.2 2009/10/05 11:37:14 sborrill Exp $
+#	$NetBSD: files.x86,v 1.44.4.3 2010/11/21 02:46:23 riz Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -6,6 +6,9 @@
 # MTRR support
 defflag MTRR
 
+# Interrupt debug
+defflag opt_intrdebug.h	INTRDEBUG
+
 # PCI fixup options
 defflag opt_pcifixup.h	PCI_ADDR_FIXUP PCI_BUS_FIXUP
 			PCI_INTR_FIXUP PCI_INTR_FIXUP_FORCE

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.57 src/sys/arch/x86/x86/intr.c:1.57.6.1
--- src/sys/arch/x86/x86/intr.c:1.57	Thu Jul  3 15:44:19 2008
+++ src/sys/arch/x86/x86/intr.c	Sun Nov 21 02:46:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.57 2008/07/03 15:44:19 drochner Exp $	*/
+/*	$NetBSD: intr.c,v 1.57.6.1 2010/11/21 02:46:24 riz Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -133,8 +133,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.57 2008/07/03 15:44:19 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.57.6.1 2010/11/21 02:46:24 riz Exp $);
 
+#include opt_intrdebug.h
 #include opt_multiprocessor.h
 #include opt_acpi.h
 



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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 19 23:19:13 UTC 2010

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: bus_dma.c
src/sys/arch/xen/x86 [netbsd-5]: xen_bus_dma.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1348):
sys/arch/x86/x86/bus_dma.c: revision 1.54
sys/arch/xen/x86/xen_bus_dma.c: revision 1.21
bus_dmamem_alloc() may not get a boundary smaller than size, but
it's perfectly valid for bus_dmamap_create() to do so (a contigous
transfers will then split in multiple segment).
Fix _xen_bus_dmamem_alloc_range() and _bus_dmamem_alloc_range() to
allow a boundary limit smaller than size:
- compute appropriate boundary for uvm_pglistalloc(), wich doesn't
  accept boundary  size
- also take care of boundary when deciding to start a new segment.
While there, remove useless boundary argument to _xen_alloc_contig().
Fix the boundary-related issue of PR port-amd64/42980


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.11.8.2 -r1.11.8.3 src/sys/arch/xen/x86/xen_bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.45 src/sys/arch/x86/x86/bus_dma.c:1.45.6.1
--- src/sys/arch/x86/x86/bus_dma.c:1.45	Sat Jun 28 17:23:01 2008
+++ src/sys/arch/x86/x86/bus_dma.c	Fri Nov 19 23:19:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.45 2008/06/28 17:23:01 bouyer Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.45.6.1 2010/11/19 23:19:12 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.45 2008/06/28 17:23:01 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.45.6.1 2010/11/19 23:19:12 riz Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -155,14 +155,28 @@
 	struct vm_page *m;
 	struct pglist mlist;
 	int curseg, error;
+	bus_size_t uboundary;
 
 	/* Always round the size. */
 	size = round_page(size);
 
+	KASSERT(boundary = PAGE_SIZE || boundary == 0);
+
 	/*
 	 * Allocate pages from the VM system.
-	 */
-	error = uvm_pglistalloc(size, low, high, alignment, boundary,
+	 * We accept boundaries  size, splitting in multiple segments
+	 * if needed. uvm_pglistalloc does not, so compute an appropriate
+ * boundary: next power of 2 = size
+ */
+
+	if (boundary == 0)
+		uboundary = 0;
+	else {
+		uboundary = boundary;
+		while (uboundary  size)
+			uboundary = uboundary  1;
+	}
+	error = uvm_pglistalloc(size, low, high, alignment, uboundary,
 	mlist, nsegs, (flags  BUS_DMA_NOWAIT) == 0);
 	if (error)
 		return (error);
@@ -186,10 +200,13 @@
 			panic(_bus_dmamem_alloc_range);
 		}
 #endif
-		if (curaddr == (lastaddr + PAGE_SIZE))
+		if (curaddr == (lastaddr + PAGE_SIZE) 
+		(lastaddr  boundary) == (curaddr  boundary)) {
 			segs[curseg].ds_len += PAGE_SIZE;
-		else {
+		} else {
 			curseg++;
+			if (curseg = nsegs)
+return EFBIG;
 			segs[curseg].ds_addr = curaddr;
 			segs[curseg].ds_len = PAGE_SIZE;
 		}

Index: src/sys/arch/xen/x86/xen_bus_dma.c
diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.2 src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.3
--- src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.2	Mon Mar 29 00:23:12 2010
+++ src/sys/arch/xen/x86/xen_bus_dma.c	Fri Nov 19 23:19:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $	*/
+/*	$NetBSD: xen_bus_dma.c,v 1.11.8.3 2010/11/19 23:19:12 riz Exp $	*/
 /*	NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.11.8.3 2010/11/19 23:19:12 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -61,7 +61,7 @@
 }
 
 static int
-_xen_alloc_contig(bus_size_t size, bus_size_t alignment, bus_size_t boundary,
+_xen_alloc_contig(bus_size_t size, bus_size_t alignment,
 struct pglist *mlistp, int flags, bus_addr_t low, bus_addr_t high)
 {
 	int order, i;
@@ -75,9 +75,9 @@
 
 	/*
 	 * When requesting a contigous memory region, the hypervisor will
-	 * return a memory range aligned on size. This will automagically
-	 * handle boundary, but the only way to enforce alignment
-	 * is to request a memory region of size max(alignment, size).
+	 * return a memory range aligned on size. 
+	 * The only way to enforce alignment is to request a memory region
+	 * of size max(alignment, size).
 	 */
 	order = max(get_order(size), get_order(alignment));
 	npages = (1  order);
@@ -245,21 +245,32 @@
 	struct pglist mlist;
 	int curseg, error;
 	int doingrealloc = 0;
+	bus_size_t uboundary;
 
 	/* Always round the size. */
 	size = round_page(size);
 
 	KASSERT((alignment  (alignment - 

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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 20 00:27:31 UTC 2010

Modified Files:
src/sys/arch/atari/conf [netbsd-5]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
Regen for ticket 1366.


To generate a diff of this commit:
cvs rdiff -u -r1.86.4.4 -r1.86.4.5 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.84.4.4 -r1.84.4.5 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.76.4.4 -r1.76.4.5 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.53.4.4 -r1.53.4.5 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.57.4.4 -r1.57.4.5 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/atari/conf/SMALL030

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

Modified files:

Index: src/sys/arch/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.86.4.4 src/sys/arch/atari/conf/ATARITT:1.86.4.5
--- src/sys/arch/atari/conf/ATARITT:1.86.4.4	Thu Mar 12 23:33:48 2009
+++ src/sys/arch/atari/conf/ATARITT	Sat Nov 20 00:27:31 2010
@@ -1,23 +1,27 @@
 #
-# $NetBSD: ATARITT,v 1.86.4.4 2009/03/12 23:33:48 snj Exp $
+# $NetBSD: ATARITT,v 1.86.4.5 2010/11/20 00:27:31 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.73.4.5 2009/03/12 23:32:35 snj Exp $
+#		NetBSD$
 include arch/atari/conf/std.atari
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 maxusers 16
+
 options HZ=64 # Set the clock-rate (48/64/96)
+
 options INSECURE # disable kernel security levels
 options M68030 # support for 030
 options FPU_EMULATE # Support for MC68881/MC68882 emulator
 options INET # IP + ICMP + TCP + UDP
+
 options INET6 # IPV6
 options PPP_BSDCOMP # BSD-Compress compression support for PPP
 options PPP_DEFLATE # Deflate compression support for PPP
 options PPP_FILTER # Active filter support for PPP (requires bpf)
+
 options PFIL_HOOKS # pfil(9) packet filter hooks
 options IPFILTER_LOG # ipmon(8) log support
 options IPFILTER_LOOKUP # ippool(8) support
@@ -25,6 +29,7 @@
 file-system MFS # Memory based filesystem
 file-system MSDOSFS # MSDOS filesystem
 file-system CD9660 # ISO 9660 filesystem with Rock Ridge
+
 file-system KERNFS # Kernel parameter filesystem
 file-system NFS # Network File System client side code
 file-system PROCFS # Process filesystem
@@ -35,13 +40,20 @@
 file-system UMAPFS # null file system (with uid  gid remapping)
 file-system PORTAL # portal file system
 file-system EXT2FS # second extended file system (linux)
+
 file-system PTYFS # /dev/pts/N support
+
 options WAPBL # File system journaling support - Experimental
+
 options SOFTDEP # FFS soft updates support.
+
 options NFSSERVER # Network File System server side code
+
 options PANICWAIT # Require keystroke to dump/reboot
+
 options DDB # Kernel debugger
 options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
+
 options COMPAT_43 # 4.3 BSD compatible system calls
 options COMPAT_10 # Compatibility with NetBSD 1.0
 options COMPAT_11 # Compatibility with NetBSD 1.1
@@ -49,71 +61,101 @@
 options COMPAT_13 # Compatibility with NetBSD 1.3
 options COMPAT_14 # Compatibility with NetBSD 1.4
 options COMPAT_15 # Compatibility with NetBSD 1.5
+
 options COMPAT_16 # Compatibility with NetBSD 1.6
 options COMPAT_20 # Compatibility with NetBSD 2.0
 options COMPAT_30 # NetBSD 3.0 compatibility.
 options COMPAT_40 # NetBSD 4.0 compatibility.
+
 options COMPAT_AOUT_M68K # Compatibility to a.out executables
 options EXEC_AOUT # a.out format executables
+
 options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
+
 options SYSVSHM # System V shared memory
 options SYSVMSG # System V messages
 options SYSVSEM # System V semaphores
 options P1003_1B_SEMAPHORE # p1003.1b semaphore support
+
 options KTRACE # Add kernel tracing system call
+
 options USERCONF # userconf(4) support
+
 options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
+
 options SCSIVERBOSE # human readable SCSI error messages
 options ST_POOL_SIZE=24 # smallest that allows TT-HIGH
+
 options TT_SCSI # SCSI-support for TT
 options TT_VIDEO # Graphics support for TT
+
 options MEMORY_DISK_HOOKS # Boot RAM-disk
 options DISKLABEL_NBDA # NetBSD disklabels (required)
 options DISKLABEL_AHDI # NetBSD/AHDI disklabels
+
 options SERCONSOLE # modem1 console support, breaks Falcon
+
 options RELOC_KERNEL # TT/Falcon: relocate kernel to TT-RAM
 options MSGBUFSIZE=32768 # size of kernel msg. buffer
+
 options TRY_SCSI_LINKED_COMMANDS=0x7f
+
 config netbsd root on ? type ?
+
 pseudo-device sl # Slip
+
 pseudo-device ppp # ppp
+
 pseudo-device pppoe # PPP over Ethernet (RFC 2516)
+
 pseudo-device pty # pseudo-terminals
 pseudo-device loop # Loopback network
+
 pseudo-device md 3 # Boot memory disk
+
 pseudo-device vnd # 3 pseudo disks (see vnconfig)
 pseudo-device bpfilter # berkeley packet filters
+
 pseudo-device tun # network tunnel
 

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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 20 00:34:14 UTC 2010

Modified Files:
src/sys/arch/atari/conf [netbsd-5]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
Regen for ticket 1367.


To generate a diff of this commit:
cvs rdiff -u -r1.86.4.5 -r1.86.4.6 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.84.4.5 -r1.84.4.6 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.76.4.5 -r1.76.4.6 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.53.4.5 -r1.53.4.6 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.57.4.5 -r1.57.4.6 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/atari/conf/SMALL030

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

Modified files:

Index: src/sys/arch/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.86.4.5 src/sys/arch/atari/conf/ATARITT:1.86.4.6
--- src/sys/arch/atari/conf/ATARITT:1.86.4.5	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/ATARITT	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: ATARITT,v 1.86.4.5 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: ATARITT,v 1.86.4.6 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -145,6 +145,7 @@
 ite2 at grfcc2 # 3rd tty
 lp0 at mainbus0 # centronics printer
 ser0 at mainbus0 # UART on first 68901 (ttyB0)
+ne0 at mainbus0 # EtherNEC on Atari ROM cartridge slot
 
 avmebus0 at mainbus0 # VME bus
 vme0 at avmebus0

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.84.4.5 src/sys/arch/atari/conf/FALCON:1.84.4.6
--- src/sys/arch/atari/conf/FALCON:1.84.4.5	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/FALCON	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: FALCON,v 1.84.4.5 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: FALCON,v 1.84.4.6 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -147,6 +147,7 @@
 ite2 at grfcc2 # 3rd tty
 lp0 at mainbus0 # centronics printer
 ser0 at mainbus0 # UART on first 68901 (ttyB0)
+ne0 at mainbus0 # EtherNEC on Atari ROM cartridge slot
 wdc0 at mainbus0 # IDE-bus
 atabus* at wdc? channel ?
 wd* at atabus? drive ?

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.76.4.5 src/sys/arch/atari/conf/HADES:1.76.4.6
--- src/sys/arch/atari/conf/HADES:1.76.4.5	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/HADES	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: HADES,v 1.76.4.5 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: HADES,v 1.76.4.6 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.5 src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.6
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.5	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.53.4.5 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.53.4.6 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.5 src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.6
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.5	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.57.4.5 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.57.4.6 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/SMALL030
diff -u src/sys/arch/atari/conf/SMALL030:1.1.2.4 src/sys/arch/atari/conf/SMALL030:1.1.2.5
--- src/sys/arch/atari/conf/SMALL030:1.1.2.4	Sat Nov 20 00:27:31 2010
+++ src/sys/arch/atari/conf/SMALL030	Sat Nov 20 00:34:14 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: SMALL030,v 1.1.2.4 2010/11/20 00:27:31 riz Exp $
+# $NetBSD: SMALL030,v 1.1.2.5 2010/11/20 00:34:14 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.



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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 20 00:48:29 UTC 2010

Modified Files:
src/sys/arch/atari/conf [netbsd-5]: ATARITT FALCON HADES MILAN-ISAIDE
MILAN-PCIIDE SMALL030

Log Message:
Regen for ticket 1368.


To generate a diff of this commit:
cvs rdiff -u -r1.86.4.6 -r1.86.4.7 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.84.4.6 -r1.84.4.7 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.76.4.6 -r1.76.4.7 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.53.4.6 -r1.53.4.7 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.57.4.6 -r1.57.4.7 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/atari/conf/SMALL030

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

Modified files:

Index: src/sys/arch/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.86.4.6 src/sys/arch/atari/conf/ATARITT:1.86.4.7
--- src/sys/arch/atari/conf/ATARITT:1.86.4.6	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/ATARITT	Sat Nov 20 00:48:26 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: ATARITT,v 1.86.4.6 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: ATARITT,v 1.86.4.7 2010/11/20 00:48:26 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -93,8 +93,6 @@
 options DISKLABEL_NBDA # NetBSD disklabels (required)
 options DISKLABEL_AHDI # NetBSD/AHDI disklabels
 
-options SERCONSOLE # modem1 console support, breaks Falcon
-
 options RELOC_KERNEL # TT/Falcon: relocate kernel to TT-RAM
 options MSGBUFSIZE=32768 # size of kernel msg. buffer
 

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.84.4.6 src/sys/arch/atari/conf/FALCON:1.84.4.7
--- src/sys/arch/atari/conf/FALCON:1.84.4.6	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/FALCON	Sat Nov 20 00:48:27 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: FALCON,v 1.84.4.6 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: FALCON,v 1.84.4.7 2010/11/20 00:48:27 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.76.4.6 src/sys/arch/atari/conf/HADES:1.76.4.7
--- src/sys/arch/atari/conf/HADES:1.76.4.6	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/HADES	Sat Nov 20 00:48:27 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: HADES,v 1.76.4.6 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: HADES,v 1.76.4.7 2010/11/20 00:48:27 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -99,8 +99,6 @@
 options DISKLABEL_NBDA # NetBSD disklabels (required)
 options DISKLABEL_AHDI # NetBSD/AHDI disklabels
 
-options SERCONSOLE # modem1 console support, breaks Falcon
-
 options RELOC_KERNEL # TT/Falcon: relocate kernel to TT-RAM
 options MSGBUFSIZE=32768 # size of kernel msg. buffer
 

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.6 src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.7
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.53.4.6	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sat Nov 20 00:48:28 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.53.4.6 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.53.4.7 2010/11/20 00:48:28 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -96,8 +96,6 @@
 options DISKLABEL_NBDA # NetBSD disklabels (required)
 options DISKLABEL_AHDI # NetBSD/AHDI disklabels
 
-options SERCONSOLE # modem1 console support, breaks Falcon
-
 options RELOC_KERNEL # TT/Falcon: relocate kernel to TT-RAM
 options MSGBUFSIZE=32768 # size of kernel msg. buffer
 

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.6 src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.7
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.57.4.6	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sat Nov 20 00:48:28 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.57.4.6 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.57.4.7 2010/11/20 00:48:28 riz Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
@@ -96,8 +96,6 @@
 options DISKLABEL_NBDA # NetBSD disklabels (required)
 options DISKLABEL_AHDI # NetBSD/AHDI disklabels
 
-options SERCONSOLE # modem1 console support, breaks Falcon
-
 options RELOC_KERNEL # TT/Falcon: relocate kernel to TT-RAM
 options MSGBUFSIZE=32768 # size of kernel msg. buffer
 

Index: src/sys/arch/atari/conf/SMALL030
diff -u src/sys/arch/atari/conf/SMALL030:1.1.2.5 src/sys/arch/atari/conf/SMALL030:1.1.2.6
--- src/sys/arch/atari/conf/SMALL030:1.1.2.5	Sat Nov 20 00:34:14 2010
+++ src/sys/arch/atari/conf/SMALL030	Sat Nov 20 00:48:29 2010
@@ -1,5 +1,5 @@
 #
-# $NetBSD: SMALL030,v 1.1.2.5 2010/11/20 00:34:14 riz Exp $
+# $NetBSD: 

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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 20 00:47:56 UTC 2010

Modified Files:
src/sys/arch/atari/conf [netbsd-5]: GENERIC.in
src/sys/arch/atari/dev [netbsd-5]: ser.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1368):
sys/arch/atari/dev/ser.c: revision 1.49
sys/arch/atari/conf/GENERIC.in: revision 1.86
Make options SERCONSOLE (force serial console if DCD is detected)
patchable by binpatch(8) like:
---
serconsole(0x23bac4): 0x0001 (1), at offset 0x23bb44 in /netbsd
new value: 0x (0)
---
May work around PR port-atari/39849
(netbsd-ATARITT kernel fails with serial port connected)
and some old TT030 with early revision boards.
Disable options SERCONSOLE (force serial console if DCD is detected)
because now it's patchable by binpatch(8).
Enabling serial console by DCD signal could be problematic
on some earlier TT030 (with revision A board), and it's also
annoying for users who connect an active device on the serial port
as mentioned in PR port-atari/39849.
XXX: Eventually serial console should be enabled by MD bootloader flags,
XXX: but I have no idea how to build bootloader binaries for TOS.


To generate a diff of this commit:
cvs rdiff -u -r1.73.4.7 -r1.73.4.8 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/arch/atari/dev/ser.c

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

Modified files:

Index: src/sys/arch/atari/conf/GENERIC.in
diff -u src/sys/arch/atari/conf/GENERIC.in:1.73.4.7 src/sys/arch/atari/conf/GENERIC.in:1.73.4.8
--- src/sys/arch/atari/conf/GENERIC.in:1.73.4.7	Sat Nov 20 00:33:46 2010
+++ src/sys/arch/atari/conf/GENERIC.in	Sat Nov 20 00:47:55 2010
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.in,v 1.73.4.7 2010/11/20 00:33:46 riz Exp $
+#	$NetBSD: GENERIC.in,v 1.73.4.8 2010/11/20 00:47:55 riz Exp $
 #
 # Generic atari
 #
@@ -231,7 +231,7 @@
 options 	DISKLABEL_AHDI		# NetBSD/AHDI disklabels
 #if !defined(SMALL030_KERNEL)
 #if !defined(FALCON_KERNEL)
-options 	SERCONSOLE		# modem1 console support, breaks Falcon
+#options 	SERCONSOLE		# modem1 console support, breaks Falcon
 #endif /* !FALCON_KERNEL */
 options 	RELOC_KERNEL		# TT/Falcon: relocate kernel to TT-RAM
 options 	MSGBUFSIZE=32768# size of kernel msg. buffer

Index: src/sys/arch/atari/dev/ser.c
diff -u src/sys/arch/atari/dev/ser.c:1.39 src/sys/arch/atari/dev/ser.c:1.39.6.1
--- src/sys/arch/atari/dev/ser.c:1.39	Wed Jun 11 14:35:53 2008
+++ src/sys/arch/atari/dev/ser.c	Sat Nov 20 00:47:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ser.c,v 1.39 2008/06/11 14:35:53 tsutsui Exp $	*/
+/*	$NetBSD: ser.c,v 1.39.6.1 2010/11/20 00:47:55 riz Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.39 2008/06/11 14:35:53 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ser.c,v 1.39.6.1 2010/11/20 00:47:55 riz Exp $);
 
 #include opt_ddb.h
 #include opt_mbtype.h
@@ -262,6 +262,11 @@
 	serstop, sertty, serpoll, nommap, ttykqfilter, D_TTY
 };
 
+#ifndef SERCONSOLE
+#define SERCONSOLE	0
+#endif
+int serconsole = SERCONSOLE;	/* patchable */
+
 /*ARGSUSED*/
 static	int
 sermatch(pdp, cfp, auxp)
@@ -316,13 +321,13 @@
 
 	callout_init(sc-sc_diag_ch, 0);
 
-#if SERCONSOLE  0
-	/*
-	 * Activate serial console when DCD present...
-	 */
-	if (!(MFP-mf_gpip  MCR_DCD))
-		SET(sc-sc_hwflags, SER_HW_CONSOLE);
-#endif /* SERCONSOLE  0 */
+	if (serconsole) {
+		/*
+		 * Activate serial console when DCD present...
+		 */
+		if (!(MFP-mf_gpip  MCR_DCD))
+			SET(sc-sc_hwflags, SER_HW_CONSOLE);
+	}
 
 	printf(\n);
 	if (ISSET(sc-sc_hwflags, SER_HW_CONSOLE)) {
@@ -1416,11 +1421,10 @@
 	/* initialize required fields */
 	/* XXX: LWP What unit? */
 	cp-cn_dev = makedev(cdevsw_lookup_major(ser_cdevsw), 0);
-#if SERCONSOLE  0
-	cp-cn_pri = CN_REMOTE;	/* Force a serial port console */
-#else
-	cp-cn_pri = CN_NORMAL;
-#endif /* SERCONSOLE  0 */
+	if (serconsole)
+		cp-cn_pri = CN_REMOTE;	/* Force a serial port console */
+	else
+		cp-cn_pri = CN_NORMAL;
 }
 
 void



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

2010-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 20 01:09:27 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1373):
sys/arch/atari/dev/dma.c: revision 1.25
sys/arch/atari/dev/atari5380.c: revision 1.54
Always schedule callback functions via add_sicallback(),
which calls softint_schedule(9).
We cannot use BASEPRI() to check recursive calls any longer
since softint(9) has been reorganized to use kernel thread.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.2.1 src/sys/arch/atari/dev/atari5380.c
cvs rdiff -u -r1.18 -r1.18.54.1 src/sys/arch/atari/dev/dma.c

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

Modified files:

Index: src/sys/arch/atari/dev/atari5380.c
diff -u src/sys/arch/atari/dev/atari5380.c:1.46 src/sys/arch/atari/dev/atari5380.c:1.46.2.1
--- src/sys/arch/atari/dev/atari5380.c:1.46	Wed Oct 29 14:31:01 2008
+++ src/sys/arch/atari/dev/atari5380.c	Sat Nov 20 01:09:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari5380.c,v 1.46 2008/10/29 14:31:01 abs Exp $	*/
+/*	$NetBSD: atari5380.c,v 1.46.2.1 2010/11/20 01:09:27 riz Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.46 2008/10/29 14:31:01 abs Exp $);
+__KERNEL_RCSID(0, $NetBSD: atari5380.c,v 1.46.2.1 2010/11/20 01:09:27 riz Exp $);
 
 #include opt_atariscsi.h
 
@@ -1131,14 +1131,7 @@
 {
 	if (GET_5380_REG(NCR5380_DMSTAT)  SC_IRQ_SET) {
 		scsi_idisable();
-		if (!BASEPRI(sr))
-			add_sicallback((si_farg)ncr_ctrl_intr,
-		(void *)cur_softc, 0);
-		else {
-			spl1();
-			ncr_ctrl_intr(cur_softc);
-			spl0();
-		}
+		add_sicallback((si_farg)ncr_ctrl_intr, (void *)cur_softc, 0);
 	}
 }
 
@@ -1152,14 +1145,7 @@
 
 	if ((reqp = connected)  (reqp-dr_flag  DRIVER_IN_DMA)) {
 		scsi_idisable();
-		if (!BASEPRI(sr))
-			add_sicallback((si_farg)ncr_dma_intr,
-	(void *)cur_softc, 0);
-		else {
-			spl1();
-			ncr_dma_intr(cur_softc);
-			spl0();
-		}
+		add_sicallback((si_farg)ncr_dma_intr, (void *)cur_softc, 0);
 	}
 }
 

Index: src/sys/arch/atari/dev/dma.c
diff -u src/sys/arch/atari/dev/dma.c:1.18 src/sys/arch/atari/dev/dma.c:1.18.54.1
--- src/sys/arch/atari/dev/dma.c:1.18	Sun Mar  4 05:59:40 2007
+++ src/sys/arch/atari/dev/dma.c	Sat Nov 20 01:09:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dma.c,v 1.18 2007/03/04 05:59:40 christos Exp $	*/
+/*	$NetBSD: dma.c,v 1.18.54.1 2010/11/20 01:09:27 riz Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.18 2007/03/04 05:59:40 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: dma.c,v 1.18.54.1 2010/11/20 01:09:27 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -232,14 +232,7 @@
 		 */
 		int_func = dma_active.tqh_first-int_func;
 		softc= dma_active.tqh_first-softc;
-
-		if(!BASEPRI(sr))
-			add_sicallback((si_farg)int_func, softc, 0);
-		else {
-			spl1();
-			(*int_func)(softc);
-			spl0();
-		}
+		add_sicallback((si_farg)int_func, softc, 0);
 		return 1;
 	}
 	return 0;



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

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:38:21 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #1449):
sys/arch/amd64/amd64/netbsd32_machdep.c: revisions 1.66, 1.67
sys/arch/amd64/include/segments.h: revision 1.21
in check_mcontext32(), accept the LDT selector for 32-bit user code
as well as the GDT selector.  fixes PR 43835.
accept the LDT selector in check_sigcontext32() too.


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.2 -r1.55.4.3 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/arch/amd64/include/segments.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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.3
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.2	Fri Jul 16 18:40:39 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Tue Sep  7 19:38:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_coredump.h
@@ -944,7 +944,7 @@
 {
 
 	if (((scp-sc_eflags ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
-	scp-sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(scp-sc_cs))
 		return EINVAL;
 	if (scp-sc_fs != 0  !VALID_USER_DSEL32(scp-sc_fs))
 		return EINVAL;
@@ -967,7 +967,7 @@
 	gr = mcp-__gregs;
 
 	if (((gr[_REG32_EFL] ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
-	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(gr[_REG32_CS]))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0  !VALID_USER_DSEL32(gr[_REG32_FS]))
 		return EINVAL;

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.19 src/sys/arch/amd64/include/segments.h:1.19.4.1
--- src/sys/arch/amd64/include/segments.h:1.19	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/segments.h	Tue Sep  7 19:38:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.19 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: segments.h,v 1.19.4.1 2010/09/07 19:38:21 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -382,10 +382,8 @@
 #define VALID_USER_DSEL32(s) \
 (((s)  0x) == GSEL(GUDATA32_SEL, SEL_UPL) || \
  ((s)  0x) == LSEL(LUDATA32_SEL, SEL_UPL))
-#if 0 /* not used */
 #define VALID_USER_CSEL32(s) \
 ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
-#endif
 
 #define VALID_USER_CSEL(s) \
 ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))



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

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:50:22 UTC 2010

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: intel_busclock.c

Log Message:
Pull up following revision(s) (requested by jym in ticket #1439):
sys/arch/x86/x86/intel_busclock.c: revision 1.11
Some core i7 CPUs report model 0c. In this case, check for the extended
model value.
Required to avoid faulting on rdmsr(MSR_FSB_FREQ) early during boot.
Will ask for a pull-up. This affects GENERIC, and most likely, install iso
too.
XXX quick hack. Obtaining FSB through ACPI should be cleaner.


To generate a diff of this commit:
cvs rdiff -u -r1.5.10.3 -r1.5.10.4 src/sys/arch/x86/x86/intel_busclock.c

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

Modified files:

Index: src/sys/arch/x86/x86/intel_busclock.c
diff -u src/sys/arch/x86/x86/intel_busclock.c:1.5.10.3 src/sys/arch/x86/x86/intel_busclock.c:1.5.10.4
--- src/sys/arch/x86/x86/intel_busclock.c:1.5.10.3	Fri Dec 18 05:55:23 2009
+++ src/sys/arch/x86/x86/intel_busclock.c	Tue Aug 31 10:50:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_busclock.c,v 1.5.10.3 2009/12/18 05:55:23 snj Exp $	*/
+/*	$NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.3 2009/12/18 05:55:23 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -96,7 +96,19 @@
 	case 0x9: /* Pentium M (130 nm, Banias) */
 		bus_clock = 1;
 		break;
-	case 0xc: /* Atom, model 1 */
+	case 0xc: /* Core i7, Atom, model 1 */
+		/*
+		 * XXX (See also case 0xe)
+		 * Some core i7 CPUs can report model 0xc.
+		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
+		 * In the long-term, use ACPI instead of all this.
+		 */
+		switch (CPUID2EXTMODEL(ci-ci_signature)) {
+		case 0x2:
+			aprint_debug(%s: unable to determine bus speed,
+			device_xname(ci-ci_dev));
+			goto print_msr;
+		}
 		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {
@@ -127,7 +139,7 @@
 		break;
 	case 0xe: /* Core Duo/Solo */
 		/*
-		 * XXX
+		 * XXX (See also case 0xc)
 		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
 		 * In the long-term, use ACPI instead of all this.
 		 */



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

2010-07-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jul 16 18:26:13 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by phx in ticket #1412):
sys/arch/amiga/dev/clock.c: revision 1.51
sys/arch/amiga/amiga/locore.s: revision 1.149 via patch
sys/arch/amiga/dev/kbd.c: revision 1.53
sys/arch/amiga/amiga/amiga_init.c: revision 1.118
Reverted the CIA-timer based delay() to the pre-5.0 method of a calibrated
delay loop.
This fixes keyboard handshaking problems with some A1200 models since 5.0
and restores the precision for short delays on DraCo systems (the QuickLogic
timer has only a seventh of the CIA precision).
Changed the keyboard handshaking delay from 2000 back to 200ms, although
even the recommended 85ms were successfully tested on the most problematic
A1200 keyboards.
All those changes were tested on an A3000 and A1200 with 68060/50 CPU, and
previously discussed on the port-amiga ML.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.99.20.1 src/sys/arch/amiga/amiga/amiga_init.c
cvs rdiff -u -r1.145 -r1.145.20.1 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.47.20.3 -r1.47.20.4 src/sys/arch/amiga/dev/clock.c
cvs rdiff -u -r1.50 -r1.50.20.1 src/sys/arch/amiga/dev/kbd.c

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

Modified files:

Index: src/sys/arch/amiga/amiga/amiga_init.c
diff -u src/sys/arch/amiga/amiga/amiga_init.c:1.99 src/sys/arch/amiga/amiga/amiga_init.c:1.99.20.1
--- src/sys/arch/amiga/amiga/amiga_init.c:1.99	Sun Jan  6 18:50:29 2008
+++ src/sys/arch/amiga/amiga/amiga_init.c	Fri Jul 16 18:26:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: amiga_init.c,v 1.99 2008/01/06 18:50:29 mhitch Exp $	*/
+/*	$NetBSD: amiga_init.c,v 1.99.20.1 2010/07/16 18:26:13 riz Exp $	*/
 
 /*
  * Copyright (c) 1994 Michael L. Hitch
@@ -36,7 +36,7 @@
 #include opt_devreload.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: amiga_init.c,v 1.99 2008/01/06 18:50:29 mhitch Exp $);
+__KERNEL_RCSID(0, $NetBSD: amiga_init.c,v 1.99.20.1 2010/07/16 18:26:13 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -765,6 +765,7 @@
 void
 start_c_finish()
 {
+	extern u_int32_t delaydivisor;
 #ifdef	P5PPC68KBOARD
 struct cfdev *cdp, *ecdp;
 #endif
@@ -900,6 +901,21 @@
 			}
 }
 #endif
+	/*
+	 * preliminary delay divisor value
+	 */
+
+	if (machineid  AMIGA_68060)
+		delaydivisor = (1024 * 1) / 80;	/* 80 MHz 68060 w. BTC */
+
+	else if (machineid  AMIGA_68040)
+		delaydivisor = (1024 * 3) / 40;	/* 40 MHz 68040 */
+
+	else if (machineid  AMIGA_68030)
+		delaydivisor = (1024 * 8) / 50;	/* 50 MHz 68030 */
+
+	else
+		delaydivisor = (1024 * 8) / 33; /* 33 MHz 68020 */
 }
 
 void

Index: src/sys/arch/amiga/amiga/locore.s
diff -u src/sys/arch/amiga/amiga/locore.s:1.145 src/sys/arch/amiga/amiga/locore.s:1.145.20.1
--- src/sys/arch/amiga/amiga/locore.s:1.145	Sun Jan  6 18:50:30 2008
+++ src/sys/arch/amiga/amiga/locore.s	Fri Jul 16 18:26:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.145 2008/01/06 18:50:30 mhitch Exp $	*/
+/*	$NetBSD: locore.s,v 1.145.20.1 2010/07/16 18:26:12 riz Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990 The Regents of the University of California.
@@ -1577,6 +1577,16 @@
 	.align 2
 #endif
 	nop
+ENTRY_NOPROFILE(delay)
+ENTRY_NOPROFILE(DELAY)
+	movql #10,%d1		| 2 +2
+	movl %sp@(4),%d0	| 4 +4
+	lsll %d1,%d0		| 8 +2
+	movl _C_LABEL(delaydivisor),%d1	| A +6
+Ldelay:| longword aligned again.
+	subl %d1,%d0
+	jcc Ldelay
+	rts
 
 #ifdef M68060
 ENTRY_NOPROFILE(intemu60)
@@ -1607,6 +1617,11 @@
 	.long	FPU_NONE
 GLOBAL(protorp)
 	.long	0x8002,0	| prototype root pointer
+GLOBAL(delaydivisor)
+	.long	12		| should be enough for 80 MHz 68060
+| will be adapted to other CPUs in
+| start_c_cleanup and calibrated
+| at clock attach time.
 
 GLOBAL(proc0paddr)
 	.long	0		| KVA of proc0 u-area

Index: src/sys/arch/amiga/dev/clock.c
diff -u src/sys/arch/amiga/dev/clock.c:1.47.20.3 src/sys/arch/amiga/dev/clock.c:1.47.20.4
--- src/sys/arch/amiga/dev/clock.c:1.47.20.3	Sat Oct  3 23:37:31 2009
+++ src/sys/arch/amiga/dev/clock.c	Fri Jul 16 18:26:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.47.20.3 2009/10/03 23:37:31 snj Exp $ */
+/*	$NetBSD: clock.c,v 1.47.20.4 2010/07/16 18:26:12 riz Exp $ */
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.47.20.3 2009/10/03 23:37:31 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.47.20.4 2010/07/16 18:26:12 riz Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -100,26 +100,6 @@
 #include sys/PROF.h
 #endif
 
-/* the clocks run at NTSC: 715.909kHz or PAL: 709.379kHz.
-   We're using a 100 Hz clock. */
-int amiga_clk_interval;
-int eclockfreq;
-unsigned int 

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

2010-07-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Jul 16 18:40:39 UTC 2010

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

Log Message:
Apply patches (requested by chs in ticket #1424):
sys/arch/amd64/amd64/netbsd32_machdep.c: patch
sys/arch/i386/i386/trap.c:   patch
Fix several panics that can be caused by applications using
bad segment register values with setcontext() or sigreturn().


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.241.4.2 -r1.241.4.3 src/sys/arch/i386/i386/trap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.2
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.1	Sat Oct  3 23:34:48 2009
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Fri Jul 16 18:40:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.1 2009/10/03 23:34:48 snj Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.1 2009/10/03 23:34:48 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_coredump.h
@@ -942,7 +942,9 @@
 static int
 check_sigcontext32(const struct netbsd32_sigcontext *scp, struct trapframe *tf)
 {
-	if (((scp-sc_eflags ^ tf-tf_rflags)  PSL_USERSTATIC) != 0)
+
+	if (((scp-sc_eflags ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
+	scp-sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
 		return EINVAL;
 	if (scp-sc_fs != 0  !VALID_USER_DSEL32(scp-sc_fs))
 		return EINVAL;
@@ -964,7 +966,8 @@
 
 	gr = mcp-__gregs;
 
-	if (((gr[_REG32_EFL] ^ tf-tf_rflags)  PSL_USERSTATIC) != 0)
+	if (((gr[_REG32_EFL] ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
+	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0  !VALID_USER_DSEL32(gr[_REG32_FS]))
 		return EINVAL;

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.241.4.2 src/sys/arch/i386/i386/trap.c:1.241.4.3
--- src/sys/arch/i386/i386/trap.c:1.241.4.2	Thu May 20 05:51:59 2010
+++ src/sys/arch/i386/i386/trap.c	Fri Jul 16 18:40:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.241.4.3 2010/07/16 18:40:39 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.3 2010/07/16 18:40:39 riz Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -401,6 +401,7 @@
 		 * returning from a trap, syscall, or interrupt.
 		 */
 
+kern_pagefault:
 		KSI_INIT_TRAP(ksi);
 		ksi.ksi_signo = SIGSEGV;
 		ksi.ksi_code = SEGV_ACCERR;
@@ -427,7 +428,8 @@
 			break;
 		case 0x8e:
 			switch (*(uint32_t *)frame-tf_eip) {
-			case 0x8e242c8e:	/* mov (%esp,%gs), then */
+			case 0x8e242c8e:	/* mov (%esp),%gs */
+			case 0x00246c8e:	/* mov 0x0(%esp),%gs */
 			case 0x0424648e:	/* mov 0x4(%esp),%fs */
 			case 0x0824448e:	/* mov 0x8(%esp),%es */
 			case 0x0c245c8e:	/* mov 0xc(%esp),%ds */
@@ -734,7 +736,7 @@
 goto copyfault;
 			printf(uvm_fault(%p, %#lx, %d) - %#x\n,
 			map, va, ftype, error);
-			goto we_re_toast;
+			goto kern_pagefault;
 		}
 		if (error == ENOMEM) {
 			ksi.ksi_signo = SIGKILL;



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

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:51:59 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: trap.c vector.S

Log Message:
Pull up following revision(s) (requested by riz in ticket #1401):
sys/arch/i386/i386/trap.c: revisions 1.251-1.253 via patch
sys/arch/i386/i386/vector.S: revisions 1.50-1.51 via patch
If we fault on the 'iret' during return to userpace (eg if %eip is outside
the bounds of %cs) then hack the stack to contain a normal fault frame
for the signal setup code (etc).
Previously the code assumed that the original user trap frame was still
present - at it is for faults when loading the segment registers.
--
If we fault on the iret during return to userspace, see if we need to
do a lazy update of %cs to make the stack executable.
If a change is made, just retry the failing sequence.
Signal handlers as gcc nested local functions now work!
--
Fix 'fault on load of %gs during retirn to userspace' to look for the
 correct instruction bytes.
Take the 'fault on load segment register' through the same path as 'fault
 on iret' so we don't have to fixup the broken stackframe that contains a
 mix of user and kernel registers,
Update comments about how the faults during return to userspace are processed.
Setting an invalid %gs in the saved context of a signal handler causes
 a SIGSEGV handler to be entered with what look like valid registers.


To generate a diff of this commit:
cvs rdiff -u -r1.241.4.1 -r1.241.4.2 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.42.6.2 -r1.42.6.3 src/sys/arch/i386/i386/vector.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/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.241.4.1 src/sys/arch/i386/i386/trap.c:1.241.4.2
--- src/sys/arch/i386/i386/trap.c:1.241.4.1	Fri Mar 27 17:25:15 2009
+++ src/sys/arch/i386/i386/trap.c	Thu May 20 05:51:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $	*/
+/*	$NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -131,6 +131,7 @@
 static inline int xmm_si_code(struct lwp *);
 void trap(struct trapframe *);
 void trap_tss(struct i386tss *, int, int);
+void trap_return_fault_return(struct trapframe *) __dead;
 
 #ifdef KVM86
 #include machine/kvm86.h
@@ -276,7 +277,7 @@
 	struct proc *p;
 	int type = frame-tf_trapno;
 	struct pcb *pcb;
-	extern char fusubail[], kcopy_fault[], trapreturn[], IDTVEC(osyscall)[];
+	extern char fusubail[], kcopy_fault[], IDTVEC(osyscall)[];
 	struct trapframe *vframe;
 	ksiginfo_t ksi;
 	void *onfault;
@@ -392,67 +393,76 @@
 
 		/*
 		 * Check for failure during return to user mode.
+		 * This can happen loading invalid values into the segment
+		 * registers, or during the 'iret' itself.
 		 *
 		 * We do this by looking at the instruction we faulted on.
 		 * The specific instructions we recognize only happen when
 		 * returning from a trap, syscall, or interrupt.
-		 *
-		 * At this point, there are (at least) two trap frames on
-		 * the kernel stack; we presume here that we faulted while
-		 * loading our registers out of the outer one.
 		 */
+
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGSEGV;
+		ksi.ksi_code = SEGV_ACCERR;
+		ksi.ksi_trap = type;
+
 		switch (*(u_char *)frame-tf_eip) {
 		case 0xcf:	/* iret */
-			vframe = (void *)((int)frame-tf_esp -
+			/*
+			 * The 'iret' instruction faulted, so we have the
+			 * 'user' registers saved after the kernel %eip:%cs:%fl
+			 * of the 'iret' and below that the user %eip:%cs:%fl
+			 * the 'iret' was processing.
+			 * We must delete the 3 words of kernel return address
+			 * from the stack to generate a normal stack frame
+			 * (eg for sending a SIGSEGV).
+			 */
+			vframe = (void *)((int *)frame + 3);
+			if (KERNELMODE(vframe-tf_cs, vframe-tf_eflags))
+goto we_re_toast;
+			memmove(vframe, frame,
 			offsetof(struct trapframe, tf_eip));
+			/* Set the faulting address to the user %eip */
+			ksi.ksi_addr = (void *)vframe-tf_eip;
 			break;
 		case 0x8e:
 			switch (*(uint32_t *)frame-tf_eip) {
-			case 0x0c245c8e:	/* movl 0xc(%esp,1),%ds */
-			case 0x0824448e:	/* movl 0x8(%esp,1),%es */
-			case 0x0424648e:	/* movl 0x4(%esp,1),%fs */
-			case 0x00246c8e:	/* movl 0x0(%esp,1),%gs */
+			case 0x8e242c8e:	/* mov (%esp,%gs), then */
+			case 0x0424648e:	/* mov 0x4(%esp),%fs */
+			case 0x0824448e:	/* mov 0x8(%esp),%es */
+			case 0x0c245c8e:	/* mov 0xc(%esp),%ds */
 break;
 			default:
 goto we_re_toast;
 			}
-			vframe = (void *)(int)frame-tf_esp;
+			/*
+			 * We faulted loading 

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

2010-04-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 22 19:54:34 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: locore.S

Log Message:
Pull up following revision(s) (requested by jym in ticket #1376):
sys/arch/amd64/amd64/locore.S: revision 1.56
When kernel remaps to high memory in amd64 locore, the GDT used before
becomes invalid. As such, split it in two parts, one for use when system
boots in low memory, and one for use when it jumps to high memory.


To generate a diff of this commit:
cvs rdiff -u -r1.47.8.2 -r1.47.8.3 src/sys/arch/amd64/amd64/locore.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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.47.8.2 src/sys/arch/amd64/amd64/locore.S:1.47.8.3
--- src/sys/arch/amd64/amd64/locore.S:1.47.8.2	Mon Feb  2 03:24:05 2009
+++ src/sys/arch/amd64/amd64/locore.S	Thu Apr 22 19:54:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.47.8.2 2009/02/02 03:24:05 snj Exp $	*/
+/*	$NetBSD: locore.S,v 1.47.8.3 2010/04/22 19:54:34 snj Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -274,13 +274,25 @@
 #define	RELOC(x)	_RELOC(_C_LABEL(x))
 
 #ifndef XEN
-	.globl	gdt64
+	.globl	gdt64_lo
+	.globl	gdt64_hi
 
-gdt64:
-	.word	gdt64_end-gdt64_start
+#define GDT64_LIMIT gdt64_end-gdt64_start-1
+
+/* Temporary gdt64, with base address in low memory */
+gdt64_lo:
+	.word	GDT64_LIMIT
 	.quad	_RELOC(gdt64_start)
 .align 64
 
+/* Temporary gdt64, with base address in high memory */
+gdt64_hi:
+	.word	GDT64_LIMIT
+	.quad	gdt64_start
+.align 64
+
+#undef GDT64_LIMIT
+
 gdt64_start:
 	.quad 0x	/* always empty */
 	.quad 0x00af9a00	/* kernel CS */
@@ -643,7 +655,7 @@
 	 * in it to do that.
 	 */
 
-	movl	$RELOC(gdt64),%eax
+	movl	$RELOC(gdt64_lo),%eax
 	lgdt	(%eax)
 	movl	$RELOC(farjmp64),%eax
 	ljmp	*(%eax)
@@ -659,9 +671,17 @@
 	 */
 	movabsq	$longmode_hi,%rax
 	jmp	*%rax
+
 longmode_hi:
+
+	/*
+	 * We left the identity mapped area. Base address of
+	 * the temporary gdt64 should now be in high memory.
+	 */
+	movq	$RELOC(gdt64_hi),%rax
+	lgdt	(%rax)
+
 	/*
-	 * We have arrived.
 	 * There's no need anymore for the identity mapping in low
 	 * memory, remove it.
 	 */



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

2010-04-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 22 19:56:45 UTC 2010

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: identcpu.c

Log Message:
Pull up following revision(s) (requested by jym in ticket #1377):
sys/arch/x86/x86/identcpu.c: revision 1.19
Fix a test semantic in cpu_probe(): check that the CPU currently probed
is the first one booting by comparing its struct cpu_info address with
cpu_info_primary, rather than supposing that cpu_feature variables are
set to 0.


To generate a diff of this commit:
cvs rdiff -u -r1.10.4.4 -r1.10.4.5 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.10.4.4 src/sys/arch/x86/x86/identcpu.c:1.10.4.5
--- src/sys/arch/x86/x86/identcpu.c:1.10.4.4	Mon Oct  5 11:37:14 2009
+++ src/sys/arch/x86/x86/identcpu.c	Thu Apr 22 19:56:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.10.4.4 2009/10/05 11:37:14 sborrill Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.10.4.5 2010/04/22 19:56:44 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.10.4.4 2009/10/05 11:37:14 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.10.4.5 2010/04/22 19:56:44 snj Exp $);
 
 #include opt_enhanced_speedstep.h
 #include opt_intel_odcm.h
@@ -623,7 +623,7 @@
 		wrmsr(MSR_MISC_ENABLE, rdmsr(MSR_MISC_ENABLE) | (13));
 	}
 
-	if ((cpu_feature | cpu_feature2) == 0) {
+	if (ci == cpu_info_primary) {
 		/* If first. */
 		cpu_feature = ci-ci_feature_flags;
 		cpu_feature2 = ci-ci_feature2_flags;



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

2010-04-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 22 20:02:49 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: locore.S machdep.c mptramp.S
src/sys/arch/i386/i386 [netbsd-5]: machdep.c
src/sys/arch/i386/isa [netbsd-5]: npx.c
src/sys/arch/x86/include [netbsd-5]: cpu.h cpuvar.h
src/sys/arch/x86/x86 [netbsd-5]: cpu.c cpu_topology.c identcpu.c pmap.c
src/sys/arch/xen/x86 [netbsd-5]: cpu.c

Log Message:
Apply patch (requested by jym in ticket #1380):
Fix the NX regression issue observed on amd64 kernels, where per-page
execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).


To generate a diff of this commit:
cvs rdiff -u -r1.47.8.3 -r1.47.8.4 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.102.4.12 -r1.102.4.13 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.9 -r1.9.8.1 src/sys/arch/amd64/amd64/mptramp.S
cvs rdiff -u -r1.644.4.11 -r1.644.4.12 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.129.10.5 -r1.129.10.6 src/sys/arch/i386/isa/npx.c
cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.27.8.2 -r1.27.8.3 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.57.4.3 -r1.57.4.4 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/sys/arch/x86/x86/cpu_topology.c
cvs rdiff -u -r1.10.4.5 -r1.10.4.6 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.74.4.2 -r1.74.4.3 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.28.4.1 -r1.28.4.2 src/sys/arch/xen/x86/cpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.47.8.3 src/sys/arch/amd64/amd64/locore.S:1.47.8.4
--- src/sys/arch/amd64/amd64/locore.S:1.47.8.3	Thu Apr 22 19:54:34 2010
+++ src/sys/arch/amd64/amd64/locore.S	Thu Apr 22 20:02:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.47.8.3 2010/04/22 19:54:34 snj Exp $	*/
+/*	$NetBSD: locore.S,v 1.47.8.4 2010/04/22 20:02:48 snj Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -235,7 +235,7 @@
 #endif
 
 	.globl	_C_LABEL(cpu_id),_C_LABEL(cpu_vendorname), _C_LABEL(cpu_brand_id)
-	.globl	_C_LABEL(cpuid_level),_C_LABEL(cpu_feature),_C_LABEL(cpu_feature2)
+	.globl	_C_LABEL(cpuid_level)
 	.globl	_C_LABEL(esym),_C_LABEL(eblob),_C_LABEL(boothowto)
 	.globl	_C_LABEL(bootinfo),_C_LABEL(atdevbase)
 	.globl	_C_LABEL(proc0paddr),_C_LABEL(PDPpaddr)
@@ -245,10 +245,6 @@
 _C_LABEL(cpu):		.long	0	# are we 386, 386sx, or 486,
 	#   or Pentium, or..
 _C_LABEL(cpu_id):	.long	0	# saved from `cpuid' instruction
-_C_LABEL(cpu_feature):	.long	0	# feature flags from 'cpuid'
-	#   instruction
-_C_LABEL(cpu_feature2):	.long	0	# feature flags from 'cpuid'
-	#   instruction
 _C_LABEL(cpuid_level):	.long	-1	# max. level accepted by 'cpuid'
 	#   instruction
 _C_LABEL(cpu_vendorname):	.space	16	# vendor string returned by `cpuid'
@@ -300,7 +296,7 @@
 gdt64_end:
 
 farjmp64:
-	.long	longmode-KERNBASE
+	.long	_RELOC(longmode)
 	.word	GSEL(GCODE_SEL, SEL_KPL)
 	
 #endif	/* !XEN */
@@ -423,18 +419,11 @@
 	movl	$1,%eax
 	cpuid
 	movl	%eax,RELOC(cpu_id)
-	movl	%edx,RELOC(cpu_feature)
-	movl	%ecx,RELOC(cpu_feature2)
 
 	/* Brand ID is bits 0-7 of %ebx */
 	andl	$255,%ebx
 	movl	%ebx,RELOC(cpu_brand_id)
 
-	/* add AMD specific feature flags */
-	movl	$0x8001,%eax
-	cpuid
-	orl	%edx,RELOC(cpu_feature)
-
 	/*
 	 * Finished with old stack; load new %esp now instead of later so we
 	 * can trace this code without having to worry about the trace trap

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.102.4.12 src/sys/arch/amd64/amd64/machdep.c:1.102.4.13
--- src/sys/arch/amd64/amd64/machdep.c:1.102.4.12	Tue Dec  1 19:29:54 2009
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Apr 22 20:02:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.102.4.12 2009/12/01 19:29:54 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.102.4.13 2010/04/22 20:02:48 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -112,7 +112,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.12 2009/12/01 19:29:54 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102.4.13 2010/04/22 20:02:48 snj Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -1392,9 +1392,9 @@
 	__PRINTK((init_x86_64(0x%lx)\n, first_avail));
 	first_bt_vaddr = (vaddr_t) (first_avail + KERNBASE + PAGE_SIZE * 2);
 	__PRINTK((first_bt_vaddr 0x%lx\n, first_bt_vaddr));
-	cpu_feature = cpu_info_primary.ci_feature_flags;
 	/* not on Xen... */
-	cpu_feature = ~(CPUID_PGE|CPUID_PSE|CPUID_MTRR|CPUID_FXSR|CPUID_NOX);
+	cpu_feature = ~(CPUID_PGE|CPUID_PSE|CPUID_MTRR|CPUID_FXSR);
+	cpu_feature3 = ~(CPUID_NOX);
 #endif /* XEN */
 
 	cpu_init_msrs(cpu_info_primary, true);

Index: src/sys/arch/amd64/amd64/mptramp.S
diff -u src/sys/arch/amd64/amd64/mptramp.S:1.9 

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

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 28 16:48:36 UTC 2010

Modified Files:
src/sys/arch/sparc64/dev [netbsd-5]: lom.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1349):
sys/arch/sparc64/dev/lom.c: revision 1.6
Fix off-by-one in LOMlite hostname code.  From rev 1.21 of OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.1.2.5 src/sys/arch/sparc64/dev/lom.c:1.1.2.6
--- src/sys/arch/sparc64/dev/lom.c:1.1.2.5	Sat Jan  9 01:30:13 2010
+++ src/sys/arch/sparc64/dev/lom.c	Sun Mar 28 16:48:36 2010
@@ -1,5 +1,5 @@
-/*	$NetBSD: lom.c,v 1.1.2.5 2010/01/09 01:30:13 snj Exp $	*/
-/*	$OpenBSD: lom.c,v 1.20 2009/12/12 13:01:00 kettenis Exp $	*/
+/*	$NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $	*/
+/*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
  *
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.5 2010/01/09 01:30:13 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.1.2.6 2010/03/28 16:48:36 snj Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -1035,7 +1035,7 @@
 static void
 lom1_write_hostname(struct lom_softc *sc)
 {
-	char name[LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1];
+	char name[(LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1) + 1];
 	char *p;
 	int i;
 
@@ -1045,7 +1045,7 @@
 	 * strip off the domain name.
 	 */
 	strlcpy(name, hostname, sizeof(name));
-	if (hostnamelen  sizeof(name)) {
+	if (hostnamelen = sizeof(name)) {
 		p = strchr(name, '.');
 		if (p)
 			*p = '\0';



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

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 28 17:07:26 UTC 2010

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

Log Message:
Apply patch (requested by bad in ticket #1347):
Make it possible to use netbsd-5 domUs running on a Xen2 hypervisor.
This changes two panics to printfs.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/arch/xen/xen/if_xennet.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet.c
diff -u src/sys/arch/xen/xen/if_xennet.c:1.60 src/sys/arch/xen/xen/if_xennet.c:1.60.2.1
--- src/sys/arch/xen/xen/if_xennet.c:1.60	Mon Oct 27 10:58:22 2008
+++ src/sys/arch/xen/xen/if_xennet.c	Sun Mar 28 17:07:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xennet.c,v 1.60 2008/10/27 10:58:22 cegger Exp $	*/
+/*	$NetBSD: if_xennet.c,v 1.60.2.1 2010/03/28 17:07:26 snj Exp $	*/
 
 /*
  *
@@ -33,7 +33,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_xennet.c,v 1.60 2008/10/27 10:58:22 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_xennet.c,v 1.60.2.1 2010/03/28 17:07:26 snj Exp $);
 
 #include opt_inet.h
 #include opt_nfs_boot.h
@@ -657,8 +657,10 @@
 	(void)HYPERVISOR_multicall(rx_mcl, nr_pfns+1);
 
 	/* Check return status of HYPERVISOR_dom_mem_op(). */
-	if ( rx_mcl[nr_pfns].args[5] != nr_pfns )
-		panic(Unable to reduce memory reservation\n);
+	if ( rx_mcl[nr_pfns].args[5] != nr_pfns ) {
+		printf(xennet_rx_push_buffer: unable to reduce memory 
+		reservation (%lu != %d)\n, rx_mcl[nr_pfns].args[5], nr_pfns);
+	}
 
 	/* Above is a suitable barrier to ensure backend will see requests. */
 	sc-sc_rx-req_prod = ringidx;
@@ -994,8 +996,10 @@
 	(void)HYPERVISOR_multicall(rx_mcl, nr_pfns+1);
 
 	/* Check return status of HYPERVISOR_dom_mem_op(). */
-	if (rx_mcl[nr_pfns].args[5] != nr_pfns)
-		panic(Unable to reduce memory reservation\n);
+	if (rx_mcl[nr_pfns].args[5] != nr_pfns) {
+		printf(xennet_alloc_rx_buffers: unable to reduce memory 
+		reservation (%lu != %d)\n, rx_mcl[nr_pfns].args[5], nr_pfns);
+	}
 
 	/* Above is a suitable barrier to ensure backend will see requests. */
 	sc-sc_rx-req_prod = ringidx;



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

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Mar 29 00:23:12 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by jym in ticket #1334):
sys/arch/xen/x86/xen_bus_dma.c: revision 1.20
Although Xen's documentation states that the address_bits field is not used
by XENMEM_decrease_reservation, it is checked by the hypervisor. In certain
circumstances (stack leak), the field could have an improper value, leading
to a fail of the hypercall.
Set it to 0 (no addressing restriction) to avoid that.
Patch tested by Sam Fourman and h...@.
This should fix the rare failed allocating DMA memory encountered
under NetBSD dom0.


To generate a diff of this commit:
cvs rdiff -u -r1.11.8.1 -r1.11.8.2 src/sys/arch/xen/x86/xen_bus_dma.c

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

Modified files:

Index: src/sys/arch/xen/x86/xen_bus_dma.c
diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.1 src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.2
--- src/sys/arch/xen/x86/xen_bus_dma.c:1.11.8.1	Sat Jan 30 19:14:20 2010
+++ src/sys/arch/xen/x86/xen_bus_dma.c	Mon Mar 29 00:23:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $	*/
+/*	$NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $	*/
 /*	NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.11.8.1 2010/01/30 19:14:20 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_bus_dma.c,v 1.11.8.2 2010/03/29 00:23:12 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -99,6 +99,7 @@
 		res.extent_start = mfn;
 		res.nr_extents = 1;
 		res.extent_order = 0;
+		res.address_bits = 0;
 		res.domid = DOMID_SELF;
 		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation, res)
 		 0) {



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

2010-03-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Mar 17 03:10:40 UTC 2010

Modified Files:
src/sys/arch/sparc64/include [netbsd-5]: pmap.h
src/sys/arch/sparc64/sparc64 [netbsd-5]: cache.h ipifuncs.c locore.s
machdep.c pmap.c

Log Message:
Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
  properly handle flushes in all cpus as necessary


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.14.1 src/sys/arch/sparc64/include/pmap.h
cvs rdiff -u -r1.10 -r1.10.66.1 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.22 -r1.22.8.1 src/sys/arch/sparc64/sparc64/ipifuncs.c
cvs rdiff -u -r1.286.2.1 -r1.286.2.2 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.227.4.1 -r1.227.4.2 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.225.4.1 -r1.225.4.2 src/sys/arch/sparc64/sparc64/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/sparc64/include/pmap.h
diff -u src/sys/arch/sparc64/include/pmap.h:1.40 src/sys/arch/sparc64/include/pmap.h:1.40.14.1
--- src/sys/arch/sparc64/include/pmap.h:1.40	Fri Mar 14 15:40:02 2008
+++ src/sys/arch/sparc64/include/pmap.h	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.40 2008/03/14 15:40:02 nakayama Exp $	*/
+/*	$NetBSD: pmap.h,v 1.40.14.1 2010/03/17 03:10:39 snj Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -212,6 +212,9 @@
 void sp_tlb_flush_ctx(int);
 void sp_tlb_flush_all(void);
 
+void		pmap_copy_page_phys(paddr_t, paddr_t);
+void		pmap_zero_page_phys(paddr_t);
+
 #ifdef MULTIPROCESSOR
 void smp_tlb_flush_pte(vaddr_t, pmap_t);
 void smp_tlb_flush_ctx(pmap_t);

Index: src/sys/arch/sparc64/sparc64/cache.h
diff -u src/sys/arch/sparc64/sparc64/cache.h:1.10 src/sys/arch/sparc64/sparc64/cache.h:1.10.66.1
--- src/sys/arch/sparc64/sparc64/cache.h:1.10	Sat Oct 21 23:49:29 2006
+++ src/sys/arch/sparc64/sparc64/cache.h	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.h,v 1.10 2006/10/21 23:49:29 mrg Exp $ */
+/*	$NetBSD: cache.h,v 1.10.66.1 2010/03/17 03:10:39 snj Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -75,11 +75,21 @@
 /* The following are for I$ and D$ flushes and are in locore.s */
 void 	dcache_flush_page(paddr_t);	/* flush page from D$ */
 void 	icache_flush_page(paddr_t);	/* flush page from I$ */
-void 	blast_dcache(void);		/* Clear entire D$ */
+void 	sp_blast_dcache(void);		/* Clear entire D$ */
 void 	blast_icache(void);		/* Clear entire I$ */
 
 /* The following flush a range from the D$ and I$ but not E$. */
 void	cache_flush_phys(paddr_t, psize_t, int);
 
+#ifdef MULTIPROCESSOR
+void smp_blast_dcache(sparc64_cpuset_t);
+void smp_dcache_flush_page_all(paddr_t pa);
+#define dcache_flush_page_all(pa)	smp_dcache_flush_page_all(pa)
+#define blast_dcache()  smp_blast_dcache(cpus_active)
+#else
+#define dcache_flush_page_all(pa)	dcache_flush_page(pa)
+#define blast_dcache()			sp_blast_dcache()
+#endif
+
 /* Smallest E$ line size. */
 extern	int	ecache_min_line_size;

Index: src/sys/arch/sparc64/sparc64/ipifuncs.c
diff -u src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22 src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22.8.1
--- src/sys/arch/sparc64/sparc64/ipifuncs.c:1.22	Sat May 31 08:00:34 2008
+++ src/sys/arch/sparc64/sparc64/ipifuncs.c	Wed Mar 17 03:10:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.22 2008/05/31 08:00:34 nakayama Exp $ */
+/*	$NetBSD: ipifuncs.c,v 1.22.8.1 2010/03/17 03:10:39 snj Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.22 2008/05/31 08:00:34 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: ipifuncs.c,v 1.22.8.1 2010/03/17 03:10:39 snj Exp $);
 
 #include opt_ddb.h
 
@@ -44,6 +44,8 @@
 #include machine/pmap.h
 #include machine/sparc64.h
 
+#include sparc64/sparc64/cache.h
+
 #if defined(DDB) || defined(KGDB)
 #ifdef DDB
 #include ddb/db_command.h
@@ -69,6 +71,8 @@
 void	sparc64_ipi_flush_pte(void *);
 void	sparc64_ipi_flush_ctx(void *);
 void	sparc64_ipi_flush_all(void *);
+void	sparc64_ipi_dcache_flush_page(void *);
+void	sparc64_ipi_blast_dcache(void *);
 
 /*
  * Process cpu stop-self event.
@@ -412,6 +416,34 @@
 	sparc64_broadcast_ipi(sparc64_ipi_flush_all, 0, 0);
 }
 
+/* XXX Spitfire specific for netbsd-5 branch */
+#define dcache_line_size	32
+#define dcache_size		(16 * 1024)
+
+/*
+ * Make sure this page is flushed from all CPUs.
+ */
+void
+smp_dcache_flush_page_all(paddr_t pa)
+{
+
+	sparc64_broadcast_ipi(sparc64_ipi_dcache_flush_page, pa,
+			  dcache_line_size);
+	dcache_flush_page(pa);
+}
+
+/*
+ * Flush the D$ on this set of CPUs.
+ */
+void
+smp_blast_dcache(sparc64_cpuset_t activecpus)
+{
+
+	sparc64_multicast_ipi(activecpus, sparc64_ipi_blast_dcache,
+			  dcache_size, dcache_line_size);
+	

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

2010-02-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Feb 16 21:24:15 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: ibcs2_machdep.c svr4_machdep.c

Log Message:
Pull up following revision(s) (requested by drochner in ticket #1307):
sys/arch/i386/i386/svr4_machdep.c: revision 1.96
sys/arch/i386/i386/ibcs2_machdep.c: revision 1.40
fix confused CS selector, fixes the panic reported by Mark Davis
per PR port-i386/42787 (the panic happens due to a GPF when a
privileged descriptor is tried to be loaded with the UPL bit set)
The original bug is very old (pre-2.0, i386/svr4_machdep.c rev. 1.69),
but it was relatively harmless until the order of GDT entries was
shuffled (pre-5.0, i386/segments.h rev. 1.42). Before, it caused
a userlevel data selector to be used for CS which broke the emulation
(likely the reason of PR port-i386/32424). The shuffle made that
a privileged selector was used, causing the GPF.
(recent -current doesn't panic on that GPF which seems to be a
side effect of another change)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/arch/i386/i386/ibcs2_machdep.c
cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/i386/i386/svr4_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/i386/i386/ibcs2_machdep.c
diff -u src/sys/arch/i386/i386/ibcs2_machdep.c:1.36 src/sys/arch/i386/i386/ibcs2_machdep.c:1.36.10.1
--- src/sys/arch/i386/i386/ibcs2_machdep.c:1.36	Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/i386/ibcs2_machdep.c	Tue Feb 16 21:24:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_machdep.c,v 1.36 2008/04/28 20:23:24 martin Exp $	*/
+/*	$NetBSD: ibcs2_machdep.c,v 1.36.10.1 2010/02/16 21:24:15 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ibcs2_machdep.c,v 1.36 2008/04/28 20:23:24 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: ibcs2_machdep.c,v 1.36.10.1 2010/02/16 21:24:15 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vm86.h
@@ -78,7 +78,7 @@
 		pcb-pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
 	tf = l-l_md.md_regs;
 	tf-tf_eax = 0x200;		/* XXX base of heap */
-	tf-tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+	tf-tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 /*

Index: src/sys/arch/i386/i386/svr4_machdep.c
diff -u src/sys/arch/i386/i386/svr4_machdep.c:1.92 src/sys/arch/i386/i386/svr4_machdep.c:1.92.4.1
--- src/sys/arch/i386/i386/svr4_machdep.c:1.92	Fri Sep 19 19:15:58 2008
+++ src/sys/arch/i386/i386/svr4_machdep.c	Tue Feb 16 21:24:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $	 */
+/*	$NetBSD: svr4_machdep.c,v 1.92.4.1 2010/02/16 21:24:15 bouyer Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.92.4.1 2010/02/16 21:24:15 bouyer Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_vm86.h
@@ -119,7 +119,7 @@
 		pcb-pcb_savefpu.sv_xmm.sv_env.en_cw = __SVR4_NPXCW__;
 	else
 		pcb-pcb_savefpu.sv_87.sv_env.en_cw = __SVR4_NPXCW__;
-	tf-tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+	tf-tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 void *



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

2010-02-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb 15 18:04:11 UTC 2010

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

Log Message:
Pull up the following revisions(s) (requested by tron in ticket #1306):
sys/arch/i386/conf/XEN2_DOM0patch
sys/arch/i386/conf/XEN2_DOMUpatch
sys/arch/amd64/conf/XEN3_DOM0   patch
sys/arch/amd64/conf/XEN3_DOM0   patch

Enable cgd(4) support on all amd64 and i386 XEN kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.33.4.3 -r1.33.4.4 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.13.4.1 -r1.13.4.2 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.53.2.3 -r1.53.2.4 src/sys/arch/i386/conf/XEN2_DOM0
cvs rdiff -u -r1.19.4.1 -r1.19.4.2 src/sys/arch/i386/conf/XEN2_DOMU

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.3 src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.4
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.33.4.3	Sat Oct  3 23:57:54 2009
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Mon Feb 15 18:04:11 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.33.4.3 2009/10/03 23:57:54 snj Exp $
+# $NetBSD: XEN3_DOM0,v 1.33.4.4 2010/02/15 18:04:11 sborrill Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -742,7 +742,7 @@
 # disk/mass storage pseudo-devices
 pseudo-device	bio			# RAID control device driver
 pseudo-device	ccd		4	# concatenated/striped disk devices
-#pseudo-device	cgd		4	# cryptographic disk devices
+pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	raid		8	# RAIDframe disk driver
 options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
 # Options to enable various other RAIDframe RAID types.

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.1 src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.2
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.13.4.1	Sat Oct  3 23:55:43 2009
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Mon Feb 15 18:04:11 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.13.4.1 2009/10/03 23:55:43 snj Exp $
+# $NetBSD: XEN3_DOMU,v 1.13.4.2 2010/02/15 18:04:11 sborrill Exp $
 
 include 	arch/amd64/conf/std.xen
 
@@ -177,7 +177,7 @@
 
 # disk/mass storage pseudo-devices
 pseudo-device	ccd		4	# concatenated/striped disk devices
-#pseudo-device	cgd		4	# cryptographic disk devices
+pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	raid		8	# RAIDframe disk driver
 options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
 # Options to enable various other RAIDframe RAID types.

Index: src/sys/arch/i386/conf/XEN2_DOM0
diff -u src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.3 src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.4
--- src/sys/arch/i386/conf/XEN2_DOM0:1.53.2.3	Sat Sep 26 19:52:09 2009
+++ src/sys/arch/i386/conf/XEN2_DOM0	Mon Feb 15 18:04:11 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN2_DOM0,v 1.53.2.3 2009/09/26 19:52:09 snj Exp $
+# $NetBSD: XEN2_DOM0,v 1.53.2.4 2010/02/15 18:04:11 sborrill Exp $
 
 include 	arch/xen/conf/std.xen
 
@@ -712,7 +712,7 @@
 # disk/mass storage pseudo-devices
 pseudo-device	bio			# RAID control device driver
 pseudo-device	ccd		4	# concatenated/striped disk devices
-#pseudo-device	cgd		4	# cryptographic disk devices
+pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	raid		8	# RAIDframe disk driver
 options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
 # Options to enable various other RAIDframe RAID types.

Index: src/sys/arch/i386/conf/XEN2_DOMU
diff -u src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.1 src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.2
--- src/sys/arch/i386/conf/XEN2_DOMU:1.19.4.1	Tue Nov 18 01:56:59 2008
+++ src/sys/arch/i386/conf/XEN2_DOMU	Mon Feb 15 18:04:11 2010
@@ -1,4 +1,4 @@
-# $NetBSD: XEN2_DOMU,v 1.19.4.1 2008/11/18 01:56:59 snj Exp $
+# $NetBSD: XEN2_DOMU,v 1.19.4.2 2010/02/15 18:04:11 sborrill Exp $
 
 include 	arch/xen/conf/std.xen
 
@@ -187,7 +187,7 @@
 
 # disk/mass storage pseudo-devices
 pseudo-device	ccd		4	# concatenated/striped disk devices
-#pseudo-device	cgd		4	# cryptographic disk devices
+pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	raid		8	# RAIDframe disk driver
 options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
 # Options to enable various other RAIDframe RAID types.



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

2010-02-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Feb 14 13:57:11 UTC 2010

Modified Files:
src/sys/arch/hp700/conf [netbsd-5]: GENERIC

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1301):
sys/arch/hp700/conf/GENERIC: revision 1.92
Add USERCONF as per all other GENERIC kernels


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.83.4.1 src/sys/arch/hp700/conf/GENERIC

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

Modified files:

Index: src/sys/arch/hp700/conf/GENERIC
diff -u src/sys/arch/hp700/conf/GENERIC:1.83 src/sys/arch/hp700/conf/GENERIC:1.83.4.1
--- src/sys/arch/hp700/conf/GENERIC:1.83	Sun Aug 10 15:31:21 2008
+++ src/sys/arch/hp700/conf/GENERIC	Sun Feb 14 13:57:11 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.83 2008/08/10 15:31:21 tls Exp $
+# $NetBSD: GENERIC,v 1.83.4.1 2010/02/14 13:57:11 bouyer Exp $
 #
 # GENERIC machine description file
 # 
@@ -23,7 +23,7 @@
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		GENERIC-$Revision: 1.83 $
+#ident 		GENERIC-$Revision: 1.83.4.1 $
 
 maxusers	32		# estimated number of users
 
@@ -60,6 +60,7 @@
 options 	P1003_1B_SEMAPHORE # p1003.1b semaphore support
 
 options 	LKM		# loadable kernel modules
+options 	USERCONF	# userconf(4) support
 
 # Enable experimental buffer queue strategy for better responsiveness under 
 # high disk I/O load. Use it with caution - it's not proven to be stable yet.



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

2010-02-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Feb 14 14:01:08 UTC 2010

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c

Log Message:
Pull up following revision(s) (requested by hubertf in ticket #1304):
sys/arch/i386/stand/boot/boot2.c: revision 1.48
When a password is set for the bootloader (installboot -o password=...),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:
 ...
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 Password: *
 Password: *
 Password: *
 unknown command
 commands are:
 boot [xdNx:][filename] [-12acdqsvxz]
  (ex. hd0a:netbsd.old -s
 ls [path]
 dev xd[N[x]]:
 consdev {pc|com[0123]|com[0123]kbd|auto}
 modules {enabled|disabled}
 load {path_to_module}
 multiboot [xdNx:][filename] [args]
 help|?
 quit
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 ...
This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:
 ...
 Choose an option; RETURN for default; SPACE to stop countdown.
 Option 1 will be chosen in 0 seconds.
 Password: 
 Password: 
 Password: 
 Wrong password.
 Choose an option; RETURN for default; SPACE to stop countdown.
 ...
Implement the latter behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/arch/i386/stand/boot/boot2.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/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.2
--- src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1	Sun Oct 18 16:41:28 2009
+++ src/sys/arch/i386/stand/boot/boot2.c	Sun Feb 14 14:01:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.38.4.1 2009/10/18 16:41:28 bouyer Exp $	*/
+/*	$NetBSD: boot2.c,v 1.38.4.2 2010/02/14 14:01:08 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -664,11 +664,23 @@
 #else
 		c = awaitkey((bootconf.timeout  0) ? 0 : bootconf.timeout, 1);
 #endif
-		if ((c != '\r')  (c != '\n')  (c != '\0') 
-		((boot_params.bp_flags  X86_BP_FLAGS_PASSWORD) == 0
-		 || check_password(boot_params.bp_password))) {
-			printf(type \?\ or \help\ for help.\n);
+		if ((c != '\r')  (c != '\n')  (c != '\0')) {
+		if ((boot_params.bp_flags  X86_BP_FLAGS_PASSWORD) == 0) {
+			/* do NOT ask for password */
 			bootmenu(); /* does not return */
+		} else {
+			/* DO ask for password */
+			if (check_password(boot_params.bp_password)) {
+			/* password ok */
+			printf(type \?\ or \help\ for help.\n);
+			bootmenu(); /* does not return */
+			} else {
+			/* bad password */
+			printf(Wrong password.\n);
+			currname = 0;
+			continue;
+			}
+		}
 		}
 
 		/*



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

2010-01-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan 30 19:12:26 UTC 2010

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1271):
sys/arch/xen/xen/privcmd.c: revision 1.40
Use paddr_t to store physical address and cast mfn values to paddr_t
before shift. Fix overflow issue preventing xend from working as
reported by Mark Davies on port-xen@


To generate a diff of this commit:
cvs rdiff -u -r1.33.4.1 -r1.33.4.2 src/sys/arch/xen/xen/privcmd.c

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

Modified files:

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.33.4.1 src/sys/arch/xen/xen/privcmd.c:1.33.4.2
--- src/sys/arch/xen/xen/privcmd.c:1.33.4.1	Sun Mar  8 03:19:50 2009
+++ src/sys/arch/xen/xen/privcmd.c	Sat Jan 30 19:12:26 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.33.4.1 2009/03/08 03:19:50 snj Exp $ */
+/* $NetBSD: privcmd.c,v 1.33.4.2 2010/01/30 19:12:26 snj Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -32,7 +32,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: privcmd.c,v 1.33.4.1 2009/03/08 03:19:50 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: privcmd.c,v 1.33.4.2 2010/01/30 19:12:26 snj Exp $);
 
 #include opt_compat_netbsd.h
 
@@ -362,7 +362,7 @@
 		privcmd_mmap_t *mcmd = ap-a_data;
 		privcmd_mmap_entry_t mentry;
 		vaddr_t va;
-		u_long ma;
+		paddr_t ma;
 		struct vm_map *vmm = curlwp-l_proc-p_vmspace-vm_map;
 
 		for (i = 0; i  mcmd-num; i++) {
@@ -383,7 +383,7 @@
 			if (maddr == NULL)
 return ENOMEM;
 			va = mentry.va  ~PAGE_MASK;
-			ma = mentry.mfn   PGSHIFT; /* XXX ??? */
+			ma = ((paddr_t)mentry.mfn)   PGSHIFT; /* XXX ??? */
 			for (j = 0; j  mentry.npages; j++) {
 maddr[j] = ma;
 ma += PAGE_SIZE;
@@ -400,7 +400,8 @@
 		int i;
 		privcmd_mmapbatch_t* pmb = ap-a_data;
 		vaddr_t va0, va;
-		u_long mfn, ma;
+		u_long mfn;
+		paddr_t ma;
 		struct vm_map *vmm;
 		struct vm_map_entry *entry;
 		vm_prot_t prot;
@@ -446,7 +447,7 @@
 UVM_KMF_VAONLY);
 return error;
 			}
-			ma = mfn  PGSHIFT;
+			ma = ((paddr_t)mfn)  PGSHIFT;
 			if (pmap_enter_ma(pmap_kernel(), trymap, ma, 0,
 			prot, PMAP_CANFAIL, pmb-dom)) {
 mfn |= 0xF000;



  1   2   3   >