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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 13:44:17 UTC 2023

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: cpuswitch.S locore.S
src/sys/arch/arm/arm [netbsd-9]: armv6_start.S
src/sys/arch/arm/arm32 [netbsd-9]: cpuswitch.S
src/sys/arch/evbmips/ingenic [netbsd-9]: cpu_startup.S
src/sys/arch/hppa/include [netbsd-9]: cpu.h
src/sys/arch/ia64/ia64 [netbsd-9]: machdep.c vm_machdep.c
src/sys/arch/mips/include [netbsd-9]: asm.h
src/sys/arch/mips/mips [netbsd-9]: locore.S locore_mips3.S
src/sys/arch/powerpc/powerpc [netbsd-9]: locore_subr.S
src/sys/arch/sparc/sparc [netbsd-9]: locore.s
src/sys/arch/sparc64/sparc64 [netbsd-9]: locore.s
src/sys/arch/vax/vax [netbsd-9]: subr.S

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1676):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.


To generate a diff of this commit:
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.39.2.5 -r1.39.2.6 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/arm/arm/armv6_start.S
cvs rdiff -u -r1.93 -r1.93.4.1 src/sys/arch/arm/arm32/cpuswitch.S
cvs rdiff -u -r1.1 -r1.1.26.1 src/sys/arch/evbmips/ingenic/cpu_startup.S
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/hppa/include/cpu.h
cvs rdiff -u -r1.43 -r1.43.4.1 src/sys/arch/ia64/ia64/machdep.c
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/ia64/ia64/vm_machdep.c
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.219.4.1 -r1.219.4.2 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.114 -r1.114.8.1 src/sys/arch/mips/mips/locore_mips3.S
cvs rdiff -u -r1.57.4.2 -r1.57.4.3 src/sys/arch/powerpc/powerpc/locore_subr.S
cvs rdiff -u -r1.274 -r1.274.2.1 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.421 -r1.421.2.1 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/arch/vax/vax/subr.S

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



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 13:44:17 UTC 2023

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: cpuswitch.S locore.S
src/sys/arch/arm/arm [netbsd-9]: armv6_start.S
src/sys/arch/arm/arm32 [netbsd-9]: cpuswitch.S
src/sys/arch/evbmips/ingenic [netbsd-9]: cpu_startup.S
src/sys/arch/hppa/include [netbsd-9]: cpu.h
src/sys/arch/ia64/ia64 [netbsd-9]: machdep.c vm_machdep.c
src/sys/arch/mips/include [netbsd-9]: asm.h
src/sys/arch/mips/mips [netbsd-9]: locore.S locore_mips3.S
src/sys/arch/powerpc/powerpc [netbsd-9]: locore_subr.S
src/sys/arch/sparc/sparc [netbsd-9]: locore.s
src/sys/arch/sparc64/sparc64 [netbsd-9]: locore.s
src/sys/arch/vax/vax [netbsd-9]: subr.S

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1676):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284
(all via patch)

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.


To generate a diff of this commit:
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.39.2.5 -r1.39.2.6 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/arm/arm/armv6_start.S
cvs rdiff -u -r1.93 -r1.93.4.1 src/sys/arch/arm/arm32/cpuswitch.S
cvs rdiff -u -r1.1 -r1.1.26.1 src/sys/arch/evbmips/ingenic/cpu_startup.S
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/hppa/include/cpu.h
cvs rdiff -u -r1.43 -r1.43.4.1 src/sys/arch/ia64/ia64/machdep.c
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/ia64/ia64/vm_machdep.c
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.219.4.1 -r1.219.4.2 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.114 -r1.114.8.1 src/sys/arch/mips/mips/locore_mips3.S
cvs rdiff -u -r1.57.4.2 -r1.57.4.3 src/sys/arch/powerpc/powerpc/locore_subr.S
cvs rdiff -u -r1.274 -r1.274.2.1 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.421 -r1.421.2.1 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/arch/vax/vax/subr.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/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.1 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.2
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.1	Tue Dec 24 17:30:28 2019
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Mon Jul 31 13:44:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.11.4.2 2023/07/31 13:44:15 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.11.4.2 2023/07/31 13:44:15 martin Exp $")
 
 /*
  * At IPL_SCH

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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:16:22 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: aed.c
src/sys/arch/macppc/dev [netbsd-9]: aed.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1847):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/macppc/dev/aed.c

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



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 18:16:22 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-9]: aed.c
src/sys/arch/macppc/dev [netbsd-9]: aed.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1847):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/macppc/dev/aed.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/mac68k/dev/aed.c
diff -u src/sys/arch/mac68k/dev/aed.c:1.34 src/sys/arch/mac68k/dev/aed.c:1.34.8.1
--- src/sys/arch/mac68k/dev/aed.c:1.34	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/mac68k/dev/aed.c	Thu Jun 20 18:16:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.34 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: aed.c,v 1.34.8.1 2024/06/20 18:16:22 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34.8.1 2024/06/20 18:16:22 martin Exp $");
 
 #include "opt_adb.h"
 
@@ -164,6 +164,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(&new_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(&new_event);
 		break;

Index: src/sys/arch/macppc/dev/aed.c
diff -u src/sys/arch/macppc/dev/aed.c:1.30 src/sys/arch/macppc/dev/aed.c:1.30.8.1
--- src/sys/arch/macppc/dev/aed.c:1.30	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/macppc/dev/aed.c	Thu Jun 20 18:16:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: aed.c,v 1.30.8.1 2024/06/20 18:16:22 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.30 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.30.8.1 2024/06/20 18:16:22 martin Exp $");
 
 #include 
 #include 
@@ -167,6 +167,7 @@ aed_input(adb_event_t *event)
 			aed_dokeyupdown(&new_event);
 		break;
 	case ADBADDR_MS:
+		event->u.m.buttons |= aed_sc->sc_buttons;
 		new_event.u.m.buttons |= aed_sc->sc_buttons;
 		aed_handoff(&new_event);
 		break;



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

2019-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  9 15:59:53 UTC 2019

Modified Files:
src/sys/arch/amd64/conf [netbsd-9]: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf [netbsd-9]: GENERIC XEN3PAE_DOM0

Log Message:
Pull up following revision(s) (requested by rin in ticket #35):

sys/arch/amd64/conf/ALL: revision 1.121
sys/arch/i386/conf/XEN3PAE_DOM0: revision 1.14
sys/arch/amd64/conf/XEN3_DOM0: revision 1.168
sys/arch/i386/conf/GENERIC: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.534

xhci(4) is considered stable enough. So, remove misleading comments.

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.120.2.1 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.531 -r1.531.2.1 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.167 -r1.167.2.1 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.1208 -r1.1208.2.1 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/i386/conf/XEN3PAE_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/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.120 src/sys/arch/amd64/conf/ALL:1.120.2.1
--- src/sys/arch/amd64/conf/ALL:1.120	Wed Jul 24 23:13:46 2019
+++ src/sys/arch/amd64/conf/ALL	Fri Aug  9 15:59:52 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.120 2019/07/24 23:13:46 tnn Exp $
+# $NetBSD: ALL,v 1.120.2.1 2019/08/09 15:59:52 martin Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.120 $"
+#ident		"ALL-$Revision: 1.120.2.1 $"
 
 maxusers	64		# estimated number of users
 
@@ -1124,7 +1124,6 @@ urlphy* at mii? phy ?			# Realtek RTL815
 
 # PCI USB controllers
 xhci*	at pci?	dev ? function ?	# eXtensible Host Controller
-	# xhci is at best experimental
 ehci*	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci?	dev ? function ?	# Open Host Controller
 uhci*	at pci?	dev ? function ?	# Universal Host Controller (Intel)

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.531 src/sys/arch/amd64/conf/GENERIC:1.531.2.1
--- src/sys/arch/amd64/conf/GENERIC:1.531	Wed Jul 24 06:35:04 2019
+++ src/sys/arch/amd64/conf/GENERIC	Fri Aug  9 15:59:52 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.531 2019/07/24 06:35:04 msaitoh Exp $
+# $NetBSD: GENERIC,v 1.531.2.1 2019/08/09 15:59:52 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.531 $"
+#ident		"GENERIC-$Revision: 1.531.2.1 $"
 
 maxusers	64		# estimated number of users
 
@@ -894,7 +894,6 @@ urlphy* at mii? phy ?			# Realtek RTL815
 
 # PCI USB controllers
 xhci*	at pci?	dev ? function ?	# eXtensible Host Controller
-	# xhci is at best experimental
 ehci*	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci?	dev ? function ?	# Open Host Controller
 uhci*	at pci?	dev ? function ?	# Universal Host Controller (Intel)

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.167 src/sys/arch/amd64/conf/XEN3_DOM0:1.167.2.1
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.167	Mon May  6 02:24:37 2019
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Fri Aug  9 15:59:52 2019
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.167 2019/05/06 02:24:37 sevan Exp $
+# $NetBSD: XEN3_DOM0,v 1.167.2.1 2019/08/09 15:59:52 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -11,7 +11,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.167 $"
+#ident		"XEN3_DOM0-$Revision: 1.167.2.1 $"
 
 maxusers	32		# estimated number of users
 
@@ -570,7 +570,6 @@ wsmouse*	at pms? mux 0
 
 # PCI USB controllers
 xhci*	at pci? dev ? function ?	# eXtensible Host Controller
-	# xhci is at best experimental
 ehci*	at pci? dev ? function ?	# Enhanced Host Controller
 ohci*	at pci? dev ? function ?	# Open Host Controller
 uhci*	at pci? dev ? function ?	# Universal Host Controller (Intel)

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1208 src/sys/arch/i386/conf/GENERIC:1.1208.2.1
--- src/sys/arch/i386/conf/GENERIC:1.1208	Mon Jun 17 19:01:17 2019
+++ src/sys/arch/i386/conf/GENERIC	Fri Aug  9 15:59:52 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1208 2019/06/17 19:01:17 kamil Exp $
+# $NetBSD: GENERIC,v 1.1208.2.1 2019/08/09 15:59:52 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1208 $"
+#ident		"GENERIC-$Revision: 1.1208.2.1 $"
 
 maxusers	64		#

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

2019-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  9 15:59:53 UTC 2019

Modified Files:
src/sys/arch/amd64/conf [netbsd-9]: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf [netbsd-9]: GENERIC XEN3PAE_DOM0

Log Message:
Pull up following revision(s) (requested by rin in ticket #35):

sys/arch/amd64/conf/ALL: revision 1.121
sys/arch/i386/conf/XEN3PAE_DOM0: revision 1.14
sys/arch/amd64/conf/XEN3_DOM0: revision 1.168
sys/arch/i386/conf/GENERIC: revision 1.1210
sys/arch/amd64/conf/GENERIC: revision 1.534

xhci(4) is considered stable enough. So, remove misleading comments.

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.120.2.1 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.531 -r1.531.2.1 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.167 -r1.167.2.1 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.1208 -r1.1208.2.1 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/i386/conf/XEN3PAE_DOM0

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



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

2019-08-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 13 14:57:50 UTC 2019

Modified Files:
src/sys/arch/aarch64/include [netbsd-9]: armreg.h
src/sys/arch/arm/cortex [netbsd-9]: gtmr.c gtmr_var.h
src/sys/arch/arm/include [netbsd-9]: armreg.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #54):

sys/arch/aarch64/include/armreg.h: revision 1.26
sys/arch/arm/cortex/gtmr.c: revision 1.41
sys/arch/arm/include/armreg.h: revision 1.128
sys/arch/arm/cortex/gtmr_var.h: revision 1.12

Add support for physical timers and sprinkle isb where needed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/cortex/gtmr_var.h
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/arm/include/armreg.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/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.25 src/sys/arch/aarch64/include/armreg.h:1.25.2.1
--- src/sys/arch/aarch64/include/armreg.h:1.25	Sun Jun 16 15:16:15 2019
+++ src/sys/arch/aarch64/include/armreg.h	Tue Aug 13 14:57:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.25 2019/06/16 15:16:15 skrll Exp $ */
+/* $NetBSD: armreg.h,v 1.25.2.1 2019/08/13 14:57:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -1138,6 +1138,16 @@ gtmr_cntv_ctl_write(uint32_t val)
 	reg_cntv_ctl_el0_write(val);
 }
 
+/*
+ * Counter-timer Physical Timer Control register
+ */
+static __inline uint32_t
+gtmr_cntp_ctl_read(void)
+{
+
+	return reg_cntp_ctl_el0_read();
+}
+
 static __inline void
 gtmr_cntp_ctl_write(uint32_t val)
 {
@@ -1146,6 +1156,23 @@ gtmr_cntp_ctl_write(uint32_t val)
 }
 
 /*
+ * Counter-timer Physical Timer TimerValue register
+ */
+static __inline uint32_t
+gtmr_cntp_tval_read(void)
+{
+
+	return reg_cntp_tval_el0_read();
+}
+
+static __inline void
+gtmr_cntp_tval_write(uint32_t val)
+{
+
+	reg_cntp_tval_el0_write(val);
+}
+
+/*
  * Counter-timer Virtual Timer TimerValue register
  */
 static __inline uint32_t
@@ -1162,6 +1189,22 @@ gtmr_cntv_tval_write(uint32_t val)
 	reg_cntv_tval_el0_write(val);
 }
 
+/*
+ * Counter-timer Physical Timer CompareValue register
+ */
+static __inline uint64_t
+gtmr_cntp_cval_read(void)
+{
+
+	return reg_cntp_cval_el0_read();
+}
+
+static __inline void
+gtmr_cntp_cval_write(uint64_t val)
+{
+
+	reg_cntp_cval_el0_write(val);
+}
 
 /*
  * Counter-timer Virtual Timer CompareValue register

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.40 src/sys/arch/arm/cortex/gtmr.c:1.40.2.1
--- src/sys/arch/arm/cortex/gtmr.c:1.40	Sun Jun 16 10:57:59 2019
+++ src/sys/arch/arm/cortex/gtmr.c	Tue Aug 13 14:57:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.40 2019/06/16 10:57:59 jmcneill Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.40.2.1 2019/08/13 14:57:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.40 2019/06/16 10:57:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.40.2.1 2019/08/13 14:57:50 martin Exp $");
 
 #include 
 #include 
@@ -55,6 +55,12 @@ static void gtmr_attach(device_t, device
 
 static u_int gtmr_get_timecount(struct timecounter *);
 
+static uint64_t gtmr_read_cntct(struct gtmr_softc *);
+static uint32_t gtmr_read_ctl(struct gtmr_softc *);
+static void gtmr_write_ctl(struct gtmr_softc *, uint32_t);
+static void gtmr_write_tval(struct gtmr_softc *, uint32_t);
+static void gtmr_write_cval(struct gtmr_softc *, uint64_t);
+
 static struct gtmr_softc gtmr_sc;
 
 struct gtmr_percpu {
@@ -99,6 +105,7 @@ gtmr_attach(device_t parent, device_t se
 	struct mpcore_attach_args * const mpcaa = aux;
 	struct gtmr_softc *sc = >mr_sc;
 	prop_dictionary_t dict = device_properties(self);
+	prop_dictionary_t pdict = device_properties(device_parent(self));
 	char freqbuf[sizeof("X.XXX SHz")];
 	bool flag;
 
@@ -108,12 +115,16 @@ gtmr_attach(device_t parent, device_t se
 	if (!prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq))
 		sc->sc_freq = gtmr_cntfrq_read();
 
+	if (!prop_dictionary_get_bool(dict, "physical", &sc->sc_physical))
+	prop_dictionary_get_bool(pdict, "physical", &sc->sc_physical);
+
 	KASSERT(sc->sc_freq != 0);
 
 	humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
 
 	aprint_naive("\n");
-	aprint_normal(": ARM Generic Timer (%s)\n", freqbuf);
+	aprint_normal(": Generic Timer (%s, %s)\n", freqbuf,
+	sc->sc_physical ? "physical" : "virtual");
 
 	if (prop_dictionary_get_bool(dict, "sun50i-a64-unstable-timer", &flag) && flag) {
 		sc->sc_flags |= GTMR_FLAG_SUN50I_A64_UNSTABLE_TIMER;
@@ -155,12 +166,14 @@ gtmr_attach(device_t parent, device_t se
 	tc_init(>mr_timecounter);
 
 	/* Disabl

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

2019-08-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 13 14:57:50 UTC 2019

Modified Files:
src/sys/arch/aarch64/include [netbsd-9]: armreg.h
src/sys/arch/arm/cortex [netbsd-9]: gtmr.c gtmr_var.h
src/sys/arch/arm/include [netbsd-9]: armreg.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #54):

sys/arch/aarch64/include/armreg.h: revision 1.26
sys/arch/arm/cortex/gtmr.c: revision 1.41
sys/arch/arm/include/armreg.h: revision 1.128
sys/arch/arm/cortex/gtmr_var.h: revision 1.12

Add support for physical timers and sprinkle isb where needed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/cortex/gtmr_var.h
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/arm/include/armreg.h

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



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

2019-08-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 15 09:49:49 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic [netbsd-9]: meson8b_clkc.c meson8b_pinctrl.c
meson_platform.c
src/sys/arch/arm/cortex [netbsd-9]: a9tmr_var.h a9wdt.c files.cortex
src/sys/arch/arm/dts [netbsd-9]: meson8b-odroidc1.dts meson8b.dtsi
src/sys/arch/arm/fdt [netbsd-9]: files.fdt
src/sys/arch/evbarm/conf [netbsd-9]: BCM5301X BCM56340 CUBOX-I DUOVERO
GENERIC HUMMINGBOARD NITROGEN6X PANDABOARD PARALLELLA ZEDBOARD
Added Files:
src/sys/arch/arm/cortex [netbsd-9]: a9ptmr.c a9ptmr_var.h
src/sys/arch/arm/fdt [netbsd-9]: a9ptmr_fdt.c a9wdt_fdt.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #55):

sys/arch/arm/cortex/a9wdt.c: revision 1.10
sys/arch/evbarm/conf/HUMMINGBOARD: revision 1.9
sys/arch/evbarm/conf/GENERIC: revision 1.50
sys/arch/evbarm/conf/NITROGEN6X: revision 1.24
sys/arch/arm/cortex/a9tmr_var.h: revision 1.7
sys/arch/arm/fdt/files.fdt: revision 1.29
sys/arch/arm/amlogic/meson_platform.c: revision 1.12
sys/arch/arm/amlogic/meson8b_pinctrl.c: revision 1.2
sys/arch/arm/amlogic/meson_platform.c: revision 1.13
sys/arch/evbarm/conf/BCM5301X: revision 1.34
sys/arch/arm/dts/meson8b.dtsi: revision 1.6
sys/arch/arm/fdt/a9ptmr_fdt.c: revision 1.1
sys/arch/arm/dts/meson8b.dtsi: revision 1.7
sys/arch/arm/cortex/a9ptmr_var.h: revision 1.1
sys/arch/evbarm/conf/PANDABOARD: revision 1.30
sys/arch/evbarm/conf/DUOVERO: revision 1.14
sys/arch/arm/cortex/a9ptmr.c: revision 1.1
sys/arch/arm/cortex/a9ptmr.c: revision 1.2
sys/arch/arm/fdt/a9wdt_fdt.c: revision 1.1
sys/arch/evbarm/conf/BCM56340: revision 1.19
sys/arch/evbarm/conf/CUBOX-I: revision 1.23
sys/arch/arm/amlogic/meson8b_clkc.c: revision 1.4
sys/arch/evbarm/conf/PARALLELLA: revision 1.7
sys/arch/arm/cortex/files.cortex: revision 1.12
sys/arch/arm/dts/meson8b-odroidc1.dts: revision 1.4
sys/arch/arm/cortex/a9wdt.c: revision 1.9
sys/arch/evbarm/conf/ZEDBOARD: revision 1.6

spaces to tab

 -

Add a driver for the A5/A9 Private timer.
While here FDTise the Watchdog driver.

 -

Update for recent a9wdt changes
 -

Trailing whitespace

 -
Updates to get Odroid-C1 in better shape since the last DTS import

 -

Various fixes / changes
- don't use prescaler
- improve AB_DEBUG output
- fix a9ptmr_delay to work with a decrementing counter!
Thanks to jmcneill@ for proving I'm an idiot

 -

Add eth_rxd3 and eth_rxd2 pinctrl groups

 -

Catch up to recent mainline dts changes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/amlogic/meson8b_clkc.c
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/amlogic/meson8b_pinctrl.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/amlogic/meson_platform.c
cvs rdiff -u -r0 -r1.2.2.2 src/sys/arch/arm/cortex/a9ptmr.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/cortex/a9ptmr_var.h
cvs rdiff -u -r1.6 -r1.6.6.1 src/sys/arch/arm/cortex/a9tmr_var.h
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/arm/cortex/a9wdt.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/arm/dts/meson8b-odroidc1.dts
cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/arch/arm/dts/meson8b.dtsi
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/fdt/a9ptmr_fdt.c \
src/sys/arch/arm/fdt/a9wdt_fdt.c
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/arch/evbarm/conf/BCM5301X
cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/arch/evbarm/conf/BCM56340
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/evbarm/conf/DUOVERO
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/evbarm/conf/GENERIC
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/evbarm/conf/HUMMINGBOARD
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/evbarm/conf/PANDABOARD
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/evbarm/conf/PARALLELLA
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/evbarm/conf/ZEDBOARD

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



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

2019-08-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 15 09:49:49 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic [netbsd-9]: meson8b_clkc.c meson8b_pinctrl.c
meson_platform.c
src/sys/arch/arm/cortex [netbsd-9]: a9tmr_var.h a9wdt.c files.cortex
src/sys/arch/arm/dts [netbsd-9]: meson8b-odroidc1.dts meson8b.dtsi
src/sys/arch/arm/fdt [netbsd-9]: files.fdt
src/sys/arch/evbarm/conf [netbsd-9]: BCM5301X BCM56340 CUBOX-I DUOVERO
GENERIC HUMMINGBOARD NITROGEN6X PANDABOARD PARALLELLA ZEDBOARD
Added Files:
src/sys/arch/arm/cortex [netbsd-9]: a9ptmr.c a9ptmr_var.h
src/sys/arch/arm/fdt [netbsd-9]: a9ptmr_fdt.c a9wdt_fdt.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #55):

sys/arch/arm/cortex/a9wdt.c: revision 1.10
sys/arch/evbarm/conf/HUMMINGBOARD: revision 1.9
sys/arch/evbarm/conf/GENERIC: revision 1.50
sys/arch/evbarm/conf/NITROGEN6X: revision 1.24
sys/arch/arm/cortex/a9tmr_var.h: revision 1.7
sys/arch/arm/fdt/files.fdt: revision 1.29
sys/arch/arm/amlogic/meson_platform.c: revision 1.12
sys/arch/arm/amlogic/meson8b_pinctrl.c: revision 1.2
sys/arch/arm/amlogic/meson_platform.c: revision 1.13
sys/arch/evbarm/conf/BCM5301X: revision 1.34
sys/arch/arm/dts/meson8b.dtsi: revision 1.6
sys/arch/arm/fdt/a9ptmr_fdt.c: revision 1.1
sys/arch/arm/dts/meson8b.dtsi: revision 1.7
sys/arch/arm/cortex/a9ptmr_var.h: revision 1.1
sys/arch/evbarm/conf/PANDABOARD: revision 1.30
sys/arch/evbarm/conf/DUOVERO: revision 1.14
sys/arch/arm/cortex/a9ptmr.c: revision 1.1
sys/arch/arm/cortex/a9ptmr.c: revision 1.2
sys/arch/arm/fdt/a9wdt_fdt.c: revision 1.1
sys/arch/evbarm/conf/BCM56340: revision 1.19
sys/arch/evbarm/conf/CUBOX-I: revision 1.23
sys/arch/arm/amlogic/meson8b_clkc.c: revision 1.4
sys/arch/evbarm/conf/PARALLELLA: revision 1.7
sys/arch/arm/cortex/files.cortex: revision 1.12
sys/arch/arm/dts/meson8b-odroidc1.dts: revision 1.4
sys/arch/arm/cortex/a9wdt.c: revision 1.9
sys/arch/evbarm/conf/ZEDBOARD: revision 1.6

spaces to tab

 -

Add a driver for the A5/A9 Private timer.
While here FDTise the Watchdog driver.

 -

Update for recent a9wdt changes
 -

Trailing whitespace

 -
Updates to get Odroid-C1 in better shape since the last DTS import

 -

Various fixes / changes
- don't use prescaler
- improve AB_DEBUG output
- fix a9ptmr_delay to work with a decrementing counter!
Thanks to jmcneill@ for proving I'm an idiot

 -

Add eth_rxd3 and eth_rxd2 pinctrl groups

 -

Catch up to recent mainline dts changes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/amlogic/meson8b_clkc.c
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/amlogic/meson8b_pinctrl.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/amlogic/meson_platform.c
cvs rdiff -u -r0 -r1.2.2.2 src/sys/arch/arm/cortex/a9ptmr.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/cortex/a9ptmr_var.h
cvs rdiff -u -r1.6 -r1.6.6.1 src/sys/arch/arm/cortex/a9tmr_var.h
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/arm/cortex/a9wdt.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/arm/dts/meson8b-odroidc1.dts
cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/arch/arm/dts/meson8b.dtsi
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/fdt/a9ptmr_fdt.c \
src/sys/arch/arm/fdt/a9wdt_fdt.c
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/arch/evbarm/conf/BCM5301X
cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/arch/evbarm/conf/BCM56340
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/evbarm/conf/DUOVERO
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/evbarm/conf/GENERIC
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/evbarm/conf/HUMMINGBOARD
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/evbarm/conf/PANDABOARD
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/evbarm/conf/PARALLELLA
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/arch/evbarm/conf/ZEDBOARD

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/amlogic/meson8b_clkc.c
diff -u src/sys/arch/arm/amlogic/meson8b_clkc.c:1.3 src/sys/arch/arm/amlogic/meson8b_clkc.c:1.3.6.1
--- src/sys/arch/arm/amlogic/meson8b_clkc.c:1.3	Mon Feb 25 19:30:17 2019
+++ src/sys/arch/arm/amlogic/meson8b_clkc.c	Thu Aug 15 09:49:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson8b_clkc.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson8b_clkc.c,v 1.3.6.1 2019/08/15 09:49:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: meson8b_clkc.c,v 1.3 2019/02/25 19:30:

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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:47:48 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC
Added Files:
src/sys/arch/arm/dts [netbsd-9]: sun8i-h3-nanopi-duo2.dts
sun8i-h3-nanopi-r1.dts

Log Message:
Pull up following revision(s) (requested by bad in ticket #341):

sys/arch/evbarm/conf/GENERIC: revision 1.54
sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts: revision 1.1
sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts: revision 1.2
sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts: revision 1.1

Add sun8i-h3-nanopi-r1.dts and sun8i-h3-nanopi-duo2.dts.

>From 
>https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/xxx-add-nanopi-r1-and-duo2.patch
Cherry pick a few changes from the armbian u-boot patch.

Makes my NanoPi R1 boot reliably.

>From 
>https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/add-nano+pi-r1-and-duo2.patch
Add sun8i-h3-nanopi-duo2.dts and sun8i-h3-nanopi-r1.dts.

The former is untested.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts
cvs rdiff -u -r0 -r1.2.2.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts
cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/arch/evbarm/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/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.48.2.2 src/sys/arch/evbarm/conf/GENERIC:1.48.2.3
--- src/sys/arch/evbarm/conf/GENERIC:1.48.2.2	Sun Oct  6 11:19:25 2019
+++ src/sys/arch/evbarm/conf/GENERIC	Thu Oct 17 18:47:47 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.48.2.2 2019/10/06 11:19:25 martin Exp $
+#	$NetBSD: GENERIC,v 1.48.2.3 2019/10/17 18:47:47 martin Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -123,8 +123,10 @@ makeoptions	DTS="
 	sun8i-h3-beelink-x2.dts
 	sun8i-h3-libretech-all-h3-cc.dts
 	sun8i-h3-mapleboard-mp130.dts
+	sun8i-h3-nanopi-duo2.dts
 	sun8i-h3-nanopi-m1-plus.dts
 	sun8i-h3-nanopi-m1.dts
+	sun8i-h3-nanopi-r1.dts
 	sun8i-h3-nanopi-neo.dts
 	sun8i-h3-nanopi-neo-air.dts
 	sun8i-h3-orangepi-2.dts

Added files:

Index: src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts:1.1.2.2
--- /dev/null	Thu Oct 17 18:47:48 2019
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts	Thu Oct 17 18:47:48 2019
@@ -0,0 +1,99 @@
+/* $NetBSD: sun8i-h3-nanopi-duo2.dts,v 1.1.2.2 2019/10/17 18:47:48 martin Exp $ */
+
+/*
+ * Copyright (C) 2019 Igor 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun8i-h3-nanopi.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPi-Duo2";
+	compatible = "friendlyarm,nanopi-duo2", "allwinner,sun8i-h3";
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+		post-power-on-delay-ms = <200>;
+	};
+
+};
+
+&r_pio {
+	wifi_en_npi: wifi_en_pin {
+		pins = "PL7";
+		function = "gpio_out";
+	};
+};
+
+&

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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:47:48 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC
Added Files:
src/sys/arch/arm/dts [netbsd-9]: sun8i-h3-nanopi-duo2.dts
sun8i-h3-nanopi-r1.dts

Log Message:
Pull up following revision(s) (requested by bad in ticket #341):

sys/arch/evbarm/conf/GENERIC: revision 1.54
sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts: revision 1.1
sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts: revision 1.2
sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts: revision 1.1

Add sun8i-h3-nanopi-r1.dts and sun8i-h3-nanopi-duo2.dts.

>From 
>https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/xxx-add-nanopi-r1-and-duo2.patch
Cherry pick a few changes from the armbian u-boot patch.

Makes my NanoPi R1 boot reliably.

>From 
>https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/add-nano+pi-r1-and-duo2.patch
Add sun8i-h3-nanopi-duo2.dts and sun8i-h3-nanopi-r1.dts.

The former is untested.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-duo2.dts
cvs rdiff -u -r0 -r1.2.2.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-r1.dts
cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/arch/evbarm/conf/GENERIC

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:14:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: cpu.c locore.S
src/sys/arch/aarch64/include [netbsd-9]: cpu.h param.h
src/sys/arch/arm/acpi [netbsd-9]: cpu_acpi.c
src/sys/arch/arm/arm32 [netbsd-9]: cpu.c
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c
src/sys/arch/arm/include [netbsd-9]: cpu.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #359):

sys/arch/aarch64/aarch64/locore.S: revision 1.42
sys/arch/aarch64/aarch64/locore.S: revision 1.43
sys/arch/aarch64/aarch64/locore.S: revision 1.44
sys/arch/arm/fdt/cpu_fdt.c: revision 1.28
sys/arch/aarch64/include/cpu.h: revision 1.14
sys/arch/aarch64/include/param.h: revision 1.12
sys/arch/arm/arm32/cpu.c: revision 1.133
sys/arch/arm/arm32/cpu.c: revision 1.134
sys/arch/arm/include/cpu.h: revision 1.101
sys/arch/arm/acpi/cpu_acpi.c: revision 1.7
sys/arch/aarch64/aarch64/cpu.c: revision 1.23
sys/arch/aarch64/aarch64/cpu.c: revision 1.24
sys/arch/aarch64/aarch64/cpu.c: revision 1.25

Increase aarch64 MAXCPUS to 256.

 -

Invalidate dcache before polling AP hatched status

 -

Avoid overlap between BP and last AP stack. AP stacks are now in order of
increasing address order.

Spotted by and idea from mlelstv.

 -

Use separate cacheline aligned arrays for mbox and hatched as before.

 -

cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.39.2.1 -r1.39.2.2 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.129 -r1.129.4.1 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/arm/fdt/cpu_fdt.c
cvs rdiff -u -r1.100 -r1.100.4.1 src/sys/arch/arm/include/cpu.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.20 src/sys/arch/aarch64/aarch64/cpu.c:1.20.2.1
--- src/sys/arch/aarch64/aarch64/cpu.c:1.20	Tue Jul 16 20:29:53 2019
+++ src/sys/arch/aarch64/aarch64/cpu.c	Wed Oct 23 19:14:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.20 2019/07/16 20:29:53 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.20.2.1 2019/10/23 19:14:19 martin Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.20 2019/07/16 20:29:53 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.20.2.1 2019/10/23 19:14:19 martin Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -69,8 +69,8 @@ static void cpu_setup_sysctl(device_t, s
 #ifdef MULTIPROCESSOR
 uint64_t cpu_mpidr[MAXCPUS];
 
-volatile u_int arm_cpu_hatched __cacheline_aligned = 0;
-volatile uint32_t arm_cpu_mbox __cacheline_aligned = 0;
+volatile u_int aarch64_cpu_mbox[howmany(MAXCPUS, sizeof(u_int))] __cacheline_aligned = { 0 };
+volatile u_int aarch64_cpu_hatched[howmany(MAXCPUS, sizeof(u_int))] __cacheline_aligned = { 0 };
 u_int arm_cpu_max = 1;
 
 static kmutex_t cpu_hatch_lock;
@@ -126,7 +126,7 @@ cpu_attach(device_t dv, cpuid_t id)
 		/* ci_id is stored by own cpus when hatching */
 
 		cpu_info[ncpu] = ci;
-		if ((arm_cpu_hatched & __BIT(unit)) == 0) {
+		if (cpu_hatched_p(unit) == 0) {
 			ci->ci_dev = dv;
 			dv->dv_private = ci;
 			ci->ci_index = -1;
@@ -499,27 +499,33 @@ cpu_setup_sysctl(device_t dv, struct cpu
 void
 cpu_boot_secondary_processors(void)
 {
+	u_int n, bit;
+
 	if ((boothowto & RB_MD1) != 0)
 		return;
 
 	mutex_init(&cpu_hatch_lock, MUTEX_DEFAULT, IPL_NONE);
 
-	VPRINTF("%s: writing mbox with %#x\n", __func__, arm_cpu_hatched);
+	VPRINTF("%s: starting secondary processors\n", __func__);
 
 	/* send mbox to have secondary processors do cpu_hatch() */
-	atomic_or_32(&arm_cpu_mbox, arm_cpu_hatched);
+	for (n = 0; n < __arraycount(aarch64_cpu_mbox); n++)
+		atomic_or_uint(&aarch64_cpu_mbox[n], aarch64_cpu_hatched[n]);
 	__asm __volatile ("sev; sev; sev");
 
 	/* wait all cpus have done cpu_hatch() */
-	while (membar_consumer(), arm_cpu_mbox & arm_cpu_hatched) {
-		__asm __volatile ("wfe");
+	for (n = 0; n < __arraycount(aarch64_cpu_mbox); n++) {
+		while (membar_consumer(), aarch64_cpu_mbox[n] & aarch64_cpu_hatched[n]) {
+			__asm __volatile ("wfe");
+		}
+		/* Add processors to kcpuset */
+		for (bit = 0; bit < 32; bit++) {
+			if (aarch64_cpu_hatched[n] & __BIT(bit))
+kcpuset_set(kcpuset_attached, n * 32 + bit);
+		}
 	}
 
 	VPRINTF("%s: secondary processors hatched\n", __func__);
-
-	/* add available processors to kcpuset */
-	uint32_t mbox = arm_cpu_hatched;
-	kcpuset_export_u32(kcp

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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:14:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: cpu.c locore.S
src/sys/arch/aarch64/include [netbsd-9]: cpu.h param.h
src/sys/arch/arm/acpi [netbsd-9]: cpu_acpi.c
src/sys/arch/arm/arm32 [netbsd-9]: cpu.c
src/sys/arch/arm/fdt [netbsd-9]: cpu_fdt.c
src/sys/arch/arm/include [netbsd-9]: cpu.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #359):

sys/arch/aarch64/aarch64/locore.S: revision 1.42
sys/arch/aarch64/aarch64/locore.S: revision 1.43
sys/arch/aarch64/aarch64/locore.S: revision 1.44
sys/arch/arm/fdt/cpu_fdt.c: revision 1.28
sys/arch/aarch64/include/cpu.h: revision 1.14
sys/arch/aarch64/include/param.h: revision 1.12
sys/arch/arm/arm32/cpu.c: revision 1.133
sys/arch/arm/arm32/cpu.c: revision 1.134
sys/arch/arm/include/cpu.h: revision 1.101
sys/arch/arm/acpi/cpu_acpi.c: revision 1.7
sys/arch/aarch64/aarch64/cpu.c: revision 1.23
sys/arch/aarch64/aarch64/cpu.c: revision 1.24
sys/arch/aarch64/aarch64/cpu.c: revision 1.25

Increase aarch64 MAXCPUS to 256.

 -

Invalidate dcache before polling AP hatched status

 -

Avoid overlap between BP and last AP stack. AP stacks are now in order of
increasing address order.

Spotted by and idea from mlelstv.

 -

Use separate cacheline aligned arrays for mbox and hatched as before.

 -

cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.39.2.1 -r1.39.2.2 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.129 -r1.129.4.1 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/arm/fdt/cpu_fdt.c
cvs rdiff -u -r1.100 -r1.100.4.1 src/sys/arch/arm/include/cpu.h

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



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

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:55:47 UTC 2019

Modified Files:
src/sys/arch/arm/sa11x0 [netbsd-9]: sa11x0_ost.c
src/sys/arch/zaurus/zaurus [netbsd-9]: autoconf.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #430):

sys/arch/arm/sa11x0/sa11x0_ost.c: revision 1.33
sys/arch/zaurus/zaurus/autoconf.c: revision 1.13

Fix attach failure of zaudio(4) WM8731 (C7x0/860) and WM8750 (C1000/3x00).

The new MI iic(4) layer requires an explicit quirk info of PROBE_STRATEGY
via device properties.  Fixes PR kern/54658.

Should be pulled up to netbsd-9.

 -

Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860.

When kernels were configured for both CPU_XSCALE_PXA270 and
CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9)
then all delay(9) during configure(9) returned immediately.

While here, use proper macro with description for readability.

Should be pulled up to netbsd-8 and netbsd-9.
(though zaudio(4) won't work on netbsd-8)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.20.1 src/sys/arch/arm/sa11x0/sa11x0_ost.c
cvs rdiff -u -r1.12 -r1.12.44.1 src/sys/arch/zaurus/zaurus/autoconf.c

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



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

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:55:47 UTC 2019

Modified Files:
src/sys/arch/arm/sa11x0 [netbsd-9]: sa11x0_ost.c
src/sys/arch/zaurus/zaurus [netbsd-9]: autoconf.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #430):

sys/arch/arm/sa11x0/sa11x0_ost.c: revision 1.33
sys/arch/zaurus/zaurus/autoconf.c: revision 1.13

Fix attach failure of zaudio(4) WM8731 (C7x0/860) and WM8750 (C1000/3x00).

The new MI iic(4) layer requires an explicit quirk info of PROBE_STRATEGY
via device properties.  Fixes PR kern/54658.

Should be pulled up to netbsd-9.

 -

Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860.

When kernels were configured for both CPU_XSCALE_PXA270 and
CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9)
then all delay(9) during configure(9) returned immediately.

While here, use proper macro with description for readability.

Should be pulled up to netbsd-8 and netbsd-9.
(though zaudio(4) won't work on netbsd-8)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.20.1 src/sys/arch/arm/sa11x0/sa11x0_ost.c
cvs rdiff -u -r1.12 -r1.12.44.1 src/sys/arch/zaurus/zaurus/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/arm/sa11x0/sa11x0_ost.c
diff -u src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.32 src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.32.20.1
--- src/sys/arch/arm/sa11x0/sa11x0_ost.c:1.32	Sun Oct  9 14:43:17 2016
+++ src/sys/arch/arm/sa11x0/sa11x0_ost.c	Sat Nov 16 16:55:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sa11x0_ost.c,v 1.32 2016/10/09 14:43:17 christos Exp $	*/
+/*	$NetBSD: sa11x0_ost.c,v 1.32.20.1 2019/11/16 16:55:46 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.32 2016/10/09 14:43:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.32.20.1 2019/11/16 16:55:46 martin Exp $");
 
 #include 
 #include 
@@ -80,14 +80,23 @@ struct saost_softc {
 
 static struct saost_softc *saost_sc = NULL;
 
+#define PXA270_OST_FREQ		325		/* PXA270 uses 3.25MHz */
+#define SAOST_FREQ		3686400		/* Others use 3.6864MHz */
+#define SAOST_MAXFREQ		SAOST_FREQ
+
 #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
+/*
+ * On dynamic configuration, assume fastest frequency for early delay(9)
+ * before tc_init(9), because longer delay(9) is almost harmless during
+ * device probe and initialization.
+ */
 #include  
-static uint32_t freq;
-#define TIMER_FREQUENCY freq
+static uint32_t saost_freq = SAOST_MAXFREQ;
+#define TIMER_FREQUENCY		saost_freq
 #elif defined(CPU_XSCALE_PXA270)
-#define TIMER_FREQUENCY 325 /* PXA270 uses 3.25MHz */
+#define TIMER_FREQUENCY		PXA270_OST_FREQ
 #else
-#define TIMER_FREQUENCY 3686400 /* 3.6864MHz */
+#define TIMER_FREQUENCY		SAOST_FREQ
 #endif
 
 #ifndef STATHZ
@@ -230,7 +239,7 @@ cpu_initclocks(void)
 	stathz = STATHZ;
 	profhz = stathz;
 #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
-	TIMER_FREQUENCY = (CPU_IS_PXA250) ? 3686400 : 325;
+	TIMER_FREQUENCY = (CPU_IS_PXA270) ? PXA270_OST_FREQ : SAOST_FREQ;
 #endif
 	sc->sc_statclock_step = TIMER_FREQUENCY / stathz;
 

Index: src/sys/arch/zaurus/zaurus/autoconf.c
diff -u src/sys/arch/zaurus/zaurus/autoconf.c:1.12 src/sys/arch/zaurus/zaurus/autoconf.c:1.12.44.1
--- src/sys/arch/zaurus/zaurus/autoconf.c:1.12	Sun Jul 29 18:05:47 2012
+++ src/sys/arch/zaurus/zaurus/autoconf.c	Sat Nov 16 16:55:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.12 2012/07/29 18:05:47 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.12.44.1 2019/11/16 16:55:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.12 2012/07/29 18:05:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.12.44.1 2019/11/16 16:55:46 martin Exp $");
 
 #include "opt_md.h"
 
@@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -219,5 +221,13 @@ void
 device_register(device_t dev, void *aux)
 {
 
-	/* Nothing to do */
+	/*
+	 * I2C bus conntected to pxaiic(4) for zaudio(4) devices has
+	 * limited capabilities.
+	 */
+	if (device_is_a(dev, "iic") &&
+	device_is_a(dev->dv_parent, "ziic")) {
+		(void)prop_dictionary_set_cstring_nocopy(device_properties(dev),
+		I2C_PROP_INDIRECT_PROBE_STRATEGY, I2C_PROBE_STRATEGY_NONE);
+	}
 }



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:36:03 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #439):

sys/arch/evbarm/conf/GENERIC64: revision 1.115
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.15

Add SPI clocks
Add sun6ispi


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/arch/evbarm/conf/GENERIC64

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



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:36:03 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #439):

sys/arch/evbarm/conf/GENERIC64: revision 1.115
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.15

Add SPI clocks
Add sun6ispi


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/arch/evbarm/conf/GENERIC64

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/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.2
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.13.2.1	Mon Nov 18 19:31:00 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Mon Nov 18 19:36:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.13.2.1 2019/11/18 19:31:00 martin Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.13.2.2 2019/11/18 19:36:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.13.2.1 2019/11/18 19:31:00 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.13.2.2 2019/11/18 19:36:03 martin Exp $");
 
 #include 
 #include 
@@ -60,6 +60,8 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_a64_c
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
+#define	SPI0_CLK_REG		0x0a0
+#define	SPI1_CLK_REG		0x0a4
 #define	I2SPCM0_CLK_REG		0x0b0
 #define	I2SPCM1_CLK_REG		0x0b4
 #define	I2SPCM2_CLK_REG		0x0b8
@@ -158,6 +160,7 @@ static const char *ths_parents[] = { "ho
 static const char *de_parents[] = { "pll_periph0_2x", "pll_de" };
 static const char *hdmi_parents[] = { "pll_video0", "pll_video1" };
 static const char *i2s_parents[] = { "pll_audio_8x", "pll_audio_4x", "pll_audio_2x", "pll_audio" };
+static const char *spi_parents[] = { "hosc", "pll_periph0", "pll_periph1", NULL };
 static const char *tcon1_parents[] = { "pll_video0", NULL, "pll_video1", NULL };
 static const char *gpu_parents[] = { "pll_gpu" };
 
@@ -260,6 +263,16 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
 	SUNXI_CCU_FIXED_FACTOR(A64_CLK_PLL_PERIPH0_2X, "pll_periph0_2x", "pll_periph0", 1, 2),
 
+	SUNXI_CCU_NKMP(A64_CLK_PLL_PERIPH1, "pll_periph1", "hosc",
+	PLL_PERIPH1_CTRL_REG,	/* reg */
+	__BITS(12,8),		/* n */
+	__BITS(5,4), 		/* k */
+	0,/* m */
+	__BITS(17,16),		/* p */
+	__BIT(31),			/* enable */
+	SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
+	SUNXI_CCU_FIXED_FACTOR(A64_CLK_PLL_PERIPH1_2X, "pll_periph1_2x", "pll_periph1", 1, 2),
+
 	SUNXI_CCU_NKMP_TABLE(A64_CLK_PLL_AUDIO_BASE, "pll_audio_base", "hosc",
 	PLL_AUDIO_CTRL_REG,		/* reg */
 	__BITS(14,8),		/* n */
@@ -430,6 +443,21 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	__BIT(31),		/* enable */
 	0),
 
+	SUNXI_CCU_NM(A64_CLK_SPI0, "spi0", spi_parents,
+	SPI0_CLK_REG,	/* reg */
+	__BITS(17,16),	/* n */
+	__BITS(3,0),	/* m */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
+
+	SUNXI_CCU_NM(A64_CLK_SPI1, "spi1", spi_parents,
+	SPI1_CLK_REG,	/* reg */
+	__BITS(17,16),	/* n */
+	__BITS(3,0),	/* m */
+	__BITS(25,24),	/* sel */
+	__BIT(31),		/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 
 	SUNXI_CCU_DIV_GATE(A64_CLK_TCON1, "tcon1", tcon1_parents,
 	TCON1_CLK_REG,	/* reg */

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.103.2.4 src/sys/arch/evbarm/conf/GENERIC64:1.103.2.5
--- src/sys/arch/evbarm/conf/GENERIC64:1.103.2.4	Mon Nov 18 19:33:10 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Nov 18 19:36:03 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.103.2.4 2019/11/18 19:33:10 martin Exp $
+#	$NetBSD: GENERIC64,v 1.103.2.5 2019/11/18 19:36:03 martin Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -402,6 +402,7 @@ ld*		at nvme? nsid ?
 
 # SPI controllers
 bcmspi*		at fdt?			# Broadcom BCM283x SPI
+sun6ispi*	at fdt?			# Allwinner SPI
 spi*		at spibus?
 
 # Audio support



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

2019-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 16:49:58 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip [netbsd-9]: files.rockchip rk3399_cru.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64
Added Files:
src/sys/arch/arm/rockchip [netbsd-9]: rk_spi.c

Log Message:
Pull up following revision(s) (requested by tnn in ticket #458):

sys/arch/arm/rockchip/rk3399_cru.c: revision 1.9
sys/arch/arm/rockchip/rk_spi.c: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.104
sys/arch/arm/rockchip/files.rockchip: revision 1.20

rk3399_cru: add definitions for SPI clocks

rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.

rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r0 -r1.3.2.2 src/sys/arch/arm/rockchip/rk_spi.c
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/arch/evbarm/conf/GENERIC64

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



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

2019-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 20 16:49:58 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip [netbsd-9]: files.rockchip rk3399_cru.c
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64
Added Files:
src/sys/arch/arm/rockchip [netbsd-9]: rk_spi.c

Log Message:
Pull up following revision(s) (requested by tnn in ticket #458):

sys/arch/arm/rockchip/rk3399_cru.c: revision 1.9
sys/arch/arm/rockchip/rk_spi.c: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.104
sys/arch/arm/rockchip/files.rockchip: revision 1.20

rk3399_cru: add definitions for SPI clocks

rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.

rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r0 -r1.3.2.2 src/sys/arch/arm/rockchip/rk_spi.c
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/arch/evbarm/conf/GENERIC64

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/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.19.2.1 src/sys/arch/arm/rockchip/files.rockchip:1.19.2.2
--- src/sys/arch/arm/rockchip/files.rockchip:1.19.2.1	Sat Nov 16 16:48:25 2019
+++ src/sys/arch/arm/rockchip/files.rockchip	Wed Nov 20 16:49:58 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.19.2.1 2019/11/16 16:48:25 martin Exp $
+#	$NetBSD: files.rockchip,v 1.19.2.2 2019/11/20 16:49:58 martin Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -42,6 +42,11 @@ device	rkiic: i2cbus, i2cexec
 attach	rkiic at fdt with rk_i2c
 file	arch/arm/rockchip/rk_i2c.c		rk_i2c
 
+# SPI
+device	rkspi: spibus
+attach	rkspi at fdt with rk_spi
+file	arch/arm/rockchip/rk_spi.c		rk_spi
+
 # USB PHY
 device	rkusb { }
 attach	rkusb at fdt with rk_usb

Index: src/sys/arch/arm/rockchip/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.1 src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.2
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.8.4.1	Sat Nov 16 16:48:25 2019
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Wed Nov 20 16:49:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.8.4.1 2019/11/16 16:48:25 martin Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.8.4.2 2019/11/20 16:49:58 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.8.4.1 2019/11/16 16:48:25 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.8.4.2 2019/11/20 16:49:58 martin Exp $");
 
 #include 
 #include 
@@ -771,6 +771,50 @@ static struct rk_cru_clk rk3399_cru_clks
 	RK_GATE(RK3399_PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", CLKGATE_CON(22), 9),
 	RK_GATE(RK3399_PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", CLKGATE_CON(22), 10),
 
+	/*
+	 * SPI
+	 */
+	RK_COMPOSITE(RK3399_SCLK_SPI0, "clk_spi0", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(59),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(12),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI1, "clk_spi1", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(59),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(13),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI2, "clk_spi2", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(60),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(14),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI4, "clk_spi4", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(60),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(9),	/* gate_reg */
+		 __BIT(15),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(RK3399_SCLK_SPI5, "clk_spi5", mux_pll_src_cpll_gpll_parents,
+		 CLKSEL_CON(58),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(14,8),	/* div_mask */
+		 CLKGATE_CON(13),	/* gate_reg */
+		 __BIT(13),		/* gate_mask */
+		 0),
+	RK_GATE(RK3399_PCLK_SPI0, "pclk_rkspi0", "pclk_perilp1", CLKGATE_CON(23), 10),
+	RK_GATE(RK3399_PCLK_SPI1, "pclk_rkspi1", "pclk_perilp1", CLKGATE_CON(23), 11),
+	RK_GATE(RK3399_PCLK_SPI2, "pclk_rkspi2", "pclk_perilp1", CLKGATE_CON(23), 12),
+	RK_GATE(RK3399_PCLK_SPI4, "pclk_rkspi4", "pclk_perilp1", CLKGATE_CON(23), 13),
+	RK_GATE(RK3399_PCLK_SPI5, "pclk_rkspi5", "hclk_perilp1", CLKGATE_CON(34), 5),
+
 	/* PCIe */
 	RK_GATE(RK3399_ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLKGATE_CON(20), 2),
 	RK_GATE(RK3399_ACLK_PCIE, "aclk_pcie", "aclk

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

2019-11-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Nov 22 15:28:18 UTC 2019

Modified Files:
src/sys/arch/arm/omap [netbsd-9]: obio_mputmr.c
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c
src/sys/arch/xen/xen [netbsd-9]: xenevt.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #463):
sys/arch/xen/xen/xenevt.c: revision 1.54
sys/arch/arm/omap/obio_mputmr.c: revision 1.9
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.79
Make this files compilable w/o options DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.38.1 src/sys/arch/arm/omap/obio_mputmr.c
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.53 -r1.53.4.1 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.



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

2019-11-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Nov 22 15:28:18 UTC 2019

Modified Files:
src/sys/arch/arm/omap [netbsd-9]: obio_mputmr.c
src/sys/arch/evbarm/beagle [netbsd-9]: beagle_machdep.c
src/sys/arch/xen/xen [netbsd-9]: xenevt.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #463):
sys/arch/xen/xen/xenevt.c: revision 1.54
sys/arch/arm/omap/obio_mputmr.c: revision 1.9
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.79
Make this files compilable w/o options DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.38.1 src/sys/arch/arm/omap/obio_mputmr.c
cvs rdiff -u -r1.78 -r1.78.2.1 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.53 -r1.53.4.1 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/arm/omap/obio_mputmr.c
diff -u src/sys/arch/arm/omap/obio_mputmr.c:1.8 src/sys/arch/arm/omap/obio_mputmr.c:1.8.38.1
--- src/sys/arch/arm/omap/obio_mputmr.c:1.8	Sun Jun 16 17:47:54 2013
+++ src/sys/arch/arm/omap/obio_mputmr.c	Fri Nov 22 15:28:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: obio_mputmr.c,v 1.8 2013/06/16 17:47:54 matt Exp $ */
+/* $NetBSD: obio_mputmr.c,v 1.8.38.1 2019/11/22 15:28:18 bouyer Exp $ */
 
 /*
  * Based on omap_mputmr.c
@@ -101,7 +101,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio_mputmr.c,v 1.8 2013/06/16 17:47:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio_mputmr.c,v 1.8.38.1 2019/11/22 15:28:18 bouyer Exp $");
 
 #include "opt_omap.h"
 #include "opt_cpuoptions.h"
@@ -302,9 +302,9 @@ gpt_enable(
 
 #if defined(OMAP_2430) || defined(OMAP_2420)
 	bus_space_handle_t ioh;
-	uint32_t r;
+	uint32_t r, err __diagused;
 
-	int err = bus_space_map(obio->obio_iot, OMAP2_CM_BASE,
+	err = bus_space_map(obio->obio_iot, OMAP2_CM_BASE,
 	OMAP2_CM_SIZE, 0, &ioh);
 	KASSERT(err == 0);
 

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78.2.1
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.78	Tue Jul 16 14:41:44 2019
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Fri Nov 22 15:28:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.78 2019/07/16 14:41:44 skrll Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78 2019/07/16 14:41:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.78.2.1 2019/11/22 15:28:18 bouyer Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -1075,6 +1075,7 @@ void
 beagle_device_register(device_t self, void *aux)
 {
 	prop_dictionary_t dict = device_properties(self);
+	int rv __diagused;
 
 	if (device_is_a(self, "armperiph")
 	&& device_is_a(device_parent(self), "mainbus")) {
@@ -1180,7 +1181,7 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_int16(dict, "port0-gpio", 80);
 		prop_dictionary_set_bool(dict, "port0-gpioval", true);
 #endif
-		int rv = bus_space_map(iot, OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT, 4, 0, &ioh);
+		rv = bus_space_map(iot, OMAP5_CM_CTL_WKUP_REF_CLK0_OUT_REF_CLK1_OUT, 4, 0, &ioh);
 		KASSERT(rv == 0);
 		uint32_t v = bus_space_read_4(iot, ioh, 0);
 		v &= 0x;

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.53 src/sys/arch/xen/xen/xenevt.c:1.53.4.1
--- src/sys/arch/xen/xen/xenevt.c:1.53	Tue Dec 25 06:50:12 2018
+++ src/sys/arch/xen/xen/xenevt.c	Fri Nov 22 15:28:17 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.53 2018/12/25 06:50:12 cherry Exp $  */
+/*  $NetBSD: xenevt.c,v 1.53.4.1 2019/11/22 15:28:17 bouyer Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.53 2018/12/25 06:50:12 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.53.4.1 2019/11/22 15:28:17 bouyer Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -161,7 +161,7 @@ static evtchn_port_t xenevt_alloc_event(
 void
 xenevtattach(int n)
 {
-	struct intrhand *ih;
+	struct intrhand *ih __diagused;
 	int level = IPL_HIGH;
 	bool mpsafe = (level != IPL_VM);
 



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:10:28 UTC 2023

Modified Files:
src/sys/arch/vax/include [netbsd-9]: trap.h
src/sys/arch/vax/vax [netbsd-9]: pmap.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1648):

sys/arch/vax/vax/pmap.c: revision 1.196
sys/arch/vax/include/trap.h: revision 1.25

Change CASMAGIC to 0xFEDABABE so that it cannot accidentally end up in
valid kernel memory.  Due to the VARM accesses above S0 should always
give a ptelen trap.

Bug found by Kalvis Duckmanton.

Ensure that the kernel do not try to allocate a S0 segment larger than 1G,
since the hardware prohibits that.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.58.1 src/sys/arch/vax/include/trap.h
cvs rdiff -u -r1.186 -r1.186.6.1 src/sys/arch/vax/vax/pmap.c

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



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:10:28 UTC 2023

Modified Files:
src/sys/arch/vax/include [netbsd-9]: trap.h
src/sys/arch/vax/vax [netbsd-9]: pmap.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1648):

sys/arch/vax/vax/pmap.c: revision 1.196
sys/arch/vax/include/trap.h: revision 1.25

Change CASMAGIC to 0xFEDABABE so that it cannot accidentally end up in
valid kernel memory.  Due to the VARM accesses above S0 should always
give a ptelen trap.

Bug found by Kalvis Duckmanton.

Ensure that the kernel do not try to allocate a S0 segment larger than 1G,
since the hardware prohibits that.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.58.1 src/sys/arch/vax/include/trap.h
cvs rdiff -u -r1.186 -r1.186.6.1 src/sys/arch/vax/vax/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/vax/include/trap.h
diff -u src/sys/arch/vax/include/trap.h:1.24 src/sys/arch/vax/include/trap.h:1.24.58.1
--- src/sys/arch/vax/include/trap.h:1.24	Sun Jul  3 02:18:20 2011
+++ src/sys/arch/vax/include/trap.h	Wed Jun 21 19:10:28 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: trap.h,v 1.24 2011/07/03 02:18:20 matt Exp $ */
+/*  $NetBSD: trap.h,v 1.24.58.1 2023/06/21 19:10:28 martin Exp $ */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -74,7 +74,7 @@
 #define	AFLT_FLTUND	0xa	/* floating underflow */
 
 /* Used by RAS to detect an interrupted CAS */
-#define	CASMAGIC	0xBEDABABE /* high end of S0 space */
+#define	CASMAGIC	0xFEDABABE /* always invalid space */
 
 /* Trap's coming from user mode */
 #define	T_USER	0x100

Index: src/sys/arch/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.186 src/sys/arch/vax/vax/pmap.c:1.186.6.1
--- src/sys/arch/vax/vax/pmap.c:1.186	Fri Mar 30 08:34:35 2018
+++ src/sys/arch/vax/vax/pmap.c	Wed Jun 21 19:10:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $	   */
+/*	$NetBSD: pmap.c,v 1.186.6.1 2023/06/21 19:10:28 martin Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.186.6.1 2023/06/21 19:10:28 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -307,6 +307,15 @@ pmap_bootstrap(void)
 		usrptsize = (avail_end/(20 * PPTESZ)) * VAX_NBPG;
 		
 	kvmsize = calc_kvmsize(usrptsize);
+	/*
+	 * Ensure that not more than 1G is allocated, since that is 
+	 * max size of S0 space.
+	 * Also note that for full S0 space the SLR should be 0x20,
+	 * since the comparison in the vax microcode is >= SLR.
+	 */
+#define	S0SPACE	(1*1024*1024*1024)
+	if (kvmsize > S0SPACE)
+		kvmsize = S0SPACE;
 	sysptsize = kvmsize >> VAX_PGSHIFT;
 	/*
 	 * Virtual_* and avail_* is used for mapping of system page table.



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 09:12:36 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1664):

sys/arch/x86/include/specialreg.h: revision 1.207
sys/arch/x86/x86/errata.c: revision 1.31

x86: turn off zenbleed chicken bit on Zen2 cpus.

this is based upon Taylor's original work.  i just made the list
of CPUs to run on correct as i could determine.  (also, add some
Zen3 and Zen4 cpuids not yet used by any errata.)

(might be nice to have a better way to expression revision ranges
rather than specific cpuid matches, eg, 0x30-0x4f models in a cpu
family, etc.)

tested on ryzen 3600, and a ported zenbleed PoC that no longer
shows any obtained text.  (a similar module-version of it stopped
the PoC on a ryzen 3950x without having to reboot.)

https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7008.html
https://lock.cmpxchg8b.com/zenbleed.html


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.13 -r1.150.2.14 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/arch/x86/x86/errata.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/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.13 src/sys/arch/x86/include/specialreg.h:1.150.2.14
--- src/sys/arch/x86/include/specialreg.h:1.150.2.13	Wed Jun 21 19:04:19 2023
+++ src/sys/arch/x86/include/specialreg.h	Tue Jul 25 09:12:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.13 2023/06/21 19:04:19 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.14 2023/07/25 09:12:35 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -1393,6 +1393,7 @@
 #define MSR_DE_CFG	0xc0011029
 #define 	DE_CFG_ERRATA_721	0x0001
 #define 	DE_CFG_LFENCE_SERIALIZE	__BIT(1)
+#define 	DE_CFG_ERRATA_ZENBLEED	__BIT(9)
 #define 	DE_CFG_ERRATA_1021	__BIT(13)
 
 #define MSR_BU_CFG2	0xc001102a

Index: src/sys/arch/x86/x86/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.26 src/sys/arch/x86/x86/errata.c:1.26.2.1
--- src/sys/arch/x86/x86/errata.c:1.26	Sat May 18 07:49:31 2019
+++ src/sys/arch/x86/x86/errata.c	Tue Jul 25 09:12:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.26 2019/05/18 07:49:31 maxv Exp $	*/
+/*	$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26 2019/05/18 07:49:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $");
 
 #include 
 #include 
@@ -71,9 +71,12 @@ typedef enum cpurev {
 	JH_E6, SH_B0, SH_B3, SH_C0, SH_CG, SH_D0, SH_E4, SH_E5,
 	DR_BA, DR_B2, DR_B3, RB_C2, RB_C3, BL_C2, BL_C3, DA_C2,
 	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0, KB_A1,
-	ML_A1, ZP_B1, ZP_B2, PiR_B2, OINK
+	ML_A1, ZP_B1, ZP_B2, PiR_B2, Rome_B0, Z2_XB, Z2_Ren,
+	Z2_Luc, Z2_Mat, Z2_VG, Z2_Men, Milan_B1, Milan_B2, Genoa_B1,
+	OINK
 } cpurev_t;
 
+/* These names match names from various AMD Errata/Revision Guides. */
 static const u_int cpurevs[] = {
 	BH_E4, 0x0020fb1, CH_CG, 0xf82, CH_CG, 0xfb2,
 	CH_D0, 0x0010f80, CH_D0, 0x0010fb0, DH_CG, 0xfc0,
@@ -91,7 +94,12 @@ static const u_int cpurevs[] = {
 	HY_D0, 0x0100f80, HY_D1, 0x0100f81, HY_D1_G34R1, 0x0100f91,
 	PH_E0, 0x0100fa0, LN_B0, 0x0300f10, KB_A1, 0x0700F01,
 	ML_A1, 0x0730F01, ZP_B1, 0x0800F11, ZP_B2, 0x0800F12,
-	PiR_B2, 0x0800F82,
+	PiR_B2, 0x0800F82, Rome_B0, 0x0830F10,
+	/* XXX client Zen2 names aren't known yet. */
+	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F80, Z2_Luc, 0x0870F10,
+	Z2_Mat, 0x0890F70, Z2_VG, 0x0890F80, Z2_Men, 0x08A0F10,
+	Milan_B1, 0x0A00F11, Milan_B2, 0x0A00F12,
+	Genoa_B1, 0x0A10F11,
 	OINK
 };
 
@@ -160,6 +168,10 @@ static const uint8_t x86_errata_set15[] 
 	KB_A1, ML_A1, OINK
 };
 
+static const uint8_t x86_errata_set16[] = {
+	Rome_B0, Z2_XB, Z2_Ren, Z2_Luc, Z2_Mat, Z2_VG, Z2_Men, OINK
+};
+
 static bool x86_errata_setmsr(struct cpu_info *, errata_t *);
 static bool x86_errata_testmsr(struct cpu_info *, errata_t *);
 
@@ -359,6 +371,16 @@ static errata_t errata[] = {
 		1095, FALSE, MSR_LS_CFG, x86_errata_set13,
 		x86_errata_setmsr, LS_CFG_ERRATA_1095
 	},
+	/*
+	 * Zenbleed:
+	 * https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7008.html
+	 * https://github.com/google/security-research/security/advisories/GHSA-v6wh-rxpg-cmm8
+	 * https://lock.cmpxchg8b.com/zenbleed.html
+	 */
+	{
+		-1, FALSE, MSR_DE_CFG, x86_errata_set16,
+		x86_errata_setmsr, DE_CFG_ERRATA_ZENBLEED,
+	},
 };
 
 static bool 



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 09:12:36 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1664):

sys/arch/x86/include/specialreg.h: revision 1.207
sys/arch/x86/x86/errata.c: revision 1.31

x86: turn off zenbleed chicken bit on Zen2 cpus.

this is based upon Taylor's original work.  i just made the list
of CPUs to run on correct as i could determine.  (also, add some
Zen3 and Zen4 cpuids not yet used by any errata.)

(might be nice to have a better way to expression revision ranges
rather than specific cpuid matches, eg, 0x30-0x4f models in a cpu
family, etc.)

tested on ryzen 3600, and a ported zenbleed PoC that no longer
shows any obtained text.  (a similar module-version of it stopped
the PoC on a ryzen 3950x without having to reboot.)

https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7008.html
https://lock.cmpxchg8b.com/zenbleed.html


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.13 -r1.150.2.14 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/arch/x86/x86/errata.c

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



CVS commit: [netbsd-9] src/sys/arch/hp300

2022-12-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  6 19:26:06 UTC 2022

Modified Files:
src/sys/arch/hp300/dev [netbsd-9]: rd.c rdreg.h rdvar.h
src/sys/arch/hp300/stand/common [netbsd-9]: rd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1552):

sys/arch/hp300/dev/rd.c: revision 1.120
sys/arch/hp300/dev/rd.c: revision 1.121
sys/arch/hp300/dev/rd.c: revision 1.122
sys/arch/hp300/dev/rd.c: revision 1.123
sys/arch/hp300/dev/rd.c: revision 1.124
sys/arch/hp300/dev/rdreg.h: revision 1.19
sys/arch/hp300/dev/rd.c: revision 1.111
sys/arch/hp300/dev/rd.c: revision 1.112
sys/arch/hp300/dev/rd.c: revision 1.113
sys/arch/hp300/stand/common/rd.c: revision 1.12
sys/arch/hp300/dev/rd.c: revision 1.114
sys/arch/hp300/stand/common/rd.c: revision 1.13
sys/arch/hp300/dev/rd.c: revision 1.115
sys/arch/hp300/stand/common/rd.c: revision 1.14
sys/arch/hp300/dev/rd.c: revision 1.116
sys/arch/hp300/stand/common/rd.c: revision 1.15
sys/arch/hp300/dev/rd.c: revision 1.117
sys/arch/hp300/dev/rd.c: revision 1.118
sys/arch/hp300/dev/rd.c: revision 1.119
sys/arch/hp300/dev/rdvar.h: revision 1.27
sys/arch/hp300/dev/rdreg.h: revision 1.20

Sync a list of HP-IB disk IDs with kernel's one.
Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.

Make local variables static and read only ones const.

Use common macro for numbers of cylinders and blocks for HP-IB disks.
No binary changes.

Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.
- check not only stat value returned by C_QSTAT command against
  each punit but also desc.d_name returned by C_DESC command
  because it looks HPDisk responds to commands against punits supported
  but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
  probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.
Should be pulled up to netbsd-9.

Remove now unused buffer members from softc prepared only for rdreset().

Use proper integer types for HP-IB xfer parameters.
No visible regression on 425t and HPDisk.

Sync with rdreg.h integer type changes.

Remove unnecessary declarations.

Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.
With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media.  Tested on 425t and HPDisk.
Should be pulled up to netbsd-9.

Check bounds of each partition by MI bounds_check_with_label(9).
The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.

Pass a correct dev_t arg to disk_ioctl().
Probably harmless.

Remove a duplicated static function declaration.

Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().
With this change raid(4) no longer complains before mountroot:
RAIDframe: can't get disk size for dev rd0 (22)
Should be pulled up to netbsd-9.

Use proper RAW_PART macro rather than a magic number.

Remove more duplicated static function declarations.

Misc KNF and cosmetics.

Add empty DIOCCACHESYNC ioctl(2) for rd(4).
Without this raid(4) always complains on various raidctl(8) ops:
raid0: cache flush[0] to component 0 failed (22)
RAID1 configured by raid(4) just works HP-IB disks on hp300.

Explicitly include  for hz(9) as man pages says.
XXX: it looks sys/param.h r1.615 and later also has extern int hz


To generate a diff of this commit:
cvs rdiff -u -r1.101.22.1 -r1.101.22.2 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.13.60.1 -r1.13.60.2 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.23.22.1 -r1.23.22.2 src/sys/arch/hp300/dev/rdvar.h
cvs rdiff -u -r1.10.58.1 -r1.10.58.2 src/sys/arch/hp300/stand/common/rd.c

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



CVS commit: [netbsd-9] src/sys/arch/hp300

2022-12-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec  6 19:26:06 UTC 2022

Modified Files:
src/sys/arch/hp300/dev [netbsd-9]: rd.c rdreg.h rdvar.h
src/sys/arch/hp300/stand/common [netbsd-9]: rd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1552):

sys/arch/hp300/dev/rd.c: revision 1.120
sys/arch/hp300/dev/rd.c: revision 1.121
sys/arch/hp300/dev/rd.c: revision 1.122
sys/arch/hp300/dev/rd.c: revision 1.123
sys/arch/hp300/dev/rd.c: revision 1.124
sys/arch/hp300/dev/rdreg.h: revision 1.19
sys/arch/hp300/dev/rd.c: revision 1.111
sys/arch/hp300/dev/rd.c: revision 1.112
sys/arch/hp300/dev/rd.c: revision 1.113
sys/arch/hp300/stand/common/rd.c: revision 1.12
sys/arch/hp300/dev/rd.c: revision 1.114
sys/arch/hp300/stand/common/rd.c: revision 1.13
sys/arch/hp300/dev/rd.c: revision 1.115
sys/arch/hp300/stand/common/rd.c: revision 1.14
sys/arch/hp300/dev/rd.c: revision 1.116
sys/arch/hp300/stand/common/rd.c: revision 1.15
sys/arch/hp300/dev/rd.c: revision 1.117
sys/arch/hp300/dev/rd.c: revision 1.118
sys/arch/hp300/dev/rd.c: revision 1.119
sys/arch/hp300/dev/rdvar.h: revision 1.27
sys/arch/hp300/dev/rdreg.h: revision 1.20

Sync a list of HP-IB disk IDs with kernel's one.
Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.

Make local variables static and read only ones const.

Use common macro for numbers of cylinders and blocks for HP-IB disks.
No binary changes.

Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.
- check not only stat value returned by C_QSTAT command against
  each punit but also desc.d_name returned by C_DESC command
  because it looks HPDisk responds to commands against punits supported
  but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
  probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.
Should be pulled up to netbsd-9.

Remove now unused buffer members from softc prepared only for rdreset().

Use proper integer types for HP-IB xfer parameters.
No visible regression on 425t and HPDisk.

Sync with rdreg.h integer type changes.

Remove unnecessary declarations.

Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.
With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media.  Tested on 425t and HPDisk.
Should be pulled up to netbsd-9.

Check bounds of each partition by MI bounds_check_with_label(9).
The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.

Pass a correct dev_t arg to disk_ioctl().
Probably harmless.

Remove a duplicated static function declaration.

Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().
With this change raid(4) no longer complains before mountroot:
RAIDframe: can't get disk size for dev rd0 (22)
Should be pulled up to netbsd-9.

Use proper RAW_PART macro rather than a magic number.

Remove more duplicated static function declarations.

Misc KNF and cosmetics.

Add empty DIOCCACHESYNC ioctl(2) for rd(4).
Without this raid(4) always complains on various raidctl(8) ops:
raid0: cache flush[0] to component 0 failed (22)
RAID1 configured by raid(4) just works HP-IB disks on hp300.

Explicitly include  for hz(9) as man pages says.
XXX: it looks sys/param.h r1.615 and later also has extern int hz


To generate a diff of this commit:
cvs rdiff -u -r1.101.22.1 -r1.101.22.2 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.13.60.1 -r1.13.60.2 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.23.22.1 -r1.23.22.2 src/sys/arch/hp300/dev/rdvar.h
cvs rdiff -u -r1.10.58.1 -r1.10.58.2 src/sys/arch/hp300/stand/common/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.101.22.1 src/sys/arch/hp300/dev/rd.c:1.101.22.2
--- src/sys/arch/hp300/dev/rd.c:1.101.22.1	Wed Jul 14 18:04:04 2021
+++ src/sys/arch/hp300/dev/rd.c	Tue Dec  6 19:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $	*/
+/*	$NetBSD: rd.c,v 1.101.22.2 2022/12/06 19:26:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,12 +72,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101.22.2 2022/12/06 19:26:06 martin Exp $");
 
 #include "opt_useleds.h"
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,7 +103,7 @@ __KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101
 
 #include "ioconf.h"
 
-int	rderrthresh = RDR

CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  1 18:56:44 UTC 2023

Modified Files:
src/sys/arch/next68k/dev [netbsd-9]: esp.c
src/sys/arch/next68k/include [netbsd-9]: bus_space.h cpu.h
src/sys/arch/next68k/next68k [netbsd-9]: clock.c machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1581):

sys/arch/next68k/next68k/machdep.c: revision 1.117
sys/arch/next68k/dev/esp.c: revision 1.65
sys/arch/next68k/include/cpu.h: revision 1.51
sys/arch/next68k/include/bus_space.h: revision 1.20
sys/arch/next68k/next68k/clock.c: revision 1.13

next68k: Fix delay_divisor value for proper delay(9) on 68040.

next68k: Specify proper constraints for bus_space_read region and multi ops.

These functions write the read data into memory at a specified pointer,
but without the "memory" constraint gcc could optimize out these ops
if the memory is allocated on local stack.

With this fix nextkbd(4) works again.
Should be pulled up to netbsd-10 and netbsd-9.

next68k: Fix silent stall of next68k esp(4) SCSI.

next68k esp(4) driver requires nextdma(4) interrupts at ipl 6
during ncr53c9x_intr() for esp(4) at ipl 3.  It worked on netbsd-5
and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6
for SMP support and on netbsd-6 ncr53c9x driver was changed to
use mutex(9) instead of simple_lock(9), so nextdma interrupts
were no longer raised during ncr53c9x interrupt handler.

For now, just call mutex_exit(9) and mutex_enter(9) during
waiting nextdma(4) interrupts in MD esp_dma_intr() handler.

This could be wrong and the interrupt handler for nextdma should
be reorganized, but it just works.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.64.18.1 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.16 -r1.16.52.1 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.12 -r1.12.64.1 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.112 -r1.112.4.1 src/sys/arch/next68k/next68k/machdep.c

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



CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  1 18:56:44 UTC 2023

Modified Files:
src/sys/arch/next68k/dev [netbsd-9]: esp.c
src/sys/arch/next68k/include [netbsd-9]: bus_space.h cpu.h
src/sys/arch/next68k/next68k [netbsd-9]: clock.c machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1581):

sys/arch/next68k/next68k/machdep.c: revision 1.117
sys/arch/next68k/dev/esp.c: revision 1.65
sys/arch/next68k/include/cpu.h: revision 1.51
sys/arch/next68k/include/bus_space.h: revision 1.20
sys/arch/next68k/next68k/clock.c: revision 1.13

next68k: Fix delay_divisor value for proper delay(9) on 68040.

next68k: Specify proper constraints for bus_space_read region and multi ops.

These functions write the read data into memory at a specified pointer,
but without the "memory" constraint gcc could optimize out these ops
if the memory is allocated on local stack.

With this fix nextkbd(4) works again.
Should be pulled up to netbsd-10 and netbsd-9.

next68k: Fix silent stall of next68k esp(4) SCSI.

next68k esp(4) driver requires nextdma(4) interrupts at ipl 6
during ncr53c9x_intr() for esp(4) at ipl 3.  It worked on netbsd-5
and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6
for SMP support and on netbsd-6 ncr53c9x driver was changed to
use mutex(9) instead of simple_lock(9), so nextdma interrupts
were no longer raised during ncr53c9x interrupt handler.

For now, just call mutex_exit(9) and mutex_enter(9) during
waiting nextdma(4) interrupts in MD esp_dma_intr() handler.

This could be wrong and the interrupt handler for nextdma should
be reorganized, but it just works.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.64.18.1 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.16 -r1.16.52.1 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.12 -r1.12.64.1 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.112 -r1.112.4.1 src/sys/arch/next68k/next68k/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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.64 src/sys/arch/next68k/dev/esp.c:1.64.18.1
--- src/sys/arch/next68k/dev/esp.c:1.64	Fri Mar 31 08:38:13 2017
+++ src/sys/arch/next68k/dev/esp.c	Wed Feb  1 18:56:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $	*/
+/*	$NetBSD: esp.c,v 1.64.18.1 2023/02/01 18:56:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64.18.1 2023/02/01 18:56:44 martin Exp $");
 
 #include 
 #include 
@@ -509,6 +509,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 			}
 #endif
 
+			mutex_exit(&sc->sc_lock);	/* for nextdma intr */
 			while (!nextdma_finished(nsc)) {
 			/* esp_dma_isactive(sc)) { */
 NDTRACEIF (ndtrace_addc('w'));
@@ -602,7 +603,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 
 			}
 		out:
-			;
+			mutex_enter(&sc->sc_lock);	/* for nextdma intr */
 
 #ifdef ESP_DEBUG
 /* 			esp_dma_nest--; */

Index: src/sys/arch/next68k/include/bus_space.h
diff -u src/sys/arch/next68k/include/bus_space.h:1.16 src/sys/arch/next68k/include/bus_space.h:1.16.52.1
--- src/sys/arch/next68k/include/bus_space.h:1.16	Sun Feb 12 16:34:10 2012
+++ src/sys/arch/next68k/include/bus_space.h	Wed Feb  1 18:56:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.h,v 1.16 2012/02/12 16:34:10 matt Exp $	*/
+/*	$NetBSD: bus_space.h,v 1.16.52.1 2023/02/01 18:56:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -165,7 +165,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_multi_2(t, h, o, a, c) do {			\
@@ -179,7 +179,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_multi_4(t, h, o, a, c) do {			\
@@ -193,7 +193,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #if 0	/* Cause a link error for bus_space_read_multi_8 */
@@ -221,7 +221,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_region_2(t, h, o, a, c) do {			\
@@ -235,

CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 12 11:47:10 UTC 2023

Modified Files:
src/sys/arch/next68k/include [netbsd-9]: param.h vmparam.h
src/sys/arch/next68k/next68k [netbsd-9]: locore.s machdep.c
pmap_bootstrap.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1590):

sys/arch/next68k/include/vmparam.h: revision 1.29
sys/arch/next68k/next68k/machdep.c: revision 1.118
sys/arch/next68k/include/param.h: revision 1.13
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.45
sys/arch/next68k/next68k/locore.s: revision 1.70
sys/arch/next68k/next68k/locore.s: revision 1.71

Use explicit CPU strings and remove hp300 derived stuff.

Remove #ifdef'ed out hp300 specific stuff.

Remove leftover "last kernel PT page" settings derived from hp300.

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

All hp300 machines has RAMs at a region from the highest address
i.e. 0x to smaller address (as HP claims "it's the MSB first"),
so kernels have to prepare PA==KVA mappings as the "last PT page" to
guarantee the running kernel works both before and after the MMU is
turned on.  For such a special mapping, we have to set up necessary
segment table and page table during early startup, in pmap_bootstrap()
invoked from locore.s.

On the other hand, NeXT machines have RAMs at a region from 0x4000
to below (i.e. to larger address) so we still need a PA==KVA mapping.
However currently NetBSD/next68k just uses the transparent translation
registers to achieve the PA==KVA mapping, so unlike hp300 we don't have
to prepare special segment table and page table for it.

Note many other m68k ports (like luna68k, news68k, x68k etc.) have
RAMs at a region from 0x so usually we can assume PA==KVA
and don't have to bother to prepare such speicial mappings.

No user visible changes (except now freed wasted pages for the tables).

Tested on my NeXTstation slab.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.52.1 src/sys/arch/next68k/include/param.h
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.66 -r1.66.4.1 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.112.4.1 -r1.112.4.2 src/sys/arch/next68k/next68k/machdep.c
cvs rdiff -u -r1.44 -r1.44.20.1 src/sys/arch/next68k/next68k/pmap_bootstrap.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/next68k/include/param.h
diff -u src/sys/arch/next68k/include/param.h:1.12 src/sys/arch/next68k/include/param.h:1.12.52.1
--- src/sys/arch/next68k/include/param.h:1.12	Fri Feb 10 17:35:48 2012
+++ src/sys/arch/next68k/include/param.h	Sun Feb 12 11:47:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.12 2012/02/10 17:35:48 para Exp $	*/
+/*	$NetBSD: param.h,v 1.12.52.1 2023/02/12 11:47:10 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #define	PGSHIFT		12		/* LOG2(NBPG) */
 #define	KERNBASE	0x	/* start of kernel virtual */
 
-#define	UPAGES		3  		/* pages of u-area */
+#define	UPAGES		2  		/* pages of u-area */
 
 #include 
 

Index: src/sys/arch/next68k/include/vmparam.h
diff -u src/sys/arch/next68k/include/vmparam.h:1.26.2.1 src/sys/arch/next68k/include/vmparam.h:1.26.2.2
--- src/sys/arch/next68k/include/vmparam.h:1.26.2.1	Mon Feb 10 18:46:39 2020
+++ src/sys/arch/next68k/include/vmparam.h	Sun Feb 12 11:47:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.26.2.1 2020/02/10 18:46:39 martin Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.26.2.2 2023/02/12 11:47:10 martin Exp $	*/
 
 /*
  * This file was taken from from mvme68k/include/vmparam.h and
@@ -59,16 +59,8 @@
 
 /*
  * USRSTACK is the top (end) of the user stack.
- *
- * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
- * is for HPUX compatibility.  Why??  Because HPUX's debuggers
- * have the user's stack hard-wired at FFF0 for post-mortems,
- * and we must be compatible...
- */
-#define	USRSTACK	(-HIGHPAGES*PAGE_SIZE)	/* Start of user stack */
-#define	BTOPUSRSTACK	(0x10-HIGHPAGES)	/* btop(USRSTACK) */
-#define	P1PAGES		0x10
-#define	HIGHPAGES	(0x10/PAGE_SIZE)
+ */
+#define	USRSTACK	VM_MAXUSER_ADDRESS	/* Start of user stack */
 
 /*
  * Virtual memory related constants, all in bytes
@@ -106,7 +98,7 @@
 #define VM_MAXUSER_ADDRESS	((vaddr_t)0xFFF0)
 #define VM_MAX_ADDRESS		((vaddr_t)0xFFF0)
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0)
-#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)(0-PAGE_SIZE*NPTEPG*2))
+#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)(0-PAGE_SIZE*NPTEPG))
 
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
@@ -131,4 +123,4 @@ struct pmap_physseg {
 	struct pv_header *pvheader;	/* pv table for this seg */
 };
 
-#endif /* _MVME68K_VMPARAM_H_ */
+#endif /* _NEXT68K_VMPARAM_H_ */

Index: src/sys/ar

CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 12 11:47:10 UTC 2023

Modified Files:
src/sys/arch/next68k/include [netbsd-9]: param.h vmparam.h
src/sys/arch/next68k/next68k [netbsd-9]: locore.s machdep.c
pmap_bootstrap.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1590):

sys/arch/next68k/include/vmparam.h: revision 1.29
sys/arch/next68k/next68k/machdep.c: revision 1.118
sys/arch/next68k/include/param.h: revision 1.13
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.45
sys/arch/next68k/next68k/locore.s: revision 1.70
sys/arch/next68k/next68k/locore.s: revision 1.71

Use explicit CPU strings and remove hp300 derived stuff.

Remove #ifdef'ed out hp300 specific stuff.

Remove leftover "last kernel PT page" settings derived from hp300.

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

All hp300 machines has RAMs at a region from the highest address
i.e. 0x to smaller address (as HP claims "it's the MSB first"),
so kernels have to prepare PA==KVA mappings as the "last PT page" to
guarantee the running kernel works both before and after the MMU is
turned on.  For such a special mapping, we have to set up necessary
segment table and page table during early startup, in pmap_bootstrap()
invoked from locore.s.

On the other hand, NeXT machines have RAMs at a region from 0x4000
to below (i.e. to larger address) so we still need a PA==KVA mapping.
However currently NetBSD/next68k just uses the transparent translation
registers to achieve the PA==KVA mapping, so unlike hp300 we don't have
to prepare special segment table and page table for it.

Note many other m68k ports (like luna68k, news68k, x68k etc.) have
RAMs at a region from 0x so usually we can assume PA==KVA
and don't have to bother to prepare such speicial mappings.

No user visible changes (except now freed wasted pages for the tables).

Tested on my NeXTstation slab.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.52.1 src/sys/arch/next68k/include/param.h
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.66 -r1.66.4.1 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.112.4.1 -r1.112.4.2 src/sys/arch/next68k/next68k/machdep.c
cvs rdiff -u -r1.44 -r1.44.20.1 src/sys/arch/next68k/next68k/pmap_bootstrap.c

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



CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 15 19:28:30 UTC 2023

Modified Files:
src/sys/arch/next68k/dev [netbsd-9]: intio.c intiovar.h nextcons.c
nextdisplay.c nextdisplayvar.h
src/sys/arch/next68k/include [netbsd-9]: bus_space.h cpu.h
src/sys/arch/next68k/next68k [netbsd-9]: locore.s nextrom.c nextrom.h
pmap_bootstrap.c
src/sys/arch/next68k/stand/boot [netbsd-9]: boot.c version

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1598):

sys/arch/next68k/next68k/nextrom.h: revision 1.13
sys/arch/next68k/dev/nextdisplayvar.h: revision 1.6
sys/arch/next68k/dev/intiovar.h: revision 1.8
sys/arch/next68k/dev/nextcons.c: revision 1.12
sys/arch/next68k/next68k/locore.s: revision 1.69
sys/arch/next68k/dev/nextcons.c: revision 1.13
sys/arch/next68k/dev/nextcons.c: revision 1.14
sys/arch/next68k/include/bus_space.h: revision 1.18
sys/arch/next68k/dev/nextdisplay.c: revision 1.30
sys/arch/next68k/include/bus_space.h: revision 1.19
sys/arch/next68k/stand/boot/boot.c: revision 1.13
sys/arch/next68k/next68k/nextrom.c: revision 1.28
sys/arch/next68k/next68k/nextrom.c: revision 1.29
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.46
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.47
sys/arch/next68k/include/cpu.h: revision 1.52
sys/arch/next68k/dev/intio.c: revision 1.17 (patch)
sys/arch/next68k/dev/intio.c: revision 1.18 (patch)
sys/arch/next68k/dev/intio.c: revision 1.19 (patch)
sys/arch/next68k/next68k/locore.s: revision 1.72
sys/arch/next68k/stand/boot/version: revision 1.6
sys/arch/next68k/include/bus_space.h: revision 1.21
sys/arch/next68k/include/bus_space.h: revision 1.22
sys/arch/next68k/dev/nextdisplay.c: revision 1.26
sys/arch/next68k/include/bus_space.h: revision 1.23
sys/arch/next68k/dev/nextdisplay.c: revision 1.27
sys/arch/next68k/dev/nextdisplay.c: revision 1.28
sys/arch/next68k/dev/nextdisplay.c: revision 1.29

 s/impliment/implement/ in comment.

Remove cargo-culted '#if 0' code that was designed to produce a
compile-time error if any of the bus_space_*_8 functions was used,
but was documented that it produces a link-time error.

Misc KNF and cosmetics.

Use proper C99 int types.

Remove trailing spaces and TABs.

Handle NeXT Turbo VRAM regions properly.
Info from Andreas Grabher on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/06/msg52.html

Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9).

Add and check machine type NeXT_CUBE_TURBO (type 8).
Info from Andreas Grabher on port-next68k@.

NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG.
Info from Andreas Grabher on port-next68k@.

Bump version again to denote NeXT_CUBE_TURBO support.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.58.1 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.7 -r1.7.64.1 src/sys/arch/next68k/dev/intiovar.h
cvs rdiff -u -r1.11 -r1.11.64.1 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.21.42.1 -r1.21.42.2 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.5.42.1 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.16.52.1 -r1.16.52.2 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.66.4.1 -r1.66.4.2 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.27 -r1.27.4.1 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.11 -r1.11.52.1 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.44.20.1 -r1.44.20.2 \
src/sys/arch/next68k/next68k/pmap_bootstrap.c
cvs rdiff -u -r1.12 -r1.12.22.1 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.4.212.1 -r1.4.212.2 src/sys/arch/next68k/stand/boot/version

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



CVS commit: [netbsd-9] src/sys/arch/next68k

2023-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 15 19:28:30 UTC 2023

Modified Files:
src/sys/arch/next68k/dev [netbsd-9]: intio.c intiovar.h nextcons.c
nextdisplay.c nextdisplayvar.h
src/sys/arch/next68k/include [netbsd-9]: bus_space.h cpu.h
src/sys/arch/next68k/next68k [netbsd-9]: locore.s nextrom.c nextrom.h
pmap_bootstrap.c
src/sys/arch/next68k/stand/boot [netbsd-9]: boot.c version

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1598):

sys/arch/next68k/next68k/nextrom.h: revision 1.13
sys/arch/next68k/dev/nextdisplayvar.h: revision 1.6
sys/arch/next68k/dev/intiovar.h: revision 1.8
sys/arch/next68k/dev/nextcons.c: revision 1.12
sys/arch/next68k/next68k/locore.s: revision 1.69
sys/arch/next68k/dev/nextcons.c: revision 1.13
sys/arch/next68k/dev/nextcons.c: revision 1.14
sys/arch/next68k/include/bus_space.h: revision 1.18
sys/arch/next68k/dev/nextdisplay.c: revision 1.30
sys/arch/next68k/include/bus_space.h: revision 1.19
sys/arch/next68k/stand/boot/boot.c: revision 1.13
sys/arch/next68k/next68k/nextrom.c: revision 1.28
sys/arch/next68k/next68k/nextrom.c: revision 1.29
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.46
sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.47
sys/arch/next68k/include/cpu.h: revision 1.52
sys/arch/next68k/dev/intio.c: revision 1.17 (patch)
sys/arch/next68k/dev/intio.c: revision 1.18 (patch)
sys/arch/next68k/dev/intio.c: revision 1.19 (patch)
sys/arch/next68k/next68k/locore.s: revision 1.72
sys/arch/next68k/stand/boot/version: revision 1.6
sys/arch/next68k/include/bus_space.h: revision 1.21
sys/arch/next68k/include/bus_space.h: revision 1.22
sys/arch/next68k/dev/nextdisplay.c: revision 1.26
sys/arch/next68k/include/bus_space.h: revision 1.23
sys/arch/next68k/dev/nextdisplay.c: revision 1.27
sys/arch/next68k/dev/nextdisplay.c: revision 1.28
sys/arch/next68k/dev/nextdisplay.c: revision 1.29

 s/impliment/implement/ in comment.

Remove cargo-culted '#if 0' code that was designed to produce a
compile-time error if any of the bus_space_*_8 functions was used,
but was documented that it produces a link-time error.

Misc KNF and cosmetics.

Use proper C99 int types.

Remove trailing spaces and TABs.

Handle NeXT Turbo VRAM regions properly.
Info from Andreas Grabher on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/06/msg52.html

Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9).

Add and check machine type NeXT_CUBE_TURBO (type 8).
Info from Andreas Grabher on port-next68k@.

NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG.
Info from Andreas Grabher on port-next68k@.

Bump version again to denote NeXT_CUBE_TURBO support.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.58.1 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.7 -r1.7.64.1 src/sys/arch/next68k/dev/intiovar.h
cvs rdiff -u -r1.11 -r1.11.64.1 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.21.42.1 -r1.21.42.2 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.5.42.1 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.16.52.1 -r1.16.52.2 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.66.4.1 -r1.66.4.2 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.27 -r1.27.4.1 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.11 -r1.11.52.1 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.44.20.1 -r1.44.20.2 \
src/sys/arch/next68k/next68k/pmap_bootstrap.c
cvs rdiff -u -r1.12 -r1.12.22.1 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.4.212.1 -r1.4.212.2 src/sys/arch/next68k/stand/boot/version

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/next68k/dev/intio.c
diff -u src/sys/arch/next68k/dev/intio.c:1.14 src/sys/arch/next68k/dev/intio.c:1.14.58.1
--- src/sys/arch/next68k/dev/intio.c:1.14	Mon Jun  6 16:52:18 2011
+++ src/sys/arch/next68k/dev/intio.c	Wed Feb 15 19:28:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio.c,v 1.14 2011/06/06 16:52:18 matt Exp $	*/
+/*	$NetBSD: intio.c,v 1.14.58.1 2023/02/15 19:28:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,14 +34,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.14 2011/06/06 16:52:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.14.58.1 2023/02/15 19:28:29 martin Exp $");
 
 #include 
 #include 
-#include  
+#include 
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -53,12 +54,6 @@ int	intiosearch(device_t, cfdata_t, cons
 CFATTACH_DECL_NEW(intio, 0,
 intiomatch, intioattach, NULL, NULL);
 
-#if 0
-struct cfdriver

CVS commit: [netbsd-9] src/sys/arch/newsmips

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:47:07 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/newsmips/dev [netbsd-9]: fb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1763):

sys/arch/newsmips/dev/fb.c: revision 1.34
sys/arch/newsmips/conf/GENERIC: revision 1.146
sys/arch/newsmips/conf/INSTALL: revision 1.49
sys/arch/newsmips/dev/fb.c: revision 1.30
sys/arch/newsmips/dev/fb.c: revision 1.31
sys/arch/newsmips/dev/fb.c: revision 1.32
sys/arch/newsmips/dev/fb.c: revision 1.33

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

Add support for LCD-MONO framebuffer on NWS-32x0 laptop machines.

Tested on NWS-3260, which was sent from ryo@'s belongins and repaired
by me, and also tested on my NWS-3470D, including Xorg mono server.
(Note X.org server on NEWS machines requires keymap modifications)

Also add proper initialization on consinit() in NMB-253 case.


To generate a diff of this commit:
cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/newsmips/conf/INSTALL
cvs rdiff -u -r1.26 -r1.26.34.1 src/sys/arch/newsmips/dev/fb.c

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



CVS commit: [netbsd-9] src/sys/arch/newsmips

2023-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  5 17:47:07 UTC 2023

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/newsmips/dev [netbsd-9]: fb.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1763):

sys/arch/newsmips/dev/fb.c: revision 1.34
sys/arch/newsmips/conf/GENERIC: revision 1.146
sys/arch/newsmips/conf/INSTALL: revision 1.49
sys/arch/newsmips/dev/fb.c: revision 1.30
sys/arch/newsmips/dev/fb.c: revision 1.31
sys/arch/newsmips/dev/fb.c: revision 1.32
sys/arch/newsmips/dev/fb.c: revision 1.33

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

Add support for LCD-MONO framebuffer on NWS-32x0 laptop machines.

Tested on NWS-3260, which was sent from ryo@'s belongins and repaired
by me, and also tested on my NWS-3470D, including Xorg mono server.
(Note X.org server on NEWS machines requires keymap modifications)

Also add proper initialization on consinit() in NMB-253 case.


To generate a diff of this commit:
cvs rdiff -u -r1.137.2.1 -r1.137.2.2 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/newsmips/conf/INSTALL
cvs rdiff -u -r1.26 -r1.26.34.1 src/sys/arch/newsmips/dev/fb.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/newsmips/conf/GENERIC
diff -u src/sys/arch/newsmips/conf/GENERIC:1.137.2.1 src/sys/arch/newsmips/conf/GENERIC:1.137.2.2
--- src/sys/arch/newsmips/conf/GENERIC:1.137.2.1	Sun Nov  5 17:30:38 2023
+++ src/sys/arch/newsmips/conf/GENERIC	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.137.2.1 2023/11/05 17:30:38 martin Exp $
+# $NetBSD: GENERIC,v 1.137.2.2 2023/11/05 17:47:07 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/newsmips/conf/std.newsmip
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.137.2.1 $"
+#ident 		"GENERIC-$Revision: 1.137.2.2 $"
 
 maxusers	16
 
@@ -166,6 +166,7 @@ zstty4	at zsc2 channel 0		# tty04
 zstty5	at zsc2 channel 1		# tty05
 
 fb0	at hb0 addr 0x8800		# NWB-253 frame buffer
+fb0	at hb0 addr 0x9020		# LCD-MONO on NWS-32x0
 wsdisplay0 at fb? console ?
 
 xafb*	at ap?# "XA" frame buffer

Index: src/sys/arch/newsmips/conf/INSTALL
diff -u src/sys/arch/newsmips/conf/INSTALL:1.47 src/sys/arch/newsmips/conf/INSTALL:1.47.4.1
--- src/sys/arch/newsmips/conf/INSTALL:1.47	Thu Feb  7 04:33:58 2019
+++ src/sys/arch/newsmips/conf/INSTALL	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-# 	$NetBSD: INSTALL,v 1.47 2019/02/07 04:33:58 mrg Exp $
+# 	$NetBSD: INSTALL,v 1.47.4.1 2023/11/05 17:47:07 martin Exp $
 #
 #	INSTALL kernel for RISC-NEWS
 
@@ -81,7 +81,8 @@ zsc0	at ap?
 zstty0	at zsc0 channel 0		# tty00
 zstty1	at zsc0 channel 1		# tty01
 
-fb0	at hb0 addr 0x8800		# frame buffer
+fb0	at hb0 addr 0x8800		# NWB-253 frame buffer
+fb0	at hb0 addr 0x9020		# LCD-MONO on NWS-32x0
 
 xafb*	at ap?
 kb0	at ap?

Index: src/sys/arch/newsmips/dev/fb.c
diff -u src/sys/arch/newsmips/dev/fb.c:1.26 src/sys/arch/newsmips/dev/fb.c:1.26.34.1
--- src/sys/arch/newsmips/dev/fb.c:1.26	Fri Jan 31 15:43:06 2014
+++ src/sys/arch/newsmips/dev/fb.c	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb.c,v 1.26 2014/01/31 15:43:06 tsutsui Exp $	*/
+/*	$NetBSD: fb.c,v 1.26.34.1 2023/11/05 17:47:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -25,9 +25,32 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/*-
+ * Copyright (c) 2023 Izumi Tsutsui.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN C

CVS commit: [netbsd-9] src/sys/arch/hppa

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:16:54 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: pmap.c
src/sys/arch/hppa/include [netbsd-9]: pmap.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1467):

sys/arch/hppa/include/pmap.h: revision 1.41
sys/arch/hppa/hppa/pmap.c: revision 1.117

port-hppa/56849: Wacko kernel memory accounting in current/hppa

Two fixes:
- Don't include direct mapped memory in pmap statistics
- Decrement pmap statistics counts in pmap_kremove


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.100.20.1 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.37 -r1.37.42.1 src/sys/arch/hppa/include/pmap.h

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



CVS commit: [netbsd-9] src/sys/arch/hppa

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:16:54 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: pmap.c
src/sys/arch/hppa/include [netbsd-9]: pmap.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1467):

sys/arch/hppa/include/pmap.h: revision 1.41
sys/arch/hppa/hppa/pmap.c: revision 1.117

port-hppa/56849: Wacko kernel memory accounting in current/hppa

Two fixes:
- Don't include direct mapped memory in pmap statistics
- Decrement pmap statistics counts in pmap_kremove


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.100.20.1 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.37 -r1.37.42.1 src/sys/arch/hppa/include/pmap.h

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

Modified files:

Index: src/sys/arch/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.100 src/sys/arch/hppa/hppa/pmap.c:1.100.20.1
--- src/sys/arch/hppa/hppa/pmap.c:1.100	Thu Dec 22 14:47:57 2016
+++ src/sys/arch/hppa/hppa/pmap.c	Fri Jun 10 17:16:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.100 2016/12/22 14:47:57 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2016/12/22 14:47:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100.20.1 2022/06/10 17:16:54 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -975,7 +975,7 @@ pmap_bootstrap(vaddr_t vstart)
 		else if (va == uvm_lwp_getuarea(&lwp0) + USPACE - PAGE_SIZE)
 			prot = UVM_PROT_NONE;
 #endif
-		pmap_kenter_pa(va, va, prot, 0);
+		pmap_kenter_pa(va, va, prot, PMAP_DIRECTMAP);
 	}
 
 	/* XXXNH update */
@@ -1777,8 +1777,11 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	pmap_prot(pmap_kernel(), prot & VM_PROT_ALL));
 	if (IS_IOPAGE_P(pa) || (flags & PMAP_NOCACHE))
 		pte |= PTE_PROT(TLB_UNCACHEABLE);
-	pmap_kernel()->pm_stats.wired_count++;
-	pmap_kernel()->pm_stats.resident_count++;
+
+	if ((flags & PMAP_DIRECTMAP) == 0) {
+		pmap_kernel()->pm_stats.wired_count++;
+		pmap_kernel()->pm_stats.resident_count++;
+	}
 	if (opte)
 		pmap_pte_flush(pmap_kernel(), va, opte);
 
@@ -1865,6 +1868,9 @@ pmap_kremove(vaddr_t va, vsize_t size)
 		pmap_pte_flush(pmap, va, pte);
 		pmap_pte_set(pde, va, 0);
 
+		pmap->pm_stats.wired_count--;
+		pmap->pm_stats.resident_count--;
+
 		pg = pmap_initialized ? PHYS_TO_VM_PAGE(PTE_PAGE(pte)) : NULL;
 		if (pg != NULL) {
 			pve = pmap_pv_remove(pg, pmap, va);

Index: src/sys/arch/hppa/include/pmap.h
diff -u src/sys/arch/hppa/include/pmap.h:1.37 src/sys/arch/hppa/include/pmap.h:1.37.42.1
--- src/sys/arch/hppa/include/pmap.h:1.37	Mon Jan  7 16:57:28 2013
+++ src/sys/arch/hppa/include/pmap.h	Fri Jun 10 17:16:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.37 2013/01/07 16:57:28 chs Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37.42.1 2022/06/10 17:16:54 martin Exp $	*/
 
 /*	$OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $	*/
 
@@ -72,6 +72,8 @@ struct pmap {
 #define	HPPA_MAX_PID	0xfffa
 #define	HPPA_SID_MAX	0x7ffd
 
+#define	PMAP_DIRECTMAP	0x1000 /* kenter_pa */
+
 /*
  * DON'T CHANGE THIS - this is assumed in lots of places.
  */



CVS commit: [netbsd-9] src/sys/arch/hppa

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:34:22 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: trap.c
src/sys/arch/hppa/include [netbsd-9]: ptrace.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1468):

sys/arch/hppa/hppa/trap.c: revision 1.120
sys/arch/hppa/include/ptrace.h: revision 1.11-1.12 (via patch)

Define a PTRACE_ILLEGAL_ASM

Match up PTRACE_BREAKPOINT_ASM with PTRACE_BREAKPOINT which is the
gdb breakpoint instruction.

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT
This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and
single-step breakpoints


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.2 -r1.111.4.3 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/hppa/include/ptrace.h

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



CVS commit: [netbsd-9] src/sys/arch/hppa

2022-06-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 10 17:34:22 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: trap.c
src/sys/arch/hppa/include [netbsd-9]: ptrace.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1468):

sys/arch/hppa/hppa/trap.c: revision 1.120
sys/arch/hppa/include/ptrace.h: revision 1.11-1.12 (via patch)

Define a PTRACE_ILLEGAL_ASM

Match up PTRACE_BREAKPOINT_ASM with PTRACE_BREAKPOINT which is the
gdb breakpoint instruction.

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT
This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and
single-step breakpoints


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.2 -r1.111.4.3 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/hppa/include/ptrace.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.111.4.2 src/sys/arch/hppa/hppa/trap.c:1.111.4.3
--- src/sys/arch/hppa/hppa/trap.c:1.111.4.2	Fri Jun 10 16:28:16 2022
+++ src/sys/arch/hppa/hppa/trap.c	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -775,13 +775,13 @@ do_onfault:
 	case T_DBREAK | T_USER:
 		KSI_INIT_TRAP(&ksi);
 		ksi.ksi_signo = SIGTRAP;
-		ksi.ksi_code = TRAP_TRACE;
+		ksi.ksi_code = TRAP_BRKPT;
 		ksi.ksi_trap = trapnum;
 		ksi.ksi_addr = (void *)(frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK);
 #ifdef PTRACE
 		ss_clear_breakpoints(l);
 		if (opcode == SSBREAKPOINT)
-			ksi.ksi_code = TRAP_BRKPT;
+			ksi.ksi_code = TRAP_TRACE;
 #endif
 		/* pass to user debugger */
 		trapsignal(l, &ksi);

Index: src/sys/arch/hppa/include/ptrace.h
diff -u src/sys/arch/hppa/include/ptrace.h:1.9 src/sys/arch/hppa/include/ptrace.h:1.9.2.1
--- src/sys/arch/hppa/include/ptrace.h:1.9	Tue Jun 18 21:18:12 2019
+++ src/sys/arch/hppa/include/ptrace.h	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.9 2019/06/18 21:18:12 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.9.2.1 2022/06/10 17:34:22 martin Exp $	*/
 
 /*	$OpenBSD: ptrace.h,v 1.2 1998/12/01 03:05:44 mickey Exp $	*/
 
@@ -58,6 +58,11 @@
 #define PTRACE_REG_SP(r)	(r)->r_regs[30]
 #define PTRACE_REG_INTRV(r)	(r)->r_regs[28]
 
+#define HPPA_BREAK_GDB		4
+#define HPPA_BREAK_GDB_SS	8
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x00, 0x01, 0x00, 0x04 })
-#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_KERNEL), "i" (HPPA_BREAK_SS) : "memory")
+#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_GDB), "i" (HPPA_BREAK_GDB_SS) : "memory")
 #define PTRACE_BREAKPOINT_SIZE	4
+
+#define PTRACE_ILLEGAL_ASM	__asm __volatile (".word 0x000ff000" : : : "memory")



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

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:14:55 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: atari_init.c
src/sys/arch/atari/conf [netbsd-9]: GENERIC.in files.atari

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1519):

sys/arch/atari/conf/GENERIC.in: revision 1.123
sys/arch/atari/conf/files.atari: revision 1.124
sys/arch/atari/atari/atari_init.c: revision 1.105

Allocalte enough reserved ST-RAM to make the old Xserver work by default.

Instead, check ST-RAM size and TT-RAM size on startup and restrict
size of reserved ST memory on lower RAM machines.

Closes PR port-atari/41002 from David Ross.

While here, make options ST_POOL_SIZE defparam'ed to make sure to
reflect config(5) changes on each build.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.8.1 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/atari/conf/files.atari

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



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

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:14:55 UTC 2022

Modified Files:
src/sys/arch/atari/atari [netbsd-9]: atari_init.c
src/sys/arch/atari/conf [netbsd-9]: GENERIC.in files.atari

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1519):

sys/arch/atari/conf/GENERIC.in: revision 1.123
sys/arch/atari/conf/files.atari: revision 1.124
sys/arch/atari/atari/atari_init.c: revision 1.105

Allocalte enough reserved ST-RAM to make the old Xserver work by default.

Instead, check ST-RAM size and TT-RAM size on startup and restrict
size of reserved ST memory on lower RAM machines.

Closes PR port-atari/41002 from David Ross.

While here, make options ST_POOL_SIZE defparam'ed to make sure to
reflect config(5) changes on each build.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.8.1 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/atari/conf/files.atari

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/atari/atari_init.c
diff -u src/sys/arch/atari/atari/atari_init.c:1.101 src/sys/arch/atari/atari/atari_init.c:1.101.8.1
--- src/sys/arch/atari/atari/atari_init.c:1.101	Mon Feb 26 15:11:12 2018
+++ src/sys/arch/atari/atari/atari_init.c	Sun Sep 11 18:14:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $	*/
+/*	$NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,12 +33,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101 2018/02/26 15:11:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.101.8.1 2022/09/11 18:14:55 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
 #include "opt_m060sp.h"
 #include "opt_m68k_arch.h"
+#include "opt_st_pool_size.h"
 
 #include 
 #include 
@@ -145,18 +146,29 @@ extern struct pcb	*curpcb;
 vaddr_t	page_zero;
 
 /*
- * Crude support for allocation in ST-ram. Currently only used to allocate
- * video ram.
+ * Simple support for allocation in ST-ram.
+ * Currently 16 bit ST-ram is required to allocate DMA buffers for SCSI and
+ * FDC transfers, and video memory for the XFree68 based Xservers.
  * The physical address is also returned because the video init needs it to
  * setup the controller at the time the vm-system is not yet operational so
  * 'kvtop()' cannot be used.
  */
+#define	ST_POOL_SIZE_MIN	24	/* for DMA bounce buffers */
 #ifndef ST_POOL_SIZE
-#define	ST_POOL_SIZE	40			/* XXX: enough? */
+#define	ST_POOL_SIZE		56	/* Xserver requires 320KB (40 pages) */
 #endif
 
-u_long	st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable	*/
-u_long	st_pool_virt, st_pool_phys;
+psize_t	st_pool_size = ST_POOL_SIZE * PAGE_SIZE; /* Patchable	*/
+vaddr_t	st_pool_virt;
+paddr_t	st_pool_phys;
+
+/*
+ * Thresholds to restrict size of reserved ST memory to make sure
+ * the kernel at least boot even on lower memory machines.
+ * Nowadays we could assume most users have 4MB ST-RAM and 16MB TT-RAM.
+ */
+#define	STRAM_MINTHRESH		(2 * 1024 * 1024)
+#define	TTRAM_MINTHRESH		(4 * 1024 * 1024)
 
 /* I/O address space variables */
 vaddr_t	stio_addr;		/* Where the st io-area is mapped	*/
@@ -284,12 +296,20 @@ start_c(int id, u_int ttphystart, u_int 
 #endif
 
 	/*
-	 * The following is a hack. We do not know how much ST memory we
-	 * really need until after configuration has finished. At this
-	 * time I have no idea how to grab ST memory at that time.
+	 * We do not know how much ST memory we really need until after
+	 * configuration has finished, but typical users of ST memory
+	 * are bounce buffers DMA against TT-RAM for SCSI and FDC,
+	 * and video memory for the Xserver.
+	 * If we have enough RAMs reserve ST memory including for the Xserver.
+	 * Otherwise just allocate minimum one for SCSI and FDC.
+	 *
 	 * The round_page() call is ment to correct errors made by
 	 * binpatching!
 	 */
+	if (st_pool_size > ST_POOL_SIZE_MIN * PAGE_SIZE &&
+	(stphysize <= STRAM_MINTHRESH || ttphysize <= TTRAM_MINTHRESH)) {
+		st_pool_size = ST_POOL_SIZE_MIN * PAGE_SIZE;
+	}
 	st_pool_size   = m68k_round_page(st_pool_size);
 	st_pool_phys   = stphysize - st_pool_size;
 	stphysize  = st_pool_phys;

Index: src/sys/arch/atari/conf/GENERIC.in
diff -u src/sys/arch/atari/conf/GENERIC.in:1.118 src/sys/arch/atari/conf/GENERIC.in:1.118.4.1
--- src/sys/arch/atari/conf/GENERIC.in:1.118	Sat Apr 13 08:22:59 2019
+++ src/sys/arch/atari/conf/GENERIC.in	Sun Sep 11 18:14:55 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.in,v 1.118 2019/04/13 08:22:59 isaki Exp $
+#	$NetBSD: GENERIC.in,v 1.118.4.1 2022/09/11 18:14:55 martin Exp $
 #
 # Generic atari
 #
@@ -204,7 +204,7 @@ options		PIPE_SOCKETPAIR	# smaller, but 
 # Atari specific options
 #
 #options 	KFONT_

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

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:23:30 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: MILAN.in
src/sys/arch/atari/pci [netbsd-9]: pci_vga.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1521):

sys/arch/atari/pci/pci_vga.c: revision 1.19
sys/arch/atari/conf/MILAN.in: revision 1.30

Improve VGA console settings for Milan, especially for sysinst.
- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)

Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/atari/conf/MILAN.in
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/atari/pci/pci_vga.c

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



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

2022-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 11 18:23:30 UTC 2022

Modified Files:
src/sys/arch/atari/conf [netbsd-9]: MILAN.in
src/sys/arch/atari/pci [netbsd-9]: pci_vga.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1521):

sys/arch/atari/pci/pci_vga.c: revision 1.19
sys/arch/atari/conf/MILAN.in: revision 1.30

Improve VGA console settings for Milan, especially for sysinst.
- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)

Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/arch/atari/conf/MILAN.in
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/atari/pci/pci_vga.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/MILAN.in
diff -u src/sys/arch/atari/conf/MILAN.in:1.29 src/sys/arch/atari/conf/MILAN.in:1.29.2.1
--- src/sys/arch/atari/conf/MILAN.in:1.29	Sat May  4 13:12:03 2019
+++ src/sys/arch/atari/conf/MILAN.in	Sun Sep 11 18:23:30 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#	$NetBSD: MILAN.in,v 1.29.2.1 2022/09/11 18:23:30 martin Exp $
 #
 # Milan
 #
@@ -34,6 +34,8 @@ options 	WSDISPLAY_DEFAULTSCREENS=4
 options 	PCDISPLAY_SOFTCURSOR
 # modify the screen type of the console; defaults to "80x25"
 #options 	VGA_CONSOLE_SCREENTYPE="\"80x25\""
+# use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
+options 	FONT_VT220L8x16
 
 #
 # The following sections describe various hardware options.

Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.17 src/sys/arch/atari/pci/pci_vga.c:1.17.2.1
--- src/sys/arch/atari/pci/pci_vga.c:1.17	Sat May  4 09:03:08 2019
+++ src/sys/arch/atari/pci/pci_vga.c	Sun Sep 11 18:23:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.17.2.1 2022/09/11 18:23:30 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.17 2019/05/04 09:03:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.17.2.1 2022/09/11 18:23:30 martin Exp $");
 
 #include 
 #include 
@@ -55,11 +55,51 @@ extern font_info	font_info_8x8;
 extern font_info	font_info_8x16;
 
 /* Console colors */
-static const uint8_t conscolors[3][3] = {
-	/* background, foreground, hilite */
-	{ 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x30 },
-	{ 0x3f, 0x3f, 0x3f }
+/* attribute controller registers */
+static const uint8_t vga_atc[] = {
+	0x00,	/* 00: internal palette  0 */
+	0x01,	/* 01: internal palette  1 */
+	0x02,	/* 02: internal palette  2 */
+	0x03,	/* 03: internal palette  3 */
+	0x04,	/* 04: internal palette  4 */
+	0x05,	/* 05: internal palette  5 */
+	0x14,	/* 06: internal palette  6 */
+	0x07,	/* 07: internal palette  7 */
+	0x38,	/* 08: internal palette  8 */
+	0x39,	/* 09: internal palette  9 */
+	0x3a,	/* 0A: internal palette 10 */
+	0x3b,	/* 0B: internal palette 11 */
+	0x3c,	/* 0C: internal palette 12 */
+	0x3d,	/* 0D: internal palette 13 */
+	0x3e,	/* 0E: internal palette 14 */
+	0x3f,	/* 0F: internal palette 15 */
+	0x0c,	/* 10: attribute mode control */
+	0x00,	/* 11: overscan color */
+	0x0f,	/* 12: color plane enable */
+	0x08,	/* 13: horizontal PEL panning */
+	0x00	/* 14: color select */
+};
+
+/* video DAC palette registers */
+/* XXX only set up 16 colors used by internal palette in ATC regsters */
+static const uint8_t vga_dacpal[] = {
+	/* R G B */
+	0x00, 0x00, 0x00,	/* BLACK*/
+	0x00, 0x00, 0x2a,	/* BLUE	*/
+	0x00, 0x2a, 0x00,	/* GREEN*/
+	0x00, 0x2a, 0x2a,	/* CYAN */
+	0x2a, 0x00, 0x00,	/* RED  */
+	0x2a, 0x00, 0x2a,	/* MAGENTA  */
+	0x2a, 0x15, 0x00,	/* BROWN*/
+	0x2a, 0x2a, 0x2a,	/* LIGHTGREY*/
+	0x15, 0x15, 0x15,	/* DARKGREY */
+	0x15, 0x15, 0x3f,	/* LIGHTBLUE*/
+	0x15, 0x3f, 0x15,	/* LIGHTGREEN   */
+	0x15, 0x3f, 0x3f,	/* LIGHTCYAN*/
+	0x3f, 0x15, 0x15,	/* LIGHTRED */
+	0x3f, 0x15, 0x3f,	/* LIGHTMAGENTA */
+	0x3f, 0x3f, 0x15,	/* YELLOW   */
+	0x3f, 0x3f, 0x3f	/* WHITE*/
 };
 
 static bus_space_tag_t	vga_iot, vga_memt;
@@ -79,7 +119,7 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	pci_chipset_tag_t	pc = NULL; /* XXX */
 	bus_space_handle_t	ioh_regs, memh_fb;
 	pcitag_t		tag;
-	int			device, found, maxndevs, i, j;
+	int			device, found, maxndevs, i;
 	int			got_ioh, got_memh, rv;
 	uint32_t		id, class;
 	volatile uint8_t	*regs;
@@ -176,16 +216,23 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	 * Generic pa

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

2022-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 10 15:02:51 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: i82093reg.h
src/sys/arch/x86/x86 [netbsd-9]: ioapic.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1536):

sys/arch/x86/x86/ioapic.c: revision 1.66
sys/arch/x86/include/i82093reg.h: revision 1.7

Print detail about misconfigured APIC ID.

IOAPIC_ID_MASK is 8 bits these days. Fixes PR kern/54276.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/x86/include/i82093reg.h
cvs rdiff -u -r1.63 -r1.63.2.1 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.



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

2022-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 10 15:02:51 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: i82093reg.h
src/sys/arch/x86/x86 [netbsd-9]: ioapic.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1536):

sys/arch/x86/x86/ioapic.c: revision 1.66
sys/arch/x86/include/i82093reg.h: revision 1.7

Print detail about misconfigured APIC ID.

IOAPIC_ID_MASK is 8 bits these days. Fixes PR kern/54276.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/x86/include/i82093reg.h
cvs rdiff -u -r1.63 -r1.63.2.1 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/include/i82093reg.h
diff -u src/sys/arch/x86/include/i82093reg.h:1.6 src/sys/arch/x86/include/i82093reg.h:1.6.2.1
--- src/sys/arch/x86/include/i82093reg.h:1.6	Wed Jun 19 06:32:46 2019
+++ src/sys/arch/x86/include/i82093reg.h	Mon Oct 10 15:02:50 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: i82093reg.h,v 1.6 2019/06/19 06:32:46 msaitoh Exp $ */
+/* 	$NetBSD: i82093reg.h,v 1.6.2.1 2022/10/10 15:02:50 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 #define IOAPIC_ID		0x00
 
 #define 	IOAPIC_ID_SHIFT		24
-#define		IOAPIC_ID_MASK		0x0f00
+#define		IOAPIC_ID_MASK		0xff00
 
 /* Version, and maximum interrupt pin number. */
   

Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.63 src/sys/arch/x86/x86/ioapic.c:1.63.2.1
--- src/sys/arch/x86/x86/ioapic.c:1.63	Wed Jun 19 06:32:46 2019
+++ src/sys/arch/x86/x86/ioapic.c	Mon Oct 10 15:02:50 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.63 2019/06/19 06:32:46 msaitoh Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.63.2.1 2022/10/10 15:02:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.63 2019/06/19 06:32:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.63.2.1 2022/10/10 15:02:50 martin Exp $");
 
 #include "opt_ddb.h"
 
@@ -371,8 +371,9 @@ ioapic_attach(device_t parent, device_t 
 	 * mapping later ...
 	 */
 	if (apic_id != sc->sc_pic.pic_apicid) {
-		aprint_debug_dev(sc->sc_dev, "misconfigured as apic %d\n",
- apic_id);
+		aprint_debug_dev(sc->sc_dev,
+		"apid is misconfigured (%d != %d)\n",
+		apic_id, sc->sc_pic.pic_apicid);
 
 		ioapic_write(sc, IOAPIC_ID,
 		(ioapic_read(sc, IOAPIC_ID) & ~IOAPIC_ID_MASK)
@@ -383,7 +384,8 @@ ioapic_attach(device_t parent, device_t 
 
 		if (apic_id != sc->sc_pic.pic_apicid)
 			aprint_error_dev(sc->sc_dev,
-			"can't remap to apid %d\n", sc->sc_pic.pic_apicid);
+			"can't remap apid from %d to %d\n",
+			apic_id, sc->sc_pic.pic_apicid);
 		else
 			aprint_debug_dev(sc->sc_dev, "remapped to apic %d\n",
 			sc->sc_pic.pic_apicid);



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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:05:44 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-9]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1538):
sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20
Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/x86/x86/cpu_ucode_intel.c

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



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

2022-10-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 11 18:05:44 UTC 2022

Modified Files:
src/sys/arch/x86/include [netbsd-9]: cpu_ucode.h
src/sys/arch/x86/x86 [netbsd-9]: cpu_ucode_intel.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1538):
sys/arch/x86/include/cpu_ucode.h: revision 1.5
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.19
sys/arch/x86/x86/cpu_ucode_intel.c: revision 1.20
Add missing newline in a message. KNF.
Verify checksum of the extended signature table.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/sys/arch/x86/include/cpu_ucode.h
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/x86/x86/cpu_ucode_intel.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/cpu_ucode.h
diff -u src/sys/arch/x86/include/cpu_ucode.h:1.4 src/sys/arch/x86/include/cpu_ucode.h:1.4.6.1
--- src/sys/arch/x86/include/cpu_ucode.h:1.4	Sat Mar 17 15:56:32 2018
+++ src/sys/arch/x86/include/cpu_ucode.h	Tue Oct 11 18:05:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.h,v 1.4 2018/03/17 15:56:32 christos Exp $ */
+/* $NetBSD: cpu_ucode.h,v 1.4.6.1 2022/10/11 18:05:44 martin Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -69,17 +69,16 @@ struct intel1_ucode_header {
 	uint32_t	uh_reserved[3];
 };
 
-struct intel1_ucode_proc_signature {
-	uint32_t	ups_signature;
-	uint32_t	ups_proc_flags;
-	uint32_t	ups_checksum;
-};
-
 struct intel1_ucode_ext_table {
 	uint32_t	uet_count;
 	uint32_t	uet_checksum;
 	uint32_t	uet_reserved[3];
-	struct intel1_ucode_proc_signature uet_proc_sig[1];
+};
+
+struct intel1_ucode_proc_signature {
+	uint32_t	ups_signature;
+	uint32_t	ups_proc_flags;
+	uint32_t	ups_checksum;
 };
 
 #endif

Index: src/sys/arch/x86/x86/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17.2.1
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.17	Fri May 10 18:21:01 2019
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Tue Oct 11 18:05:44 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.17.2.1 2022/10/11 18:05:44 martin Exp $ */
 
 /*
  * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17 2019/05/10 18:21:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.17.2.1 2022/10/11 18:05:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xen.h"
@@ -111,63 +111,65 @@ static int
 cpu_ucode_intel_verify(struct cpu_ucode_softc *sc,
 struct intel1_ucode_header *buf)
 {
+	struct intel1_ucode_ext_table *ehdr;
 	uint32_t data_size, total_size, payload_size, ext_size;
 	uint32_t sum;
+	uint32_t *p;
 	int i;
 
 	if ((buf->uh_header_ver != 1) || (buf->uh_loader_rev != 1))
 		return EINVAL;
 
-	/*
-	 * Data size.
-	 */
-	if (buf->uh_data_size == 0) {
+	/* Data size. */
+	if (buf->uh_data_size == 0)
 		data_size = 2000;
-	} else {
+	else
 		data_size = buf->uh_data_size;
-	}
 	if ((data_size % 4) != 0)
 		return EINVAL;
 	if (data_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Total size.
-	 */
-	if (buf->uh_total_size == 0) {
+	/* Total size. */
+	if (buf->uh_total_size == 0)
 		total_size = data_size + 48;
-	} else {
+	else
 		total_size = buf->uh_total_size;
-	}
 	if ((total_size % 1024) != 0)
 		return EINVAL;
 	if (total_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Payload size.
-	 */
+	/* Payload size. */
 	payload_size = data_size + 48;
 	if (payload_size > sc->sc_blobsize)
 		return EINVAL;
 
-	/*
-	 * Verify checksum of update data and header. Exclude extended
-	 * signature.
-	 */
+	/* Verify checksum of update data and header(s). */
 	sum = 0;
-	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) {
-		sum += *((uint32_t *)buf + i);
-	}
+	p = (uint32_t *)buf;
+	for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+		sum += p[i];
 	if (sum != 0)
 		return EINVAL;
 
-	/*
-	 * Extended table size. Ignored for now.
-	 */
 	ext_size = total_size - payload_size;
 	if (ext_size > 0) {
-		printf("This image has extended signature table.");
+		/* This image has extended signature table. */
+		ehdr = (struct intel1_ucode_ext_table *)
+		((uint8_t *)buf + sizeof(struct intel1_ucode_header) +
+			data_size);
+		payload_size =
+		sizeof(struct intel1_ucode_ext_table) +
+		sizeof(struct intel1_ucode_proc_signature) *
+		ehdr->uet_count;
+		
+		sum = 0;
+		p = (uint32_t *)ehdr;
+		for (i = 0; i < (payload_size / sizeof(uint32_t)); i++)
+			sum += p[i];
+		if (sum != 0)
+			return EINVAL;
 	}
 
 	return 0;
@@ -198,7 +200,8 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
 		/* Make the buffer 16 byte aligned. */
 		newbufsize = sc->sc_blobsize + 15;
 		uha = kmem_alloc(newbufsize, KM_SLEEP);
-		uh = (struct intel1_uco

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

2019-10-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 15 19:40:34 UTC 2019

Modified Files:
src/sys/arch/arm/acpi [netbsd-9]: files.acpi gic_acpi.c gicv3_acpi.c
src/sys/arch/arm/cortex [netbsd-9]: files.cortex gic_v2m.c gic_v2m.h
Added Files:
src/sys/arch/arm/acpi [netbsd-9]: gic_v2m_acpi.c gic_v2m_acpi.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #334):

sys/arch/arm/cortex/gic_v2m.c: revision 1.7
sys/arch/arm/acpi/gicv3_acpi.c: revision 1.5
sys/arch/arm/acpi/files.acpi: revision 1.8
sys/arch/arm/acpi/gic_acpi.c: revision 1.4
sys/arch/arm/cortex/files.cortex: revision 1.13
sys/arch/arm/acpi/gic_v2m_acpi.c: revision 1.1
sys/arch/arm/acpi/gic_v2m_acpi.h: revision 1.1
sys/arch/arm/cortex/gic_v2m.h: revision 1.2

Add support for Amazon's Graviton MSI controller.

Graviton has a GICv3 with a modified GICv2m (!) for MSIs. Instead of
sending messages to a fixed address with the SPI as data, the Graviton's
GICv2m uses a different address for each vector with "don't care" as data.


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/arch/arm/acpi/files.acpi
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/acpi/gic_acpi.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/acpi/gic_v2m_acpi.c \
src/sys/arch/arm/acpi/gic_v2m_acpi.h
cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/sys/arch/arm/acpi/gicv3_acpi.c
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/cortex/gic_v2m.c
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/cortex/gic_v2m.h

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



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

2019-10-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 15 19:40:34 UTC 2019

Modified Files:
src/sys/arch/arm/acpi [netbsd-9]: files.acpi gic_acpi.c gicv3_acpi.c
src/sys/arch/arm/cortex [netbsd-9]: files.cortex gic_v2m.c gic_v2m.h
Added Files:
src/sys/arch/arm/acpi [netbsd-9]: gic_v2m_acpi.c gic_v2m_acpi.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #334):

sys/arch/arm/cortex/gic_v2m.c: revision 1.7
sys/arch/arm/acpi/gicv3_acpi.c: revision 1.5
sys/arch/arm/acpi/files.acpi: revision 1.8
sys/arch/arm/acpi/gic_acpi.c: revision 1.4
sys/arch/arm/cortex/files.cortex: revision 1.13
sys/arch/arm/acpi/gic_v2m_acpi.c: revision 1.1
sys/arch/arm/acpi/gic_v2m_acpi.h: revision 1.1
sys/arch/arm/cortex/gic_v2m.h: revision 1.2

Add support for Amazon's Graviton MSI controller.

Graviton has a GICv3 with a modified GICv2m (!) for MSIs. Instead of
sending messages to a fixed address with the SPI as data, the Graviton's
GICv2m uses a different address for each vector with "don't care" as data.


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/arch/arm/acpi/files.acpi
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/acpi/gic_acpi.c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/acpi/gic_v2m_acpi.c \
src/sys/arch/arm/acpi/gic_v2m_acpi.h
cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/sys/arch/arm/acpi/gicv3_acpi.c
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/cortex/gic_v2m.c
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/cortex/gic_v2m.h

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

Modified files:

Index: src/sys/arch/arm/acpi/files.acpi
diff -u src/sys/arch/arm/acpi/files.acpi:1.6.6.1 src/sys/arch/arm/acpi/files.acpi:1.6.6.2
--- src/sys/arch/arm/acpi/files.acpi:1.6.6.1	Mon Sep 23 07:06:31 2019
+++ src/sys/arch/arm/acpi/files.acpi	Tue Oct 15 19:40:34 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.6.6.1 2019/09/23 07:06:31 martin Exp $
+#	$NetBSD: files.acpi,v 1.6.6.2 2019/10/15 19:40:34 martin Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -26,6 +26,8 @@ file	arch/arm/acpi/gic_acpi.c		gic_acpi
 attach	gicvthree at acpimadtbus with gicv3_acpi
 file	arch/arm/acpi/gicv3_acpi.c		gicv3_acpi
 
+file	arch/arm/acpi/gic_v2m_acpi.c		(gic_acpi | gicv3_acpi) & pci
+
 attach	gtmr at acpisdtbus with gtmr_acpi
 file	arch/arm/acpi/gtmr_acpi.c		gtmr_acpi
 

Index: src/sys/arch/arm/acpi/gic_acpi.c
diff -u src/sys/arch/arm/acpi/gic_acpi.c:1.3 src/sys/arch/arm/acpi/gic_acpi.c:1.3.6.1
--- src/sys/arch/arm/acpi/gic_acpi.c:1.3	Mon Nov 12 12:56:05 2018
+++ src/sys/arch/arm/acpi/gic_acpi.c	Tue Oct 15 19:40:34 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
+/* $NetBSD: gic_acpi.c,v 1.3.6.1 2019/10/15 19:40:34 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3.6.1 2019/10/15 19:40:34 martin Exp $");
 
 #include 
 #include 
@@ -43,16 +43,17 @@ __KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
-#include 
+#include 
 
 #define	GICD_SIZE		0x1000
 #define	GICC_SIZE		0x1000
-#define	GICMSIFRAME_SIZE	0x1000
 
 extern struct bus_space arm_generic_bs_tag;
 extern struct pic_softc *pic_list[];
@@ -61,9 +62,6 @@ static int	gic_acpi_match(device_t, cfda
 static void	gic_acpi_attach(device_t, device_t, void *);
 
 static ACPI_STATUS gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER *, void *);
-#if NPCI > 0
-static ACPI_STATUS gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *, void *);
-#endif
 
 CFATTACH_DECL_NEW(gic_acpi, 0, gic_acpi_match, gic_acpi_attach, NULL, NULL);
 
@@ -130,7 +128,7 @@ gic_acpi_attach(device_t parent, device_
 		arm_fdt_irq_set_handler(armgic_irq_handler);
 
 #if NPCI > 0
-	acpi_madt_walk(gic_acpi_find_msi_frame, armgic);
+	acpi_madt_walk(gic_v2m_acpi_find_msi_frame, armgic);
 #endif
 }
 
@@ -146,46 +144,3 @@ gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER 
 
 	return AE_LIMIT;
 }
-
-#if NPCI > 0
-static ACPI_STATUS
-gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
-{
-	ACPI_MADT_GENERIC_MSI_FRAME *msi_frame = (ACPI_MADT_GENERIC_MSI_FRAME *)hdrp;
-	struct gic_v2m_frame *frame;
-	struct pic_softc *pic = pic_list[0];
-	device_t armgic = aux;
-
-	if (hdrp->Type != ACPI_MADT_TYPE_GENERIC_MSI_FRAME)
-		return AE_OK;
-
-	frame = kmem_zalloc(sizeof(*frame), KM_SLEEP);
-	frame->frame_reg = msi_frame->BaseAddress;
-	frame->frame_pic = pic;
-	if (msi_frame->Flags & ACPI_MADT_OVERRIDE_SPI_VALUES) {
-		frame->frame_base = msi_frame->SpiBase;
-		frame->frame_count = msi_frame->SpiCount;
-	} else {
-		bus_space_tag_t bst = &arm_generic_bs_tag;
-	

CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  3 11:36:56 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: Makefile.zaurus.inc
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: Makefile compat_linux.h
zbsdmod.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #391):

sys/arch/zaurus/stand/zbsdmod/Makefile: revision 1.12
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.10
sys/arch/zaurus/conf/Makefile.zaurus.inc: revision 1.10
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.11
sys/arch/zaurus/stand/zbsdmod/compat_linux.h: revision 1.7

Explicitly set empty LINKENTRY to keep ENTRY address specified in ldscript.

This fixes kernel boot failures of NetBSD/zaurus 8.x and later.
While here, also set empty TEXTADDR also specified in ldscript.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.

Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Misc cleanup to avoid future confusion.
- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding

 -

Make sure to clear bss before jumping to a kernel copied from load buffer.
This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.22.1 src/sys/arch/zaurus/conf/Makefile.zaurus.inc
cvs rdiff -u -r1.10 -r1.10.22.1 src/sys/arch/zaurus/stand/zbsdmod/Makefile
cvs rdiff -u -r1.6 -r1.6.52.1 \
src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.9 -r1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c

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



CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  3 11:36:56 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: Makefile.zaurus.inc
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: Makefile compat_linux.h
zbsdmod.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #391):

sys/arch/zaurus/stand/zbsdmod/Makefile: revision 1.12
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.10
sys/arch/zaurus/conf/Makefile.zaurus.inc: revision 1.10
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.11
sys/arch/zaurus/stand/zbsdmod/compat_linux.h: revision 1.7

Explicitly set empty LINKENTRY to keep ENTRY address specified in ldscript.

This fixes kernel boot failures of NetBSD/zaurus 8.x and later.
While here, also set empty TEXTADDR also specified in ldscript.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.

Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Misc cleanup to avoid future confusion.
- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding

 -

Make sure to clear bss before jumping to a kernel copied from load buffer.
This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.22.1 src/sys/arch/zaurus/conf/Makefile.zaurus.inc
cvs rdiff -u -r1.10 -r1.10.22.1 src/sys/arch/zaurus/stand/zbsdmod/Makefile
cvs rdiff -u -r1.6 -r1.6.52.1 \
src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.9 -r1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/conf/Makefile.zaurus.inc
diff -u src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9 src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9.22.1
--- src/sys/arch/zaurus/conf/Makefile.zaurus.inc:1.9	Tue Aug 25 02:38:15 2015
+++ src/sys/arch/zaurus/conf/Makefile.zaurus.inc	Sun Nov  3 11:36:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.zaurus.inc,v 1.9 2015/08/25 02:38:15 uebayasi Exp $
+#	$NetBSD: Makefile.zaurus.inc,v 1.9.22.1 2019/11/03 11:36:56 martin Exp $
 
 MACHINE_ARCH?=		arm
 CPPFLAGS+=		-D${MACHINE}
@@ -20,6 +20,8 @@ SYSTEM_LD_TAIL_EXTRA+=; \
 KERNEL_BASE_VIRT=	$(LOADADDRESS)
 
 KERNLDSCRIPT=		ldscript
+TEXTADDR=		# defined in ldscript
+LINKENTRY=		# defined in ldscript
 
 EXTRA_CLEAN+=		netbsd.map assym.d ldscript tmp
 

Index: src/sys/arch/zaurus/stand/zbsdmod/Makefile
diff -u src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10 src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10.22.1
--- src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.10	Sun Jan 31 15:32:13 2016
+++ src/sys/arch/zaurus/stand/zbsdmod/Makefile	Sun Nov  3 11:36:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2016/01/31 15:32:13 christos Exp $
+#	$NetBSD: Makefile,v 1.10.22.1 2019/11/03 11:36:56 martin Exp $
 
 WARNS?=	4
 
@@ -10,8 +10,18 @@ OBJS=	zbsdmod.o
 SRCS=	zbsdmod.c
 NOMAN=	# defined
 
+OBJCOPY_FLAGS=			\
+	-R .debug_abbrev	\
+	-R .debug_aranges	\
+	-R .debug_info		\
+	-R .debug_line		\
+	-R .debug_loc		\
+	-R .debug_ranges	\
+	-R .debug_str		\
+	-R .eh_frame
+
 realall: ${OBJS}
-	${OBJCOPY} -R .eh_frame ${.OBJDIR}/zbsdmod.o
+	${OBJCOPY} ${OBJCOPY_FLAGS} ${.OBJDIR}/zbsdmod.o
 
 .include 
 .include 
@@ -21,11 +31,12 @@ afterinstall:
 		${OBJS} ${DESTDIR}/${BINDIR}
 
 CPUFLAGS=
-COPTS=		-Os
+DBG=		-Os
 CFLAGS+=	-fno-strict-aliasing
-CFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
-CPPFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
-CPPFLAGS+=  -nostdinc -D_STANDALONE
+CFLAGS+=	-ffreestanding -nostdinc
+CFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
+CPPFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
+CPPFLAGS+=	-D_STANDALONE
 CPPFLAGS+=	-I${.OBJDIR} -I${S}
 
 release: check_RELEASEDIR

Index: src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
diff -u src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6.52.1
--- src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6	Sun Dec 11 14:05:39 2011
+++ src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h	Sun Nov  3 11:36:56 2019
@@ -1

CVS commit: [netbsd-9] src/sys/arch/aarch64

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:08:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: pmap.c
src/sys/arch/aarch64/include [netbsd-9]: pmap.h

Log Message:
Pull up following revision(s) (requested by maya in ticket #393):

sys/arch/aarch64/include/pmap.h: revision 1.26
sys/arch/aarch64/aarch64/pmap.c: revision 1.48

Define PMAP_NEED_PROCWR, providing strategically placed i-cache
synchronization where just-changed memory is about to be executed.

Fixes SIGILLs seen when running Mono 6 on QEMU Cortex-A57.

ok ryo


To generate a diff of this commit:
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/arch/aarch64/include/pmap.h

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



CVS commit: [netbsd-9] src/sys/arch/aarch64

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:08:19 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-9]: pmap.c
src/sys/arch/aarch64/include [netbsd-9]: pmap.h

Log Message:
Pull up following revision(s) (requested by maya in ticket #393):

sys/arch/aarch64/include/pmap.h: revision 1.26
sys/arch/aarch64/aarch64/pmap.c: revision 1.48

Define PMAP_NEED_PROCWR, providing strategically placed i-cache
synchronization where just-changed memory is about to be executed.

Fixes SIGILLs seen when running Mono 6 on QEMU Cortex-A57.

ok ryo


To generate a diff of this commit:
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/arch/aarch64/include/pmap.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.2 src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.3
--- src/sys/arch/aarch64/aarch64/pmap.c:1.41.2.2	Mon Sep 23 07:00:35 2019
+++ src/sys/arch/aarch64/aarch64/pmap.c	Mon Nov  4 14:08:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.41.2.2 2019/09/23 07:00:35 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.41.2.3 2019/11/04 14:08:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.2 2019/09/23 07:00:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.3 2019/11/04 14:08:18 martin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -874,6 +874,22 @@ pmap_icache_sync_range(pmap_t pm, vaddr_
 	pm_unlock(pm);
 }
 
+/*
+ * Routine:	pmap_procwr
+ *
+ * Function:
+ *	Synchronize caches corresponding to [addr, addr+len) in p.
+ *
+ */
+void
+pmap_procwr(struct proc *p, vaddr_t va, int len)
+{
+
+	/* We only need to do anything if it is the current process. */
+	if (p == curproc)
+		cpu_icache_sync_range(va, len);
+}
+
 static pt_entry_t
 _pmap_pte_adjust_prot(pt_entry_t pte, vm_prot_t prot, vm_prot_t protmask,
 bool user)

Index: src/sys/arch/aarch64/include/pmap.h
diff -u src/sys/arch/aarch64/include/pmap.h:1.24 src/sys/arch/aarch64/include/pmap.h:1.24.4.1
--- src/sys/arch/aarch64/include/pmap.h:1.24	Mon Apr  8 21:18:22 2019
+++ src/sys/arch/aarch64/include/pmap.h	Mon Nov  4 14:08:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.24 2019/04/08 21:18:22 ryo Exp $ */
+/* $NetBSD: pmap.h,v 1.24.4.1 2019/11/04 14:08:18 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,6 +46,7 @@
 
 #include 
 
+#define PMAP_NEED_PROCWR
 #define PMAP_GROWKERNEL
 #define PMAP_STEAL_MEMORY
 
@@ -272,6 +273,7 @@ aarch64_mmap_flags(paddr_t mdpgno)
 #define pmap_wired_count(pmap)		((pmap)->pm_stats.wired_count)
 #define pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)
 
+void	pmap_procwr(struct proc *, vaddr_t, int);
 bool	pmap_extract_coherency(pmap_t, vaddr_t, paddr_t *, bool *);
 void	pmap_icache_sync_range(pmap_t, vaddr_t, vaddr_t);
 



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

2019-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 12 18:24:37 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #419):

sys/arch/x86/include/specialreg.h: revision 1.157
sys/arch/x86/x86/spectre.c: revision 1.31

Mitigation for CVE-2019-11135: TSX Asynchronous Abort (TAA).

Two sysctls are added:
machdep.taa.mitigated = {0/1} user-settable
machdep.taa.method = {string} constructed by the kernel

There are two cases:

  (1) If the CPU is affected by MDS, then the MDS mitigation will also
mitigate TAA, and we have nothing else to do. We make the 'mitigated' leaf
read-only, and force:

machdep.taa.mitigated = machdep.mds.mitigated
machdep.taa.method = [MDS]

The kernel already enables the MDS mitigation by default.

  (2) If the CPU is not affected by MDS but is affected by TAA, then we use
the new TSX_CTRL MSR to disable RTM. This MSR is provided via a microcode
update, now available on the Intel website. The kernel will automatically
enable the TAA mitigation if the updated microcode is present. If the new
microcode is not present, the user can load it via cpuctl, and set
machdep.taa.mitigated=1.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.3 -r1.150.2.4 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/x86/x86/spectre.c

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



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

2019-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 12 18:24:37 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #419):

sys/arch/x86/include/specialreg.h: revision 1.157
sys/arch/x86/x86/spectre.c: revision 1.31

Mitigation for CVE-2019-11135: TSX Asynchronous Abort (TAA).

Two sysctls are added:
machdep.taa.mitigated = {0/1} user-settable
machdep.taa.method = {string} constructed by the kernel

There are two cases:

  (1) If the CPU is affected by MDS, then the MDS mitigation will also
mitigate TAA, and we have nothing else to do. We make the 'mitigated' leaf
read-only, and force:

machdep.taa.mitigated = machdep.mds.mitigated
machdep.taa.method = [MDS]

The kernel already enables the MDS mitigation by default.

  (2) If the CPU is not affected by MDS but is affected by TAA, then we use
the new TSX_CTRL MSR to disable RTM. This MSR is provided via a microcode
update, now available on the Intel website. The kernel will automatically
enable the TAA mitigation if the updated microcode is present. If the new
microcode is not present, the user can load it via cpuctl, and set
machdep.taa.mitigated=1.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.3 -r1.150.2.4 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/x86/x86/spectre.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/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.3 src/sys/arch/x86/include/specialreg.h:1.150.2.4
--- src/sys/arch/x86/include/specialreg.h:1.150.2.3	Sun Nov 10 13:06:46 2019
+++ src/sys/arch/x86/include/specialreg.h	Tue Nov 12 18:24:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.3 2019/11/10 13:06:46 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.4 2019/11/12 18:24:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -853,9 +853,14 @@
 #define 	IA32_ARCH_SKIP_L1DFL_VMENTRY 0x08
 #define 	IA32_ARCH_SSB_NO	0x10
 #define 	IA32_ARCH_MDS_NO	0x20
+#define 	IA32_ARCH_TSX_CTRL	0x80
+#define 	IA32_ARCH_TAA_NO	0x100
 #define MSR_IA32_FLUSH_CMD	0x10b
 #define 	IA32_FLUSH_CMD_L1D_FLUSH 0x01
 #define MSR_TSX_FORCE_ABORT	0x10f
+#define MSR_IA32_TSX_CTRL	0x122
+#define 	IA32_TSX_CTRL_RTM_DISABLE	__BIT(0)
+#define 	IA32_TSX_CTRL_TSX_CPUID_CLEAR	__BIT(1)
 #define MSR_SYSENTER_CS		0x174	/* PII+ only */
 #define MSR_SYSENTER_ESP	0x175	/* PII+ only */
 #define MSR_SYSENTER_EIP	0x176	/* PII+ only */

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.29.2.1 src/sys/arch/x86/x86/spectre.c:1.29.2.2
--- src/sys/arch/x86/x86/spectre.c:1.29.2.1	Thu Sep 26 18:47:14 2019
+++ src/sys/arch/x86/x86/spectre.c	Tue Nov 12 18:24:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.29.2.1 2019/09/26 18:47:14 martin Exp $	*/
+/*	$NetBSD: spectre.c,v 1.29.2.2 2019/11/12 18:24:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 NetBSD Foundation, Inc.
@@ -30,11 +30,11 @@
  */
 
 /*
- * Mitigations for the SpectreV2, SpectreV4 and MDS CPU flaws.
+ * Mitigations for the SpectreV2, SpectreV4, MDS and TAA CPU flaws.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.29.2.1 2019/09/26 18:47:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.29.2.2 2019/11/12 18:24:37 martin Exp $");
 
 #include "opt_spectre.h"
 
@@ -773,6 +773,185 @@ sysctl_machdep_mds_mitigated(SYSCTLFN_AR
 
 /* -- */
 
+enum taa_mitigation {
+	TAA_MITIGATION_NONE,
+	TAA_MITIGATION_TAA_NO,
+	TAA_MITIGATION_MDS,
+	TAA_MITIGATION_RTM_DISABLE
+};
+
+static char taa_mitigation_name[64] = "(none)";
+
+static enum taa_mitigation taa_mitigation_method = TAA_MITIGATION_NONE;
+static bool taa_mitigation_enabled __read_mostly = false;
+static bool *taa_mitigation_enabled_ptr = &taa_mitigation_enabled;
+
+static void
+mitigation_taa_apply_cpu(struct cpu_info *ci, bool enabled)
+{
+	uint64_t msr;
+
+	switch (taa_mitigation_method) {
+	case TAA_MITIGATION_NONE:
+	case TAA_MITIGATION_TAA_NO:
+	case TAA_MITIGATION_MDS:
+		panic("impossible");
+	case TAA_MITIGATION_RTM_DISABLE:
+		msr = rdmsr(MSR_IA32_TSX_CTRL);
+		if (enabled) {
+			msr |= IA32_TSX_CTRL_RTM_DISABLE;
+		} else {
+			msr &= ~IA32_TSX_CTRL_RTM_DISABLE;
+		}
+		wrmsr(MSR_IA32_TSX_CTRL, msr);
+		break;
+	}
+}
+
+static void
+mitigation_taa_change_cpu(void *arg1, void *arg2)
+{
+	struct cpu_info *ci = curcpu();
+	bool enabled = (bool)arg1;
+
+	mitigation_taa_apply_cpu(ci, enabled);
+}
+
+static void
+taa_detect_method(void)
+{
+	u_int descs[4];
+	uint64_t msr;
+
+	taa_mitigation_enabled_ptr = &taa_mitigation_enabled;
+
+	if (cpu_vendor != CPUVENDOR_INTEL) {
+		taa_mitigation_method = TAA_MITIGATION_TAA_NO;

CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:59:15 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: zbsdmod.c
src/sys/arch/zaurus/zaurus [netbsd-9]: machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #431):

sys/arch/zaurus/conf/GENERIC: revision 1.89
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.12
sys/arch/zaurus/conf/INSTALL: revision 1.40
sys/arch/zaurus/zaurus/machdep.c: revision 1.45

Make zaurus kernels use symbol tables loaded by the bootloader.

Now COPY_SYMTAB is no longer necessary and it saves ~500kbytes of
GENERIC, so re-enable options DDB (i.e. revert GENERIC rev 1.85).
Also fix zbsdmod.o (a kernel loader for Zaurus Linux) to load symbols
at a proper address as the MI sys/lib/libsa/loadfile_elf32.c does.

No particular comment on port-zaurus@:

 https://mail-index.netbsd.org/port-zaurus/2019/11/11/msg86.html

Note zbsdmod.c (derived from OpenBSD/zaurus) assumed that the loaded
kernels had "esym" variable at the top of its data section and
implicitly overwrote it with the address of loaded symbol tables.
OpenBSD/zaurus kernels used the esym value written by the zbsdmod.o
to initialize ksyms(4) on startup, but we will avoid such implicit
MD interface between the bootloader and kernels (though we don't
bother to add a symbol address value into bootinfo but just assume
symbols are loaded at end[] of a loaded kernel, as per the MI
libsa loadfile() implementation).

Worth to pullup to both netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86.2.1 -r1.86.2.2 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.9.34.1 -r1.9.34.2 \
src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/arch/zaurus/zaurus/machdep.c

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



CVS commit: [netbsd-9] src/sys/arch/zaurus

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:59:15 UTC 2019

Modified Files:
src/sys/arch/zaurus/conf [netbsd-9]: GENERIC INSTALL
src/sys/arch/zaurus/stand/zbsdmod [netbsd-9]: zbsdmod.c
src/sys/arch/zaurus/zaurus [netbsd-9]: machdep.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #431):

sys/arch/zaurus/conf/GENERIC: revision 1.89
sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.12
sys/arch/zaurus/conf/INSTALL: revision 1.40
sys/arch/zaurus/zaurus/machdep.c: revision 1.45

Make zaurus kernels use symbol tables loaded by the bootloader.

Now COPY_SYMTAB is no longer necessary and it saves ~500kbytes of
GENERIC, so re-enable options DDB (i.e. revert GENERIC rev 1.85).
Also fix zbsdmod.o (a kernel loader for Zaurus Linux) to load symbols
at a proper address as the MI sys/lib/libsa/loadfile_elf32.c does.

No particular comment on port-zaurus@:

 https://mail-index.netbsd.org/port-zaurus/2019/11/11/msg86.html

Note zbsdmod.c (derived from OpenBSD/zaurus) assumed that the loaded
kernels had "esym" variable at the top of its data section and
implicitly overwrote it with the address of loaded symbol tables.
OpenBSD/zaurus kernels used the esym value written by the zbsdmod.o
to initialize ksyms(4) on startup, but we will avoid such implicit
MD interface between the bootloader and kernels (though we don't
bother to add a symbol address value into bootinfo but just assume
symbols are loaded at end[] of a loaded kernel, as per the MI
libsa loadfile() implementation).

Worth to pullup to both netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.86.2.1 -r1.86.2.2 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.9.34.1 -r1.9.34.2 \
src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/arch/zaurus/zaurus/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/zaurus/conf/GENERIC
diff -u src/sys/arch/zaurus/conf/GENERIC:1.86.2.1 src/sys/arch/zaurus/conf/GENERIC:1.86.2.2
--- src/sys/arch/zaurus/conf/GENERIC:1.86.2.1	Mon Nov  4 14:34:28 2019
+++ src/sys/arch/zaurus/conf/GENERIC	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.86.2.1 2019/11/04 14:34:28 martin Exp $
+#	$NetBSD: GENERIC,v 1.86.2.2 2019/11/16 16:59:15 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -150,11 +150,10 @@ options 	WSDISPLAY_COMPAT_RAWKBD		# can 
 options 	DIAGNOSTIC		# internal consistency checks
 #options 	DEBUG
 #options 	VERBOSE_INIT_ARM	# verbose bootstraping messages
-#options 	DDB			# in-kernel debugger
-#options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
+options 	DDB			# in-kernel debugger
+options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #options 	KGDB
 #makeoptions 	DEBUG="-g"		# compile full symbol table
-makeoptions	COPY_SYMTAB=1
 
 
 # Kernel root file system and dump configuration.

Index: src/sys/arch/zaurus/conf/INSTALL
diff -u src/sys/arch/zaurus/conf/INSTALL:1.39 src/sys/arch/zaurus/conf/INSTALL:1.39.4.1
--- src/sys/arch/zaurus/conf/INSTALL:1.39	Thu Feb  7 20:56:27 2019
+++ src/sys/arch/zaurus/conf/INSTALL	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.39 2019/02/07 20:56:27 rin Exp $
+# $NetBSD: INSTALL,v 1.39.4.1 2019/11/16 16:59:15 martin Exp $
 #
 # INSTALL config file (GENERIC with memory disk root)
 #
@@ -59,7 +59,6 @@ options 		RASOPS_SMALL
 no options 		DIAGNOSTIC
 no options 		DDB
 no options 		DDB_HISTORY_SIZE
-no makeoptions	COPY_SYMTAB
 
 no options 		PXA2X0_DMAC_DMOVER_CONCURRENCY
 

Index: src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
diff -u src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.1 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.2
--- src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9.34.1	Sun Nov  3 11:36:56 2019
+++ src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbsdmod.c,v 1.9.34.1 2019/11/03 11:36:56 martin Exp $	*/
+/*	$NetBSD: zbsdmod.c,v 1.9.34.2 2019/11/16 16:59:15 martin Exp $	*/
 /*	$OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $	*/
 
 /*
@@ -139,8 +139,8 @@ elf32bsdboot(void)
 			if (maxv < posv)
 maxv = posv;
 		}
-		if (IS_DATA(phdr[i]) && IS_BSS(phdr[i])) {
-			posv += phdr[i].p_memsz;
+		if (IS_BSS(phdr[i])) {
+			posv += phdr[i].p_memsz - phdr[i].p_filesz;
 			if (maxv < posv)
 maxv = posv;
 		}

Index: src/sys/arch/zaurus/zaurus/machdep.c
diff -u src/sys/arch/zaurus/zaurus/machdep.c:1.42 src/sys/arch/zaurus/zaurus/machdep.c:1.42.2.1
--- src/sys/arch/zaurus/zaurus/machdep.c:1.42	Tue Jul 16 14:41:49 2019
+++ src/sys/arch/zaurus/zaurus/machdep.c	Sat Nov 16 16:59:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.42 2019/07/16 14:41:49 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.42.2.1 2019/11/16 16:59:15 martin Exp $	*/
 

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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:31:00 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64-pine64-plus.dts
sun50i-a64-pine64.dts sun50i-a64-sopine-baseboard.dts
sun50i-a64.dtsi
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c sunxi_ccu_div.c
sunxi_dwhdmi.c sunxi_i2s.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #437):

sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_ccu_div.c: revision 1.6
sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.13
sys/arch/arm/dts/sun50i-a64-pine64.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_dwhdmi.c: revision 1.4
sys/arch/arm/dts/sun50i-a64-pine64-plus.dts: revision 1.3
sys/arch/arm/sunxi/sunxi_i2s.c: revision 1.7
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.14

Add support for A64 I2S clocks.
Add A64 HDMI audio support.
Enable HDMI audio support on Pine64, Pine64+, and Pine64 LTS boards.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.10.1 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts \
src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/arch/arm/dts/sun50i-a64.dtsi
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/sunxi/sunxi_ccu_div.c
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_i2s.c

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



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:31:00 UTC 2019

Modified Files:
src/sys/arch/arm/dts [netbsd-9]: sun50i-a64-pine64-plus.dts
sun50i-a64-pine64.dts sun50i-a64-sopine-baseboard.dts
sun50i-a64.dtsi
src/sys/arch/arm/sunxi [netbsd-9]: sun50i_a64_ccu.c sunxi_ccu_div.c
sunxi_dwhdmi.c sunxi_i2s.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #437):

sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_ccu_div.c: revision 1.6
sys/arch/arm/dts/sun50i-a64.dtsi: revision 1.13
sys/arch/arm/dts/sun50i-a64-pine64.dts: revision 1.2
sys/arch/arm/sunxi/sunxi_dwhdmi.c: revision 1.4
sys/arch/arm/dts/sun50i-a64-pine64-plus.dts: revision 1.3
sys/arch/arm/sunxi/sunxi_i2s.c: revision 1.7
sys/arch/arm/sunxi/sun50i_a64_ccu.c: revision 1.14

Add support for A64 I2S clocks.
Add A64 HDMI audio support.
Enable HDMI audio support on Pine64, Pine64+, and Pine64 LTS boards.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.10.1 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts \
src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/arch/arm/dts/sun50i-a64.dtsi
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/sunxi/sunxi_ccu_div.c
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/sunxi/sunxi_i2s.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/dts/sun50i-a64-pine64-plus.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2 src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2.10.1
--- src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts:1.2	Sat Sep  9 12:05:28 2017
+++ src/sys/arch/arm/dts/sun50i-a64-pine64-plus.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pine64-plus.dts,v 1.2 2017/09/09 12:05:28 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pine64-plus.dts,v 1.2.10.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -49,3 +49,11 @@
 &ohci0 {
 	status = "okay";
 };
+
+&i2s2 {
+	status = "okay";
+};
+
+&sound_hdmi {
+	status = "okay";
+};

Index: src/sys/arch/arm/dts/sun50i-a64-pine64.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1 src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1.8.1
--- src/sys/arch/arm/dts/sun50i-a64-pine64.dts:1.1	Sun Feb 18 12:20:25 2018
+++ src/sys/arch/arm/dts/sun50i-a64-pine64.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pine64.dts,v 1.1 2018/02/18 12:20:25 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pine64.dts,v 1.1.8.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,3 +28,11 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts"
 #include "sun50i-a64.dtsi"
+
+&i2s2 {
+	status = "okay";
+};
+
+&sound_hdmi {
+	status = "okay";
+};
Index: src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1.8.1
--- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.1	Thu Jun  7 00:51:41 2018
+++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.1 2018/06/07 00:51:41 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.1.8.1 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,3 +28,11 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts"
 #include "sun50i-a64.dtsi"
+
+&i2s2 {
+	status = "okay";
+};
+
+&sound_hdmi {
+	status = "okay";
+};

Index: src/sys/arch/arm/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.1 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.2
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.11.2.1	Sun Nov 10 13:14:41 2019
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Mon Nov 18 19:31:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.11.2.1 2019/11/10 13:14:41 martin Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.11.2.2 2019/11/18 19:31:00 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -59,6 +59,36 @@
 			 ,
 			 ;
 	};
+
+	i2s2: i2s@1c22800 {
+		#sound-dai-cells = <0>;
+		compatible = "allwinner,sun50i-a64-i2s",
+			 "allwinner,sun8i-h3-i2s";
+		reg = <0x01c22800 0x400>;
+		interrupts = ;
+		clocks = <&ccu CLK_BUS_I2S2>, <&ccu CLK_I2S2>;
+		clock-names = "apb", "mod";
+		resets = <&ccu RST_BUS_I2S2>;
+		dma-names = "tx";
+		dmas = <&dma 27>;
+		status = "disabled";
+	};
+
+	sound_hdmi: sound-hdmi {
+		compatibl

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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 14:20:57 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1855):

sys/arch/x86/x86/identcpu.c: revision 1.129
sys/arch/x86/include/specialreg.h: revision 1.212
sys/arch/x86/x86/identcpu.c: revision 1.130

Disable the VIA Alternate Instructions according the VIA documentation:
* C7 and above do not support ALTINST, do not check or attempt to disable them.
* For VIA C3 Nehemiah check extended feature flags for support and status,
  do no attempt to disable when AIS is not supported or enabled.
* For pre-Nehemiah models explicitly disable, if they are in the range
  of documented models, flags aren't present to check the status on
  these models.

Note: for pre-Nehemiah may be other functional side effects depdending
on the version and stepping.

Explicit disabling of ALTINST was introduced with rev. 1.84 following
the discovery of some VIA CPUs having these instructions enabled by default
leading to the potential backdoor (aka rosenbrindge).

Unfortunately, implementation used a wrong check (ACE supported flag),
which can be true for the later models, still supporting padlock features.

Setting ALTINST bit on those may have unexpected side effects like VIA C7 CPUID
instruction for temperature sensor not reporting correct value or
`cpuctl identify' not reporting certain CPU features. Similar side effects
can be observed even for Nehemiah models not supporting AIS instructions. This
change should limit possibility of such issues to only the pre-Nehemiah models,
not covered at all in the previous implementation.

Feature Control Register (FCR) macros were unified under one group and
consistent naming while implementing the change. Few comments updated as well.
patch reviewed by Riastradh@ (thank you)

PR kern/58370

Move determination of the largest VIA CPU extended function value
to the intended place where the checks are performed.
Currently the value can be overridden while checking for the padlock features,
and failing the check for max function value as a result.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.15 -r1.150.2.16 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.15 src/sys/arch/x86/include/specialreg.h:1.150.2.16
--- src/sys/arch/x86/include/specialreg.h:1.150.2.15	Sat Jul 29 09:48:51 2023
+++ src/sys/arch/x86/include/specialreg.h	Sat Jul 20 14:20:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.15 2023/07/29 09:48:51 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.16 2024/07/20 14:20:57 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -1099,8 +1099,12 @@
 
 /*
  * Centaur Extended Feature flags.
- * CPUID FnC000_0001
+ * CPUID FnC000_0001 (VIA "Nehemiah" or later)
  */
+#define CPUID_VIA_HAS_AIS	__BIT(0)	/* Alternate Instruction Set supported */
+		/* (VIA "Nehemiah" only) */
+#define CPUID_VIA_DO_AIS	__BIT(1)	/* Alternate Instruction Set enabled */
+		/* (VIA "Nehemiah" only) */
 #define CPUID_VIA_HAS_RNG	__BIT(2)	/* Random number generator */
 #define CPUID_VIA_DO_RNG	__BIT(3)
 #define CPUID_VIA_HAS_ACE	__BIT(6)	/* AES Encryption */
@@ -1288,7 +1292,7 @@
 #define  MSR_X2APIC_SELF_IPI		0x03f	/* SELF IPI (W) */
 
 /*
- * VIA "Nehemiah" MSRs
+ * VIA "Nehemiah" or later MSRs
  */
 #define MSR_VIA_RNG		0x110b
 #define MSR_VIA_RNG_ENABLE	0x0040
@@ -1296,15 +1300,10 @@
 #define MSR_VIA_RNG_NOISE_A	0x
 #define MSR_VIA_RNG_NOISE_B	0x0100
 #define MSR_VIA_RNG_2NOISE	0x0300
-#define MSR_VIA_ACE		0x1107
-#define 	VIA_ACE_ALTINST	0x0001
-#define 	VIA_ACE_ECX8	0x0002
-#define 	VIA_ACE_ENABLE	0x1000
-
-/*
- * VIA "Eden" MSRs
- */
-#define MSR_VIA_FCR		MSR_VIA_ACE
+#define MSR_VIA_FCR		0x1107	/* Feature Control Register */
+#define 	VIA_FCR_ACE_ENABLE	0x1000	/* Enable PadLock (ex. RNG) */
+#define 	VIA_FCR_CX8_REPORT	0x0002	/* Enable CX8 CPUID reporting */
+#define 	VIA_FCR_ALTINST_ENABLE	0x0001	/* Enable ALTINST (C3 only) */
 
 /*
  * AMD K6/K7 MSRs.

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.93.2.5 src/sys/arch/x86/x86/identcpu.c:1.93.2.6
--- src/sys/arch/x86/x86/identcpu.c:1.93.2.5	Fri Dec 24 12:58:14 2021
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jul 20 14:20:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.93.2.5 2021/12/24 12:58:14 martin Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.93.2.6 2024/07/20 14:20:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30

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

2024-07-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 20 14:20:57 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1855):

sys/arch/x86/x86/identcpu.c: revision 1.129
sys/arch/x86/include/specialreg.h: revision 1.212
sys/arch/x86/x86/identcpu.c: revision 1.130

Disable the VIA Alternate Instructions according the VIA documentation:
* C7 and above do not support ALTINST, do not check or attempt to disable them.
* For VIA C3 Nehemiah check extended feature flags for support and status,
  do no attempt to disable when AIS is not supported or enabled.
* For pre-Nehemiah models explicitly disable, if they are in the range
  of documented models, flags aren't present to check the status on
  these models.

Note: for pre-Nehemiah may be other functional side effects depdending
on the version and stepping.

Explicit disabling of ALTINST was introduced with rev. 1.84 following
the discovery of some VIA CPUs having these instructions enabled by default
leading to the potential backdoor (aka rosenbrindge).

Unfortunately, implementation used a wrong check (ACE supported flag),
which can be true for the later models, still supporting padlock features.

Setting ALTINST bit on those may have unexpected side effects like VIA C7 CPUID
instruction for temperature sensor not reporting correct value or
`cpuctl identify' not reporting certain CPU features. Similar side effects
can be observed even for Nehemiah models not supporting AIS instructions. This
change should limit possibility of such issues to only the pre-Nehemiah models,
not covered at all in the previous implementation.

Feature Control Register (FCR) macros were unified under one group and
consistent naming while implementing the change. Few comments updated as well.
patch reviewed by Riastradh@ (thank you)

PR kern/58370

Move determination of the largest VIA CPU extended function value
to the intended place where the checks are performed.
Currently the value can be overridden while checking for the padlock features,
and failing the check for max function value as a result.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.15 -r1.150.2.16 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 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.



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:42:18 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.9 -r1.150.2.10 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.



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:42:18 UTC 2022

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

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

sys/arch/x86/include/specialreg.h   1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.9 -r1.150.2.10 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.150.2.9 src/sys/arch/x86/include/specialreg.h:1.150.2.10
--- src/sys/arch/x86/include/specialreg.h:1.150.2.9	Wed Dec  8 15:44:16 2021
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 31 17:42:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.9 2021/12/08 15:44:16 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.10 2022/01/31 17:42:17 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -97,29 +97,29 @@
 /*
  * CR4
  */
-#define CR4_VME		0x0001 /* virtual 8086 mode extension enable */
-#define CR4_PVI		0x0002 /* protected mode virtual interrupt enable */
-#define CR4_TSD		0x0004 /* restrict RDTSC instruction to cpl 0 */
-#define CR4_DE		0x0008 /* debugging extension */
-#define CR4_PSE		0x0010 /* large (4MB) page size enable */
-#define CR4_PAE		0x0020 /* physical address extension enable */
-#define CR4_MCE		0x0040 /* machine check enable */
-#define CR4_PGE		0x0080 /* page global enable */
-#define CR4_PCE		0x0100 /* enable RDPMC instruction for all cpls */
-#define CR4_OSFXSR	0x0200 /* enable fxsave/fxrestor and SSE */
-#define CR4_OSXMMEXCPT	0x0400 /* enable unmasked SSE exceptions */
-#define CR4_UMIP	0x0800 /* user-mode instruction prevention */
+#define CR4_VME		0x0001 /* Virtual 8086 mode extension enable */
+#define CR4_PVI		0x0002 /* Protected mode virtual interrupt enable */
+#define CR4_TSD		0x0004 /* Restrict RDTSC instruction to cpl 0 */
+#define CR4_DE		0x0008 /* Debugging extension */
+#define CR4_PSE		0x0010 /* Large (4MB) page size enable */
+#define CR4_PAE		0x0020 /* Physical address extension enable */
+#define CR4_MCE		0x0040 /* Machine check enable */
+#define CR4_PGE		0x0080 /* Page global enable */
+#define CR4_PCE		0x0100 /* Enable RDPMC instruction for all cpls */
+#define CR4_OSFXSR	0x0200 /* Enable fxsave/fxrestor and SSE */
+#define CR4_OSXMMEXCPT	0x0400 /* Enable unmasked SSE exceptions */
+#define CR4_UMIP	0x0800 /* User Mode Instruction Prevention */
 #define CR4_LA57	0x1000 /* 57-bit linear addresses */
-#define CR4_VMXE	0x2000 /* enable VMX operations */
-#define CR4_SMXE	0x4000 /* enable SMX operations */
-#define CR4_FSGSBASE	0x0001 /* enable *FSBASE and *GSBASE instructions */
-#define CR4_PCIDE	0x0002 /* enable Process Context IDentifiers */
-#define CR4_OSXSAVE	0x0004 /* enable xsave and xrestore */
-#define CR4_SMEP	0x0010 /* enable SMEP support */
-#define CR4_SMAP	0x0020 /* enable SMAP support */
-#define CR4_PKE		0x0040 /* enable Protection Keys for user pages */
-#define CR4_CET		0x0080 /* enable CET */
-#define CR4_PKS		0x0100 /* enable Protection Keys for kern pages */
+#define CR4_VMXE	0x2000 /* Enable VMX operations */
+#define CR4_SMXE	0x4000 /* Enable SMX operations */
+#define CR4_FSGSBASE	0x0001 /* Enable *FSBASE and *GSBASE instructions */
+#define CR4_PCIDE	0x0002 /* Enable Process Context IDentifiers */
+#define CR4_OSXSAVE	0x0004 /* Enable xsave and xrestore */
+#define CR4_SMEP	0x0010 /* Enable SMEP support */
+#define CR4_SMAP	0x0020 /* Enable SMAP support */
+#define CR4_PKE		0x0040 /* Enable Protection Keys for user pages */
+#define CR4_CET		0x0080 /* Enable CET */
+#define CR4_PKS		0x0100 /* Enable Protection Keys for kern pages */
 
 /*
  * Extended Control Register XCR0
@@ -137,14 +137,15 @@
 #define XCR0_CET_U	0x0800	/* User CET state */
 #define XCR0_CET_S	0x1000	/* Kern CET state */
 #define XCR0_HDC	0x2000	/* Hardware Duty Cycle state */
+#define XCR0_LBR	0x8000	/* Last Branch Record */
 #define XCR0_HWP	0x0001	/* Hardware P-states */
 
-#define XCR0_FLAGS1	"\20" \
-	"\1" "x87"		"\2" "SSE"		"\3" "AVX"	\
-	"\4" "BNDREGS"		"\5" "BNDCSR"		"\6"

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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:54:59 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1419):

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.4 -r1.33.2.5 src/sys/arch/x86/x86/procfs_machdep.c

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



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:54:59 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1419):

sys/arch/x86/x86/procfs_machdep.c: revision 1.43
sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
%edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x0007:1 %eax correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.4 -r1.33.2.5 src/sys/arch/x86/x86/procfs_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/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.5
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.4	Fri Dec  3 19:49:35 2021
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 31 17:54:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.4 2021/12/03 19:49:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.5 2022/01/31 17:54:59 martin Exp $");
 
 #include 
 #include 
@@ -120,10 +120,8 @@ static const char * const x86_features[]
 	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
 
 	{ /* (8) Linux mapping */
-	"tpr_shadow", "vnmi", "flexpriority", "ept",
-	"vpid", "npt", "lbrv", "svm_lock",
-	"nrip_save", "tsc_scale", "vmcb_clean", "flushbyasid",
-	"decodeassists", "pausefilter", "pfthreshold", "vmmcall",
+	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
 	NULL, "ept_ad", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -141,15 +139,16 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (11) 0x000f:0 edx */
-	NULL, "cqm_llc", NULL, NULL, NULL, NULL, NULL, NULL,
+	{ /* (11) Linux mapping */
+	"cqm_llc", "cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local",
+	NULL, NULL, "split_lock_detect", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (12) 0x000f:1 edx */
-	"cqm_occup_llc", "cqm_mbm_total", "cqm_mbm_local", NULL,
+	{ /* (12) Intel-defined 0x0007:1 eax */
 	NULL, NULL, NULL, NULL,
+	"avx_vnni", "avx512_bf16", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -158,7 +157,7 @@ static const char * const x86_features[]
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "ppin",
-	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "virt_ssbd", NULL, "cppc", NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */
 	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
@@ -181,7 +180,8 @@ static const char * const x86_features[]
 	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
 	"avx512_bitalg", "tme", "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
-	NULL, "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgx_lc", NULL},
+	NULL, "cldemote", NULL, "movdiri",
+	"movdir64b", "enqcmd", "sgx_lc", NULL},
 
 	{ /* (17) 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
@@ -192,7 +192,8 @@ static const char * const x86_features[]
 	{ /* (18) Intel 0x0007 edx */
 	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", "fsrm", NULL, NULL, NULL,
 	"vp2intersect", NULL, "md_clear", NULL, NULL, NULL, "serialize", NULL,
-	"tsxldtrk", NULL, "pconfig", NULL, NULL, NULL, NULL, "avx512_fp16",
+	"tsxldtrk", NULL, "pconfig", "arch_lbr",
+	NULL, NULL, NULL, "avx512_fp16",
 	NULL, NULL, NULL, NULL,
 	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
 
@@ -307,14 +308,11 @@ procfs_getonecpufeatures(struct cpu_info
 		diff = last - *left;
 	}
 
-	if (ci->ci_max_cpuid >= 0x0f) {
-		x86_cpuid2(0x0f, 0, descs);
-		procfs_getonefeatreg(descs[3], x86_features[11], p + diff,
-		left);
-		diff = last - *left;
+	/* x86_features[11] is Linux defined mapping */
 
-		x86_cpuid2(0x0f, 1, descs);
-		procfs_getonefeatreg(descs[3], x86_features[12], p 

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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:10:38 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: pmap.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1443):

sys/arch/x86/x86/pmap.c: revision 1.414

return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.

This should only affect performances.


To generate a diff of this commit:
cvs rdiff -u -r1.334.2.6 -r1.334.2.7 src/sys/arch/x86/x86/pmap.c

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



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:10:38 UTC 2022

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: pmap.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1443):

sys/arch/x86/x86/pmap.c: revision 1.414

return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.

This should only affect performances.


To generate a diff of this commit:
cvs rdiff -u -r1.334.2.6 -r1.334.2.7 src/sys/arch/x86/x86/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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.334.2.6 src/sys/arch/x86/x86/pmap.c:1.334.2.7
--- src/sys/arch/x86/x86/pmap.c:1.334.2.6	Fri Sep  3 10:27:33 2021
+++ src/sys/arch/x86/x86/pmap.c	Fri May 13 11:10:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.334.2.7 2022/05/13 11:10:38 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.6 2021/09/03 10:27:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.7 2022/05/13 11:10:38 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3187,8 +3187,10 @@ pmap_zero_page(paddr_t pa)
 	pagezero(PMAP_DIRECT_MAP(pa));
 #else
 #if defined(XENPV)
-	if (XEN_VERSION_SUPPORTED(3, 4))
+	if (XEN_VERSION_SUPPORTED(3, 4)) {
 		xen_pagezero(pa);
+		return;
+	}
 #endif
 	struct cpu_info *ci;
 	pt_entry_t *zpte;



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:12:49 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1444):

sys/arch/xen/x86/x86_xpmap.c: revision 1.91

In bootstrap, after switching to a new page table make sure that
now-unused memory is unmapped.


To generate a diff of this commit:
cvs rdiff -u -r1.84.4.1 -r1.84.4.2 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/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.1 src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.2
--- src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.1	Sun May 31 10:39:34 2020
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri May 13 11:12:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.84.4.1 2020/05/31 10:39:34 martin Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84.4.1 2020/05/31 10:39:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -909,7 +909,7 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 	/* Unpin old PGD */
 	xpq_queue_unpin_table(xpmap_ptom_masked(old_pgd - KERNBASE));
 
-	/* Mark old tables RW */
+	/* Mark old tables RW if used, unmap otherwise */
 	page = old_pgd;
 	addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PG_FRAME);
 	pte = (pd_entry_t *)((u_long)addr + KERNBASE);
@@ -923,6 +923,12 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 		 */
 		pte++;
 	}
+	while (page < old_pgd + (old_count * PAGE_SIZE)) {
+		addr = xpmap_ptom(((u_long)pte) - KERNBASE);
+		xpq_queue_pte_update(addr, 0);
+		page += PAGE_SIZE;
+		pte++;
+	}
 	xpq_flush_queue();
 }
 



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

2022-05-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 13 11:12:49 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1444):

sys/arch/xen/x86/x86_xpmap.c: revision 1.91

In bootstrap, after switching to a new page table make sure that
now-unused memory is unmapped.


To generate a diff of this commit:
cvs rdiff -u -r1.84.4.1 -r1.84.4.2 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.



CVS commit: [netbsd-9] src/sys/arch/hppa/hppa

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:32:43 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: hppa_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1446):

sys/arch/hppa/hppa/hppa_machdep.c: revision 1.33

port-hppa/56830: RAS support is slightly incorrect on hppa

When searching for RAS use tf_iioq_head without the HPPA_PC_PRIV_MASK bits
set.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/hppa/hppa/hppa_machdep.c

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



CVS commit: [netbsd-9] src/sys/arch/hppa/hppa

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:32:43 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: hppa_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1446):

sys/arch/hppa/hppa/hppa_machdep.c: revision 1.33

port-hppa/56830: RAS support is slightly incorrect on hppa

When searching for RAS use tf_iioq_head without the HPPA_PC_PRIV_MASK bits
set.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.34.1 src/sys/arch/hppa/hppa/hppa_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/hppa/hppa/hppa_machdep.c
diff -u src/sys/arch/hppa/hppa/hppa_machdep.c:1.29 src/sys/arch/hppa/hppa/hppa_machdep.c:1.29.34.1
--- src/sys/arch/hppa/hppa/hppa_machdep.c:1.29	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/hppa/hppa_machdep.c	Sat May 14 11:32:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_machdep.c,v 1.29 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: hppa_machdep.c,v 1.29.34.1 2022/05/14 11:32:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.29 2014/02/24 07:23:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.29.34.1 2022/05/14 11:32:43 martin Exp $");
 
 #include 
 #include 
@@ -279,7 +279,9 @@ hppa_ras(struct lwp *l)
 
 	p = l->l_proc;
 	tf = l->l_md.md_regs;
-	rasaddr = (intptr_t)ras_lookup(p, (void *)tf->tf_iioq_head);
+
+	rasaddr = (intptr_t)ras_lookup(p,
+	(void *)(tf->tf_iioq_head & ~HPPA_PC_PRIV_MASK));
 	if (rasaddr != -1) {
 		rasaddr |= HPPA_PC_PRIV_USER;
 		tf->tf_iioq_head = rasaddr;



CVS commit: [netbsd-9] src/sys/arch/hppa/hppa

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:38:32 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: idle_machdep.c machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1448):

sys/arch/hppa/hppa/idle_machdep.c: revision 1.4
sys/arch/hppa/hppa/machdep.c: revision 1.17

Add some special NOPs to help qemu.
thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/arch/hppa/hppa/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/hppa/hppa/idle_machdep.c
diff -u src/sys/arch/hppa/hppa/idle_machdep.c:1.3 src/sys/arch/hppa/hppa/idle_machdep.c:1.3.4.1
--- src/sys/arch/hppa/hppa/idle_machdep.c:1.3	Mon Apr 15 20:45:08 2019
+++ src/sys/arch/hppa/hppa/idle_machdep.c	Sat May 14 11:38:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $	*/
+/*	$NetBSD: idle_machdep.c,v 1.3.4.1 2022/05/14 11:38:31 martin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3.4.1 2022/05/14 11:38:31 martin Exp $");
 
 #include 
 #include 
@@ -36,5 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: idle_machdep
 void
 cpu_idle(void)
 {
-	/* do nothing */
+/*
+	 * This NOP instruction is used by qemu to detect the idle loop.
+	 */
+	__asm volatile("or	%%r10,%%r10,%%r10" ::: "memory");
 }

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.10 src/sys/arch/hppa/hppa/machdep.c:1.10.4.1
--- src/sys/arch/hppa/hppa/machdep.c:1.10	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/hppa/hppa/machdep.c	Sat May 14 11:38:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.10 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.10.4.1 2022/05/14 11:38:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 2019/04/06 03:06:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10.4.1 2022/05/14 11:38:31 martin Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1459,8 +1459,13 @@ cpu_reboot(int howto, char *user_boot_st
 		:: "r" (CMD_RESET), "r" (HPPA_LBCAST + iomod_command));
 	}
 
-	for (;;)
-		/* loop while bus reset is coming up */ ;
+	for (;;) {
+		/*
+		 * loop while bus reset is coming up.  This NOP instruction
+		 * is used by qemu to detect the 'death loop'.
+		 */
+		__asm volatile("or %%r31, %%r31, %%r31" ::: "memory");
+	}
 	/* NOTREACHED */
 }
 



CVS commit: [netbsd-9] src/sys/arch/hppa/hppa

2022-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 14 11:38:32 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa [netbsd-9]: idle_machdep.c machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1448):

sys/arch/hppa/hppa/idle_machdep.c: revision 1.4
sys/arch/hppa/hppa/machdep.c: revision 1.17

Add some special NOPs to help qemu.
thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/arch/hppa/hppa/machdep.c

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2022-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 15 12:29:47 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: GENERIC INSTALL

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1450):

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/arch/luna68k/conf/INSTALL

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2022-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 15 12:29:47 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: GENERIC INSTALL

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1450):

sys/arch/luna68k/conf/INSTALL: revision 1.32
sys/arch/luna68k/conf/GENERIC: revision 1.131

Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/arch/luna68k/conf/INSTALL

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/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.127 src/sys/arch/luna68k/conf/GENERIC:1.127.2.1
--- src/sys/arch/luna68k/conf/GENERIC:1.127	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/luna68k/conf/GENERIC	Sun May 15 12:29:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.127 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: GENERIC,v 1.127.2.1 2022/05/15 12:29:46 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.127 $"
+#ident 		"GENERIC-$Revision: 1.127.2.1 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -128,6 +128,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
 options 	WSDISPLAY_COMPAT_RAWKBD
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.27 src/sys/arch/luna68k/conf/INSTALL:1.27.2.1
--- src/sys/arch/luna68k/conf/INSTALL:1.27	Fri Apr 26 22:46:03 2019
+++ src/sys/arch/luna68k/conf/INSTALL	Sun May 15 12:29:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.27 2019/04/26 22:46:03 sevan Exp $
+# $NetBSD: INSTALL,v 1.27.2.1 2022/05/15 12:29:46 martin Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -108,6 +108,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_DEFAULTSCREENS=1
 #options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?



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

2023-12-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  9 12:57:16 UTC 2023

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: lock_stubs_llsc.S

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1773):

sys/arch/mips/mips/lock_stubs_llsc.S: revision 1.18

Add missing PTR_WORD command in front of 0.
Likely accidentally missed in the commit, since rev 1.9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/mips/mips/lock_stubs_llsc.S

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



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

2023-12-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec  9 12:57:16 UTC 2023

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: lock_stubs_llsc.S

Log Message:
Pull up following revision(s) (requested by andvar in ticket #1773):

sys/arch/mips/mips/lock_stubs_llsc.S: revision 1.18

Add missing PTR_WORD command in front of 0.
Likely accidentally missed in the commit, since rev 1.9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/mips/mips/lock_stubs_llsc.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/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9.4.1
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.9	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sat Dec  9 12:57:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.9 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.9.4.1 2023/12/09 12:57:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.9 2019/04/06 03:06:26 thorpej Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.9.4.1 2023/12/09 12:57:16 martin Exp $")
 
 #include "assym.h"
 
@@ -364,7 +364,7 @@ EXPORT(mips_llsc_locore_atomicvec)
 #ifdef _LP64
 	PTR_WORD	llsc_ucas_64
 #else
-			0
+	PTR_WORD	0
 #endif /* _LP64 */
 #ifdef LOCKDEBUG
 	PTR_WORD	mutex_vector_enter



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

2024-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 19 09:02:17 UTC 2024

Modified Files:
src/sys/arch/vax/vsa [netbsd-9]: ncr.c vsbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1800):

sys/arch/vax/vsa/vsbus.c: revision 1.69 (patch)
sys/arch/vax/vsa/ncr.c: revision 1.52

Fix SCSI tranfer corruption on VAXstation 3100/m30 (KA420) on netboot.

See my post on port-vax@ for details:
 https://mail-index.netbsd.org/port-vax/2024/02/16/msg004866.html
and "go ahead!" from ragge@.


To generate a diff of this commit:
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/vax/vsa/vsbus.c

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



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

2024-02-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 19 09:02:17 UTC 2024

Modified Files:
src/sys/arch/vax/vsa [netbsd-9]: ncr.c vsbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1800):

sys/arch/vax/vsa/vsbus.c: revision 1.69 (patch)
sys/arch/vax/vsa/ncr.c: revision 1.52

Fix SCSI tranfer corruption on VAXstation 3100/m30 (KA420) on netboot.

See my post on port-vax@ for details:
 https://mail-index.netbsd.org/port-vax/2024/02/16/msg004866.html
and "go ahead!" from ragge@.


To generate a diff of this commit:
cvs rdiff -u -r1.49.4.1 -r1.49.4.2 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.65 -r1.65.4.1 src/sys/arch/vax/vsa/vsbus.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/vsa/ncr.c
diff -u src/sys/arch/vax/vsa/ncr.c:1.49.4.1 src/sys/arch/vax/vsa/ncr.c:1.49.4.2
--- src/sys/arch/vax/vsa/ncr.c:1.49.4.1	Mon Mar 23 10:06:26 2020
+++ src/sys/arch/vax/vsa/ncr.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $	*/
+/*	$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $");
 
 #include 
 #include 
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49
 #include 
 #include 
 #include 
+#include 
 
 #include "ioconf.h"
 
@@ -209,6 +210,16 @@ si_vsbus_attach(device_t parent, device_
 	else
 		target = (clk_page[0xbc/2] >> tweak) & 7;
 
+	/*
+	 * Explicitly enable upto 128KB "Big DMA" on KA420.
+	 * (It looks KA420 firmware doesn't enable it on network boot)
+	 */
+#define STC_MODE_OFF	(KA420_STC_MODE - KA420_SCS_BASE)
+	if (vax_boardtype == VAX_BTYP_420) {
+		bus_space_write_1(ncr_sc->sc_regt, ncr_sc->sc_regh,
+		STC_MODE_OFF, 1);
+	}
+
 	aprint_normal("\n");
 	aprint_normal_dev(self, "NCR5380, SCSI ID %d\n", target);
 

Index: src/sys/arch/vax/vsa/vsbus.c
diff -u src/sys/arch/vax/vsa/vsbus.c:1.65 src/sys/arch/vax/vsa/vsbus.c:1.65.4.1
--- src/sys/arch/vax/vsa/vsbus.c:1.65	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/vax/vsa/vsbus.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $ */
+/*	$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $ */
 /*
  * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -146,7 +146,6 @@ vsbus_attach(device_t parent, device_t s
 		} else {
 			dbase = KA420_DMA_BASE;
 			dsize = KA420_DMA_SIZE;
-			*(char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
 		}
 		sc->sc_dmasize = dsize;
 		sc->sc_dmaaddr = uvm_km_alloc(kernel_map, dsize, 0,



CVS commit: [netbsd-9] src/sys/arch/luna68k/luna68k

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:43:23 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/luna68k

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:43:23 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c

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

Modified files:

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.15 src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.15	Thu Mar  9 14:05:59 2017
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Wed Apr 19 16:43:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.15 2017/03/09 14:05:59 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15 2017/03/09 14:05:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ static const struct mainbus_attach_args 
 	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
 	{ "le",	0xf100, 3 },	/* Am7990 */
 	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xp", 0x7100, 1 },	/* HD647180XP */
+	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
 	{ "fb",	0xc110, -1 },	/* BrookTree RAMDAC */
 	{ "spc",0xe100, 2 },	/* internal MB89352 */
 	{ "spc",0xe140, 2 },	/* external MB89352 */



CVS commit: [netbsd-9] src/sys/arch/luna68k/luna68k

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:45:37 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Backout accidental commit (branch/ticket mismatch)


To generate a diff of this commit:
cvs rdiff -u -r1.15.18.1 -r1.15.18.2 src/sys/arch/luna68k/luna68k/mainbus.c

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/luna68k

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:45:37 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Backout accidental commit (branch/ticket mismatch)


To generate a diff of this commit:
cvs rdiff -u -r1.15.18.1 -r1.15.18.2 src/sys/arch/luna68k/luna68k/mainbus.c

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

Modified files:

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.2
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1	Wed Apr 19 16:43:23 2023
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Wed Apr 19 16:45:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $ */
+/* $NetBSD: mainbus.c,v 1.15.18.2 2023/04/19 16:45:37 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.2 2023/04/19 16:45:37 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ static const struct mainbus_attach_args 
 	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
 	{ "le",	0xf100, 3 },	/* Am7990 */
 	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
+	{ "xp", 0x7100, 1 },	/* HD647180XP */
 	{ "fb",	0xc110, -1 },	/* BrookTree RAMDAC */
 	{ "spc",0xe100, 2 },	/* internal MB89352 */
 	{ "spc",0xe140, 2 },	/* external MB89352 */



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 13:47:03 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: Makefile.luna68k

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/luna68k/conf/Makefile.luna68k

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



CVS commit: [netbsd-9] src/sys/arch/luna68k/conf

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 13:47:03 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: Makefile.luna68k

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1627):

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/luna68k/conf/Makefile.luna68k

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/luna68k/conf/Makefile.luna68k
diff -u src/sys/arch/luna68k/conf/Makefile.luna68k:1.29 src/sys/arch/luna68k/conf/Makefile.luna68k:1.29.4.1
--- src/sys/arch/luna68k/conf/Makefile.luna68k:1.29	Sat Sep 22 12:24:02 2018
+++ src/sys/arch/luna68k/conf/Makefile.luna68k	Thu Apr 20 13:47:02 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.luna68k,v 1.29 2018/09/22 12:24:02 rin Exp $
+#	$NetBSD: Makefile.luna68k,v 1.29.4.1 2023/04/20 13:47:02 martin Exp $
 
 # Makefile for NetBSD
 #
@@ -48,7 +48,7 @@ OPT_MODULAR=	%MODULAR%
 MD_OBJS=	locore.o
 MD_LIBS=	${FPSP}
 MD_CFILES=
-MD_SFILES=	
+MD_SFILES=	${LUNA68K}/luna68k/locore.s
 
 locore.o: ${LUNA68K}/luna68k/locore.s assym.h
 	${NORMAL_S}



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

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

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

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 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.178.4.1 src/sys/arch/xen/conf/files.xen:1.178.4.2
--- src/sys/arch/xen/conf/files.xen:1.178.4.1	Wed Jul 15 17:25:08 2020
+++ src/sys/arch/xen/conf/files.xen	Mon May 15 10:25:31 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.178.4.1 2020/07/15 17:25:08 martin Exp $
+#	$NetBSD: files.xen,v 1.178.4.2 2023/05/15 10:25:31 martin 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 
 
@@ -12,6 +12,9 @@ maxusers 2 16 128
 
 defparam opt_kernbase.h	KERNBASE
 
+# This options is of no use to Xen, but building requires its definition
+defflag opt_selfreloc.h SELFRELOC
+
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
 



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

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

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

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 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.



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 18:56:58 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-9]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1644):

sys/arch/x86/pci/amdsmn.c: revision 1.16
sys/arch/x86/pci/amdzentemp.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.18

Reduce diff against DragonFly. No functional change.
amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh).


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.3 -r1.9.2.4 src/sys/arch/x86/pci/amdzentemp.c

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



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 18:56:58 UTC 2023

Modified Files:
src/sys/arch/x86/pci [netbsd-9]: amdsmn.c amdzentemp.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1644):

sys/arch/x86/pci/amdsmn.c: revision 1.16
sys/arch/x86/pci/amdzentemp.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.18

Reduce diff against DragonFly. No functional change.
amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh).


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.3 -r1.9.2.4 src/sys/arch/x86/pci/amdzentemp.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/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5.2.3 src/sys/arch/x86/pci/amdsmn.c:1.5.2.4
--- src/sys/arch/x86/pci/amdsmn.c:1.5.2.3	Tue Oct 11 18:16:20 2022
+++ src/sys/arch/x86/pci/amdsmn.c	Wed Jun 21 18:56:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -93,7 +93,17 @@ static const struct pciid {
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
 	{
-		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC,
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, /* or F19_0X */
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_AX_RC, /* or F19_4X */
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F19_1X_RC,
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9.2.3 src/sys/arch/x86/pci/amdzentemp.c:1.9.2.4
--- src/sys/arch/x86/pci/amdzentemp.c:1.9.2.3	Mon Jan 23 12:27:33 2023
+++ src/sys/arch/x86/pci/amdzentemp.c	Wed Jun 21 18:56:58 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ ");
 
 #include 
 #include 
@@ -74,7 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
 #include "amdsmn.h"
 
 #define	AMD_CURTMP_RANGE_ADJUST	4900	/* in microKelvins (ie, 49C) */
-#define	AMD_CURTMP_RANGE_CHECK	__BIT(19)
 #define	F10_TEMP_CURTMP		__BITS(31,21)	/* XXX same as amdtemp.c */
 #define	F10_TEMP_CURTMP_MASK	0x7ff
 #define	F15M60_CURTMP_TJSEL	__BITS(17,16)
@@ -96,14 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
  * to -49..206C.
  */
 #define	AMD_17H_CUR_TMP			0x59800
-
-/*
- * The following register set was discovered experimentally by Ondrej Čerman
- * and collaborators, but is not (yet) documented in a PPR/OSRR (other than
- * the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to
- * SMU::THM).  It seems plausible and the Linux sensor folks have adopted it.
- */
-#define	AMD_17H_CCD_TMP_BASE		0x59954
+#define	AMD_17H_CUR_TMP_RANGE_SEL	__BIT(19)
 #define	AMD_17H_CCD_TMP_VALID		__BIT(11)
 
 struct amdzentemp_softc {
@@ -114,7 +106,7 @@ struct amdzentemp_softc {
 	size_t sc_sensor_len;
 	size_t sc_numsensors;
 	int32_t sc_offset;
-	uint32_t sc_ccd_tmp_base;
+	int32_t sc_ccd_offset;
 };
 
 enum {
@@ -129,6 +121,10 @@ enum {
 	CCD5,
 	CCD6,
 	CCD7,
+	CCD8,
+	CCD9,
+	CCD10,
+	CCD11,
 	CCD_MAX,
 	NUM_CCDS = CCD_MAX - CCD_BASE
 };
@@ -339,14 +335,16 @@ amdzentemp_family17_refresh(struct sysmo
 			edata->state = ENVSYS_SINVALID;
 			return;
 		}
-		minus49 = (temp & AMD_CURTMP_RANGE_CHECK) ? true : false;
+		minus49 = (temp & AMD_17H_CUR_TMP_RANGE_SEL) ?
+		true : false;
 		temp = __SHIFTOUT(temp, F10_TEMP_CURTMP);
 		break;
 	case CCD_BASE ... (CCD_MAX - 1):
 		/* Tccd */
 		i = edata->private - CCD_BASE;
 		error = amdsmn_read(sc->sc_smn,
-		sc->sc_ccd_tmp_base + (i * sizeof(temp)), &temp);
+		AMD_17H_CUR_TMP + sc->sc_ccd_offset + (i * sizeof(temp)),
+		&temp);
 		if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) {
 			edata->state = ENVSYS_SINVALID;
 			return;
@@ -372,6 +370,8 @@ amdzentemp_probe_ccd_sensors17h(struct a
 {
 	int maxreg;
 
+	sc->sc_ccd_offset = 0x154;
+
 	switch (model) {
 	case 0x00 ... 0x2f: /* Zen1, Zen+ */
 		maxreg = 4;
@@ -39

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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:52:39 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1649):

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.7 -r1.33.2.8 src/sys/arch/x86/x86/procfs_machdep.c

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



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:52:39 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1649):

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.7 -r1.33.2.8 src/sys/arch/x86/x86/procfs_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/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.7 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.8
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.7	Mon Jan 23 12:23:53 2023
+++ src/sys/arch/x86/x86/procfs_machdep.c	Wed Jun 21 19:52:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.8 2023/06/21 19:52:39 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.8 2023/06/21 19:52:39 martin Exp $");
 
 #include 
 #include 
@@ -151,7 +151,7 @@ static const char * const x86_features[]
 	"avx_vnni", "avx512_bf16", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, NULL, "lam", NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
@@ -172,7 +172,7 @@ static const char * const x86_features[]
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
 	"vgif", NULL, "x2avic", NULL, "v_spec_ctrl", NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "vnmi", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
 	NULL, "avx512vbmi", "umip", "pku",



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 11:34:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: fpu.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1665):

sys/arch/x86/x86/fpu.c: revision 1.86

x86/fpu: Align savefpu to 64 bytes in fpuinit_mxcsr_mask.
16 bytes is not enough.

(Is this why it never worked on Xen some years back?  Got lucky and
accidentally had 64-byte alignment on native x86, but not in the call
stack in Xen?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/arch/x86/x86/fpu.c

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



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 11:34:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: fpu.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1665):

sys/arch/x86/x86/fpu.c: revision 1.86

x86/fpu: Align savefpu to 64 bytes in fpuinit_mxcsr_mask.
16 bytes is not enough.

(Is this why it never worked on Xen some years back?  Got lucky and
accidentally had 64-byte alignment on native x86, but not in the call
stack in Xen?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/arch/x86/x86/fpu.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/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.55.2.1 src/sys/arch/x86/x86/fpu.c:1.55.2.2
--- src/sys/arch/x86/x86/fpu.c:1.55.2.1	Sun Oct 18 18:42:10 2020
+++ src/sys/arch/x86/x86/fpu.c	Tue Jul 25 11:34:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.55.2.1 2020/10/18 18:42:10 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.55.2.2 2023/07/25 11:34:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.55.2.1 2020/10/18 18:42:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.55.2.2 2023/07/25 11:34:37 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -153,7 +153,7 @@ void
 fpuinit_mxcsr_mask(void)
 {
 #ifndef XENPV
-	union savefpu fpusave __aligned(16);
+	union savefpu fpusave __aligned(64);
 	u_long psl;
 
 	memset(&fpusave, 0, sizeof(fpusave));



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:40:50 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: errata.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1667):

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


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

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



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:40:50 UTC 2023

Modified Files:
src/sys/arch/x86/x86 [netbsd-9]: errata.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1667):

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/x86/x86/errata.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/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.26.2.1 src/sys/arch/x86/x86/errata.c:1.26.2.2
--- src/sys/arch/x86/x86/errata.c:1.26.2.1	Tue Jul 25 09:12:36 2023
+++ src/sys/arch/x86/x86/errata.c	Thu Jul 27 16:40:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $	*/
+/*	$NetBSD: errata.c,v 1.26.2.2 2023/07/27 16:40:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26.2.2 2023/07/27 16:40:50 martin Exp $");
 
 #include 
 #include 
@@ -96,8 +96,8 @@ static const u_int cpurevs[] = {
 	ML_A1, 0x0730F01, ZP_B1, 0x0800F11, ZP_B2, 0x0800F12,
 	PiR_B2, 0x0800F82, Rome_B0, 0x0830F10,
 	/* XXX client Zen2 names aren't known yet. */
-	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F80, Z2_Luc, 0x0870F10,
-	Z2_Mat, 0x0890F70, Z2_VG, 0x0890F80, Z2_Men, 0x08A0F10,
+	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F01, Z2_Luc, 0x0860F81,
+	Z2_Mat, 0x0870F10, Z2_VG, 0x0890F02, Z2_Men, 0x08A0F00,
 	Milan_B1, 0x0A00F11, Milan_B2, 0x0A00F12,
 	Genoa_B1, 0x0A10F11,
 	OINK



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:55:41 UTC 2023

Modified Files:
src/sys/arch/xen/xen [netbsd-9]: clock.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1668):

sys/arch/xen/xen/xen_clock.c: revision 1.10
sys/arch/xen/xen/xen_clock.c: revision 1.12
(applied to sys/arch/xen/xen/clock.c)

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.

Pointed out by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/xen/xen/clock.c

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



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:55:41 UTC 2023

Modified Files:
src/sys/arch/xen/xen [netbsd-9]: clock.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1668):

sys/arch/xen/xen/xen_clock.c: revision 1.10
sys/arch/xen/xen/xen_clock.c: revision 1.12
(applied to sys/arch/xen/xen/clock.c)

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.

Pointed out by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/xen/xen/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/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.78 src/sys/arch/xen/xen/clock.c:1.78.4.1
--- src/sys/arch/xen/xen/clock.c:1.78	Sat Mar  9 09:51:29 2019
+++ src/sys/arch/xen/xen/clock.c	Thu Jul 27 16:55:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $	*/
+/*	$NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $");
 
 #include 
 #include 
@@ -769,7 +769,6 @@ xen_resumeclocks(struct cpu_info *ci)
 	if (ci->ci_xen_timer_intrhand == NULL)
 		panic("failed to establish timer interrupt handler");
 
-	hypervisor_unmask_event(evtch);
 
 	aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch);
 
@@ -783,10 +782,12 @@ xen_resumeclocks(struct cpu_info *ci)
 	/* Pretend the last hardclock happened right now.  */
 	ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns();
 
+
 	/* Arm the one-shot timer.  */
 	error = HYPERVISOR_set_timer_op(ci->ci_xen_hardclock_systime_ns +
 	NS_PER_TICK);
 	KASSERT(error == 0);
+	hypervisor_unmask_event(evtch);
 
 	/* We'd better not have switched CPUs.  */
 	KASSERT(ci == curcpu());



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 09:48:51 UTC 2023

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

Log Message:
Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1669:

sys/arch/x86/include/specialreg.h   1.204-1.206, 1.208

- Add Intel CPUID 0x07 %ecx bit 24 BUS_LOCK_DETECT.
- Add AMD CPUID 0x8008 %ebx bit 30 IBPB_RET and CPUID 0x800a
  %edx bit 29 BusLockThreshold.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.14 -r1.150.2.15 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.



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 09:48:51 UTC 2023

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

Log Message:
Pull up the following revisions, all via patch, requested by msaitoh
in ticket #1669:

sys/arch/x86/include/specialreg.h   1.204-1.206, 1.208

- Add Intel CPUID 0x07 %ecx bit 24 BUS_LOCK_DETECT.
- Add AMD CPUID 0x8008 %ebx bit 30 IBPB_RET and CPUID 0x800a
  %edx bit 29 BusLockThreshold.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.14 -r1.150.2.15 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.150.2.14 src/sys/arch/x86/include/specialreg.h:1.150.2.15
--- src/sys/arch/x86/include/specialreg.h:1.150.2.14	Tue Jul 25 09:12:35 2023
+++ src/sys/arch/x86/include/specialreg.h	Sat Jul 29 09:48:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.14 2023/07/25 09:12:35 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.15 2023/07/29 09:48:51 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -466,6 +466,7 @@
 #define CPUID_SEF_MAWAU		__BITS(21, 17) /* MAWAU for BND{LD,ST}X */
 #define CPUID_SEF_RDPID		__BIT(22) /* RDPID and IA32_TSC_AUX */
 #define CPUID_SEF_KL		__BIT(23) /* Key Locker */
+#define CPUID_SEF_BUS_LOCK_DETECT __BIT(24) /* OS bus-lock detection */
 #define CPUID_SEF_CLDEMOTE	__BIT(25) /* Cache line demote */
 #define CPUID_SEF_MOVDIRI	__BIT(27) /* MOVDIRI instruction */
 #define CPUID_SEF_MOVDIR64B	__BIT(28) /* MOVDIR64B instruction */
@@ -480,7 +481,7 @@
 	"b\14AVX512_BITALG\0" "b\15TME_EN\0" "b\16AVX512_VPOPCNTDQ\0"	  \
 	"b\20LA57\0"			  \
 	"f\21\5MAWAU\0"			"b\26RDPID\0"	"b\27KL\0"	  \
-			"b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	  \
+	"b\30BUS_LOCK_DETECT" "b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	  \
 	"b\34MOVDIR64B\0" "b\35ENQCMD\0" "b\36SGXLC\0"	"b\37PKS\0"
 
 /* %ecx = 0, %edx */
@@ -889,6 +890,7 @@
 #define CPUID_CAPEX_CPPC	   __BIT(27) /* Collaborative Processor Perf. Control */
 #define CPUID_CAPEX_PSFD	   __BIT(28) /* Predictive Store Forward Dis */
 #define CPUID_CAPEX_BTC_NO	   __BIT(29) /* Branch Type Confusion NO */
+#define CPUID_CAPEX_IBPB_RET	   __BIT(30) /* Clear RET address predictor */
 
 #define CPUID_CAPEX_FLAGS	"\20"	   \
 	"\1CLZERO"	"\2IRPERF"	"\3XSAVEERPTR"	"\4INVLPGB"	   \
@@ -899,7 +901,7 @@
 			"\24IBRS_SAMEMODE" \
 	"\25EFER_LSMSLE_UN""\30PPIN"	   \
 	"\31SSBD"	"\32VIRT_SSBD"	"\33SSB_NO"	"\34CPPC"	   \
-	"\35PSFD"	"\36BTC_NO"
+	"\35PSFD"	"\36BTC_NO"	"\37IBPB_RET"
 
 /* %ecx */
 #define CPUID_CAPEX_PerfTscSize	__BITS(17,16)	/* Perf. tstamp counter size */
@@ -939,6 +941,7 @@
 #define CPUID_AMD_SVM_IBSVIRT	  __BIT(26) /* IBS Virtualization */
 #define CPUID_AMD_SVM_XLVTOFFFLTCHG   __BIT(27) /* Ext LVToffset FLT changed */
 #define CPUID_AMD_SVM_VMCBADRCHKCHG   __BIT(28) /* VMCB addr check changed */
+#define CPUID_AMD_SVM_BUSLOCKTHRESH   __BIT(29) /* Bus Lock Threshold */
 
 
 #define CPUID_AMD_SVM_FLAGS	 "\20"	\
@@ -951,7 +954,7 @@
 	"\21" "VGIF"	"\22" "GMET"	"\23x2AVIC"	"\24SSSCHECK"	\
 	"\25" "SPEC_CTRL" "\26" "ROGPT"		"\30HOST_MCE_OVERRIDE"	\
 	"\31" "TLBICTL"	"\32VNMI" "\33IBSVIRT" "\34ExtLvtOffsetFaultChg" \
-	"\35VmcbAddrChkChg"
+	"\35VmcbAddrChkChg" "\36BusLockThreshold"
 
 /*
  * AMD Instruction-Based Sampling Capabilities.
@@ -1065,7 +1068,7 @@
 #define CPUID_AMDEXT2_FSRC	  __BIT(11) /* Fast Short Rep Cmpsb */
 #define CPUID_AMDEXT2_PREFETCHCTL __BIT(13) /* Prefetch control MSR */
 #define CPUID_AMDEXT2_CPUIDUSRDIS __BIT(17) /* CPUID dis. for non-priv. soft */
-#define CPUID_AMDEXT2_EPSF	  __BIT(18) /* Enhanced Predective Store Fwd */
+#define CPUID_AMDEXT2_EPSF	  __BIT(18) /* Enhanced Predictive Store Fwd */
 
 #define CPUID_AMDEXT2_FLAGS	 "\20"	  \
 	"\1NoNestedDataBp" "\2FsGsKernelGsBaseNonSerializing"		  \



  1   2   3   4   >