CVS commit: [netbsd-10] src/sys/arch/evbppc

2024-10-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 14 16:44:43 UTC 2024

Modified Files:
src/sys/arch/evbppc/include [netbsd-10]: wii.h
src/sys/arch/evbppc/wii [netbsd-10]: autoconf.c machdep.c wii_locore.S
wii_mmuinit.S
src/sys/arch/evbppc/wii/dev [netbsd-10]: avenc.c ehci_hollywood.c
vireg.h wiifb.c

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

sys/arch/evbppc/wii/dev/wiifb.c: revision 1.7
sys/arch/evbppc/wii/wii_mmuinit.S: revision 1.2
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.4
sys/arch/evbppc/wii/machdep.c: revision 1.7
sys/arch/evbppc/wii/wii_locore.S: revision 1.3
sys/arch/evbppc/wii/dev/avenc.c: revision 1.2
sys/arch/evbppc/include/wii.h: revision 1.9
sys/arch/evbppc/wii/dev/vireg.h: revision 1.3
sys/arch/evbppc/wii/autoconf.c: revision 1.3

wii: Support loading the kernel from boot2

Improve hardware initialization steps so the NetBSD kernel can be launched
directly from boot2 and does not rely on any other PPC software to setup
the hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.3 -r1.7.2.4 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/evbppc/wii/autoconf.c \
src/sys/arch/evbppc/wii/wii_locore.S
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/arch/evbppc/wii/machdep.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbppc/wii/wii_mmuinit.S
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbppc/wii/dev/avenc.c
cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/sys/arch/evbppc/wii/dev/ehci_hollywood.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/evbppc/wii/dev/vireg.h
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/evbppc/wii/dev/wiifb.c

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



CVS commit: [netbsd-10] src/sys/arch/evbppc

2024-10-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 14 16:44:43 UTC 2024

Modified Files:
src/sys/arch/evbppc/include [netbsd-10]: wii.h
src/sys/arch/evbppc/wii [netbsd-10]: autoconf.c machdep.c wii_locore.S
wii_mmuinit.S
src/sys/arch/evbppc/wii/dev [netbsd-10]: avenc.c ehci_hollywood.c
vireg.h wiifb.c

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

sys/arch/evbppc/wii/dev/wiifb.c: revision 1.7
sys/arch/evbppc/wii/wii_mmuinit.S: revision 1.2
sys/arch/evbppc/wii/dev/ehci_hollywood.c: revision 1.4
sys/arch/evbppc/wii/machdep.c: revision 1.7
sys/arch/evbppc/wii/wii_locore.S: revision 1.3
sys/arch/evbppc/wii/dev/avenc.c: revision 1.2
sys/arch/evbppc/include/wii.h: revision 1.9
sys/arch/evbppc/wii/dev/vireg.h: revision 1.3
sys/arch/evbppc/wii/autoconf.c: revision 1.3

wii: Support loading the kernel from boot2

Improve hardware initialization steps so the NetBSD kernel can be launched
directly from boot2 and does not rely on any other PPC software to setup
the hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.3 -r1.7.2.4 src/sys/arch/evbppc/include/wii.h
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/evbppc/wii/autoconf.c \
src/sys/arch/evbppc/wii/wii_locore.S
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/arch/evbppc/wii/machdep.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbppc/wii/wii_mmuinit.S
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbppc/wii/dev/avenc.c
cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/sys/arch/evbppc/wii/dev/ehci_hollywood.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/evbppc/wii/dev/vireg.h
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/evbppc/wii/dev/wiifb.c

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

Modified files:

Index: src/sys/arch/evbppc/include/wii.h
diff -u src/sys/arch/evbppc/include/wii.h:1.7.2.3 src/sys/arch/evbppc/include/wii.h:1.7.2.4
--- src/sys/arch/evbppc/include/wii.h:1.7.2.3	Wed Oct  2 12:28:15 2024
+++ src/sys/arch/evbppc/include/wii.h	Mon Oct 14 16:44:42 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: wii.h,v 1.7.2.3 2024/10/02 12:28:15 martin Exp $ */
+/* $NetBSD: wii.h,v 1.7.2.4 2024/10/14 16:44:42 martin Exp $ */
 
 /*-
  * Copyright (c) 2024 Jared McNeill 
@@ -119,6 +119,8 @@
 #define  IOPOH1EN			__BIT(22)
 #define  IOPOH0EN			__BIT(21)
 #define  IOPEHCEN			__BIT(20)
+#define HW_AIPPROT			(HOLLYWOOD_PRIV_BASE + 0x070)
+#define  ENAHBIOPI			__BIT(0)
 #define HW_GPIOB_OUT			(HOLLYWOOD_BASE + 0x0c0)
 #define HW_GPIOB_DIR			(HOLLYWOOD_BASE + 0x0c4)
 #define HW_GPIOB_IN			(HOLLYWOOD_BASE + 0x0c8)
@@ -155,4 +157,19 @@ wii_slot_led_blink(u_int interval_us)
 	}
 }
 
+/* Enable or disable the slot LED. */
+static inline void
+wii_slot_led(bool enable)
+{
+	uint32_t val;
+
+	val = in32(HW_GPIOB_OUT);
+	if (enable) {
+		val |= __BIT(GPIO_SLOT_LED);
+	} else {
+		val &= ~__BIT(GPIO_SLOT_LED);
+	}
+	out32(HW_GPIOB_OUT, val);
+}
+
 #endif /* !_WII_H */

Index: src/sys/arch/evbppc/wii/autoconf.c
diff -u src/sys/arch/evbppc/wii/autoconf.c:1.2.2.2 src/sys/arch/evbppc/wii/autoconf.c:1.2.2.3
--- src/sys/arch/evbppc/wii/autoconf.c:1.2.2.2	Sat Feb  3 11:47:07 2024
+++ src/sys/arch/evbppc/wii/autoconf.c	Mon Oct 14 16:44:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2.2.2 2024/02/03 11:47:07 martin Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.2.2.3 2024/10/14 16:44:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2.2.2 2024/02/03 11:47:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2.2.3 2024/10/14 16:44:42 martin Exp $");
 
 #include 
 #include 
@@ -77,6 +77,8 @@ cpu_configure(void)
 		panic("configure: mainbus not configured");
 
 	genppc_cpu_configure();
+
+	wii_slot_led(false);
 }
 
 void
Index: src/sys/arch/evbppc/wii/wii_locore.S
diff -u src/sys/arch/evbppc/wii/wii_locore.S:1.2.2.2 src/sys/arch/evbppc/wii/wii_locore.S:1.2.2.3
--- src/sys/arch/evbppc/wii/wii_locore.S:1.2.2.2	Sat Feb  3 11:47:07 2024
+++ src/sys/arch/evbppc/wii/wii_locore.S	Mon Oct 14 16:44:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: wii_locore.S,v 1.2.2.2 2024/02/03 11:47:07 martin Exp $	*/
+/*	$NetBSD: wii_locore.S,v 1.2.2.3 2024/10/14 16:44:42 martin Exp $	*/
 /*	$OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $	*/
 
 /*
@@ -97,27 +97,35 @@ __mmu_init:
 #include "wii_mmuinit.S"
 
 	/* compute end of kernel memory */
-	lis	4,_C_LABEL(end)@ha
-	addi	4,4,_C_LABEL(end)@l
-	rlwinm	4,4,0,1,31
-
-	INIT_CPUINFO(4,1,9,5)
-
-	lis	3,__start@ha
-	addi	3,3,__start@l
-	rlwinm	3,3,0,1,31
-
-	xor	5,5,5
-	xor	6,6,6
-	bl	_C_LABEL(cpu_model_init)
+	lis	%r4, _C_LABEL(end)@ha
+	addi	%r4, %r4, _C_LABEL(end)@l
+
+#if NKSYMS || defined(DDB) || defined(MODULAR)
+	/* If we had symbol table location we'd store it here and would've adjusted r4 here */
+	lis	%r7, _C_

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

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 14:38:13 UTC 2024

Modified Files:
src/sys/arch/xen/xen [netbsd-10]: xen_clock.c

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

sys/arch/xen/xen/xen_clock.c: revision 1.19

xen_rtc_set: Zero-initialize op before passing to hypervisor.

PR port-xen/58362


To generate a diff of this commit:
cvs rdiff -u -r1.8.18.1 -r1.8.18.2 src/sys/arch/xen/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/xen_clock.c
diff -u src/sys/arch/xen/xen/xen_clock.c:1.8.18.1 src/sys/arch/xen/xen/xen_clock.c:1.8.18.2
--- src/sys/arch/xen/xen/xen_clock.c:1.8.18.1	Wed Jul 19 14:31:40 2023
+++ src/sys/arch/xen/xen/xen_clock.c	Sun Oct 13 14:38:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_clock.c,v 1.8.18.1 2023/07/19 14:31:40 martin Exp $	*/
+/*	$NetBSD: xen_clock.c,v 1.8.18.2 2024/10/13 14:38:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.8.18.1 2023/07/19 14:31:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.8.18.2 2024/10/13 14:38:13 martin Exp $");
 
 #include 
 #include 
@@ -946,6 +946,7 @@ xen_rtc_set(struct todr_chip_handle *tod
 		systime_ns = xen_global_systime_ns();
 
 		/* Set the hypervisor wall clock time.  */
+		memset(&op, 0, sizeof(op));
 		op.cmd = XENPF_settime;
 		op.u.settime.secs = tvp->tv_sec;
 		op.u.settime.nsecs = tvp->tv_usec * 1000;



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

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 14:38:13 UTC 2024

Modified Files:
src/sys/arch/xen/xen [netbsd-10]: xen_clock.c

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

sys/arch/xen/xen/xen_clock.c: revision 1.19

xen_rtc_set: Zero-initialize op before passing to hypervisor.

PR port-xen/58362


To generate a diff of this commit:
cvs rdiff -u -r1.8.18.1 -r1.8.18.2 src/sys/arch/xen/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-10] src/sys/arch/aarch64

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 10:43:11 UTC 2024

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

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

sys/arch/aarch64/aarch64/cpu.c: revision 1.78
sys/arch/aarch64/include/cpu.h: revision 1.51

aarch64: Count RNDRRS failure events and add dtrace probe.

PR port-arm/58572: aarch64 RNDRRS failures should be evcounted and
dtraced


To generate a diff of this commit:
cvs rdiff -u -r1.70.4.3 -r1.70.4.4 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/aarch64/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.70.4.3 src/sys/arch/aarch64/aarch64/cpu.c:1.70.4.4
--- src/sys/arch/aarch64/aarch64/cpu.c:1.70.4.3	Thu Oct  3 16:11:36 2024
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sun Oct 13 10:43:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.70.4.3 2024/10/03 16:11:36 martin Exp $ */
+/* $NetBSD: cpu.c,v 1.70.4.4 2024/10/13 10:43:11 martin Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.70.4.3 2024/10/03 16:11:36 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.70.4.4 2024/10/13 10:43:11 martin Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -42,6 +42,7 @@ __KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.70
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -166,6 +167,8 @@ cpu_attach(device_t dv, cpuid_t id)
 	aarch64_printcacheinfo(dv, ci);
 	cpu_identify2(dv, ci);
 
+	cpu_setup_rng(dv, ci);
+
 	if (unit != 0) {
 	return;
 	}
@@ -177,7 +180,6 @@ cpu_attach(device_t dv, cpuid_t id)
 	cpu_init_counter(ci);
 
 	/* These currently only check the BP. */
-	cpu_setup_rng(dv, ci);
 	cpu_setup_aes(dv, ci);
 	cpu_setup_chacha(dv, ci);
 }
@@ -584,8 +586,9 @@ rndrrs_get(size_t nbytes, void *cookie)
 	const unsigned bpb = 4;
 	size_t nbits = nbytes*NBBY;
 	uint64_t x;
-	int error;
+	int error, bound;
 
+	bound = curlwp_bind();	/* bind to CPU for rndrrs_fail evcnt */
 	while (nbits) {
 		/*
 		 * x := random 64-bit sample
@@ -605,12 +608,16 @@ rndrrs_get(size_t nbytes, void *cookie)
 		"mrs	%0, s3_3_c2_c4_1\n"
 		"cset	%w1, eq"
 		: "=r"(x), "=r"(error));
-		if (error)
+		if (error) {
+			DTRACE_PROBE(rndrrs_fail);
+			curcpu()->ci_rndrrs_fail.ev_count++;
 			break;
+		}
 		rnd_add_data_sync(&rndrrs_source, &x, sizeof(x),
 		bpb*sizeof(x));
 		nbits -= MIN(nbits, bpb*sizeof(x));
 	}
+	curlwp_bindx(bound);
 
 	explicit_memset(&x, 0, sizeof x);
 }
@@ -631,7 +638,16 @@ cpu_setup_rng(device_t dv, struct cpu_in
 		return;
 	}
 
-	/* Attach it.  */
+	/* Attach event counter for RNDRRS failure.  */
+	evcnt_attach_dynamic(&ci->ci_rndrrs_fail, EVCNT_TYPE_MISC, NULL,
+	ci->ci_cpuname, "rndrrs fail");
+
+	/*
+	 * On the primary CPU, attach random source -- this only
+	 * happens once globally.
+	 */
+	if (!CPU_IS_PRIMARY(ci))
+		return;
 	rndsource_setcb(&rndrrs_source, rndrrs_get, NULL);
 	rnd_attach_source(&rndrrs_source, "rndrrs", RND_TYPE_RNG,
 	RND_FLAG_DEFAULT|RND_FLAG_HASCB);

Index: src/sys/arch/aarch64/include/cpu.h
diff -u src/sys/arch/aarch64/include/cpu.h:1.48 src/sys/arch/aarch64/include/cpu.h:1.48.2.1
--- src/sys/arch/aarch64/include/cpu.h:1.48	Thu Nov  3 09:04:56 2022
+++ src/sys/arch/aarch64/include/cpu.h	Sun Oct 13 10:43:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.48 2022/11/03 09:04:56 skrll Exp $ */
+/* $NetBSD: cpu.h,v 1.48.2.1 2024/10/13 10:43:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -154,6 +154,7 @@ struct cpu_info {
 	struct evcnt ci_vfp_release;
 	struct evcnt ci_uct_trap;
 	struct evcnt ci_intr_preempt;
+	struct evcnt ci_rndrrs_fail;
 
 	/* FDT or similar supplied "cpu capacity" */
 	uint32_t ci_capacity_dmips_mhz;



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

2024-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 13 10:43:11 UTC 2024

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

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

sys/arch/aarch64/aarch64/cpu.c: revision 1.78
sys/arch/aarch64/include/cpu.h: revision 1.51

aarch64: Count RNDRRS failure events and add dtrace probe.

PR port-arm/58572: aarch64 RNDRRS failures should be evcounted and
dtraced


To generate a diff of this commit:
cvs rdiff -u -r1.70.4.3 -r1.70.4.4 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/aarch64/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-10] src/sys/arch/x86/pci

2024-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct  9 13:27:52 UTC 2024

Modified Files:
src/sys/arch/x86/pci [netbsd-10]: amdzentemp.c

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

sys/arch/x86/pci/amdzentemp.c: revision 1.21

amdzentemp(4): Add support for CPU family 0x1a model 0x40...0x4f (Zen 5)


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.2 -r1.16.2.3 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/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.16.2.2 src/sys/arch/x86/pci/amdzentemp.c:1.16.2.3
--- src/sys/arch/x86/pci/amdzentemp.c:1.16.2.2	Tue Aug 22 16:07:34 2023
+++ src/sys/arch/x86/pci/amdzentemp.c	Wed Oct  9 13:27:51 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.16.2.2 2023/08/22 16:07:34 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.16.2.3 2024/10/09 13:27:51 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.16.2.2 2023/08/22 16:07:34 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.16.2.3 2024/10/09 13:27:51 martin Exp $ ");
 
 #include 
 #include 
@@ -208,6 +208,7 @@ amdzentemp_attach(device_t parent, devic
 		break;
 	case 0x17:
 	case 0x19:
+	case 0x1a:
 		sc->sc_sme->sme_refresh = amdzentemp_family17_refresh;
 		break;
 	default:
@@ -429,6 +430,25 @@ amdzentemp_probe_ccd_sensors19h(struct a
 }
 
 static int
+amdzentemp_probe_ccd_sensors1ah(struct amdzentemp_softc *sc, int model)
+{
+	int maxreg;
+
+	switch (model) {
+	case 0x40 ... 0x4f: /* Zen5 */
+		sc->sc_ccd_offset = 0x300;
+		maxreg = 8;
+		break;
+	default:
+		aprint_error_dev(sc->sc_dev,
+		"Unrecognized Family 19h Model: %02xh\n", model);
+		return 0;
+	}
+
+	return maxreg;
+}
+
+static int
 amdzentemp_probe_ccd_sensors(struct amdzentemp_softc *sc, int family, int model)
 {
 	int nccd;
@@ -440,6 +460,9 @@ amdzentemp_probe_ccd_sensors(struct amdz
 	case 0x19:
 		nccd = amdzentemp_probe_ccd_sensors19h(sc, model);
 		break;
+	case 0x1a:
+		nccd = amdzentemp_probe_ccd_sensors1ah(sc, model);
+		break;
 	default:
 		return 0;
 	}



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

2024-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct  9 13:27:52 UTC 2024

Modified Files:
src/sys/arch/x86/pci [netbsd-10]: amdzentemp.c

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

sys/arch/x86/pci/amdzentemp.c: revision 1.21

amdzentemp(4): Add support for CPU family 0x1a model 0x40...0x4f (Zen 5)


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.2 -r1.16.2.3 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-10] src/sys/arch/x86/x86

2024-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 16:23:54 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: mpacpi.c

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

sys/arch/x86/x86/mpacpi.c: revision 1.111

Remove check (x2apic->LocalApicId <= 0xff) in mpacpi_config_cpu(),
the ACPI spec mentions this for compatibility with "legacy OSes" but
doens't explicitely forbid it (AFAIK). This makes a recent Dell
poweredge R750 boot to the installer.

See
 https://mail-index.netbsd.org/port-amd64/2023/12/30/msg003666.html
and
 https://mail-index.netbsd.org/port-amd64/2024/09/28/msg003695.html

It should help for PR kern/57737


To generate a diff of this commit:
cvs rdiff -u -r1.109.4.1 -r1.109.4.2 src/sys/arch/x86/x86/mpacpi.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/mpacpi.c
diff -u src/sys/arch/x86/x86/mpacpi.c:1.109.4.1 src/sys/arch/x86/x86/mpacpi.c:1.109.4.2
--- src/sys/arch/x86/x86/mpacpi.c:1.109.4.1	Thu Mar 30 11:43:17 2023
+++ src/sys/arch/x86/x86/mpacpi.c	Thu Oct  3 16:23:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpacpi.c,v 1.109.4.1 2023/03/30 11:43:17 martin Exp $	*/
+/*	$NetBSD: mpacpi.c,v 1.109.4.2 2024/10/03 16:23:54 martin Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.109.4.1 2023/03/30 11:43:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpacpi.c,v 1.109.4.2 2024/10/03 16:23:54 martin Exp $");
 
 #include "acpica.h"
 #include "opt_acpi.h"
@@ -393,17 +393,6 @@ mpacpi_config_cpu(ACPI_SUBTABLE_HEADER *
 	case ACPI_MADT_TYPE_LOCAL_X2APIC:
 		x2apic = (ACPI_MADT_LOCAL_X2APIC *)hdrp;
 
-		/* ACPI spec: "Logical processors with APIC ID values
-		 * less than 255 must use the Processor Local APIC
-		 * structure to convey their APIC information to OSPM."
-		 * But Xen with PVH dom0 breaks this ACPI spec.
-		 */
-		if (x2apic->LocalApicId <= 0xff && vm_guest != VM_GUEST_XENPVH) {
-			printf("bogus MADT X2APIC entry (id = 0x%"PRIx32")\n",
-			x2apic->LocalApicId);
-			break;
-		}
-
 		if (x2apic->LapicFlags & ACPI_MADT_ENABLED) {
 			if (x2apic->LocalApicId != cpunum)
 caa.cpu_role = CPU_ROLE_AP;



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

2024-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 16:23:54 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: mpacpi.c

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

sys/arch/x86/x86/mpacpi.c: revision 1.111

Remove check (x2apic->LocalApicId <= 0xff) in mpacpi_config_cpu(),
the ACPI spec mentions this for compatibility with "legacy OSes" but
doens't explicitely forbid it (AFAIK). This makes a recent Dell
poweredge R750 boot to the installer.

See
 https://mail-index.netbsd.org/port-amd64/2023/12/30/msg003666.html
and
 https://mail-index.netbsd.org/port-amd64/2024/09/28/msg003695.html

It should help for PR kern/57737


To generate a diff of this commit:
cvs rdiff -u -r1.109.4.1 -r1.109.4.2 src/sys/arch/x86/x86/mpacpi.c

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



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

2024-10-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct  2 18:24:35 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: tsc.c

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

sys/arch/x86/x86/tsc.c: revision 1.59
sys/arch/x86/x86/tsc.c: revision 1.60

make TSC get a quality of -100 on AMD Family 15h and 16h
this should "fix" PR#56322 and is known as AMD errata
"778: Processor Core Time Stamp Counters May Experience Drift"

remove unintended printf() in previous.  (thx dh)


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/arch/x86/x86/tsc.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/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.57 src/sys/arch/x86/x86/tsc.c:1.57.4.1
--- src/sys/arch/x86/x86/tsc.c:1.57	Fri Oct 15 18:12:48 2021
+++ src/sys/arch/x86/x86/tsc.c	Wed Oct  2 18:24:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.57 2021/10/15 18:12:48 jmcneill Exp $	*/
+/*	$NetBSD: tsc.c,v 1.57.4.1 2024/10/02 18:24:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.57 2021/10/15 18:12:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.57.4.1 2024/10/02 18:24:35 martin Exp $");
 
 #include 
 #include 
@@ -132,6 +132,18 @@ tsc_is_invariant(void)
 		 * Manual Volume 3: General-Purpose and System Instructions.
 		 * The check is done below.
 		 */
+
+		 /*
+		  * AMD Errata 778: Processor Core Time Stamp Counters May
+		  * Experience Drift
+		  *
+		  * This affects all family 15h and family 16h processors.
+		  */
+		switch (CPUID_TO_FAMILY(ci->ci_signature)) {
+		case 0x15:
+		case 0x16:
+			return false;
+		}
 	}
 
 	/*



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

2024-10-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct  2 18:24:35 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: tsc.c

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

sys/arch/x86/x86/tsc.c: revision 1.59
sys/arch/x86/x86/tsc.c: revision 1.60

make TSC get a quality of -100 on AMD Family 15h and 16h
this should "fix" PR#56322 and is known as AMD errata
"778: Processor Core Time Stamp Counters May Experience Drift"

remove unintended printf() in previous.  (thx dh)


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/arch/x86/x86/tsc.c

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



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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:37:02 UTC 2024

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

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

sys/arch/i386/i386/vector.S: revision 1.90

PR/58653: me: Revert btsl of negative value to orl


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.4.1 src/sys/arch/i386/i386/vector.S

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



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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:37:02 UTC 2024

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

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

sys/arch/i386/i386/vector.S: revision 1.90

PR/58653: me: Revert btsl of negative value to orl


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.4.1 src/sys/arch/i386/i386/vector.S

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

Modified files:

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.89 src/sys/arch/i386/i386/vector.S:1.89.4.1
--- src/sys/arch/i386/i386/vector.S:1.89	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/i386/i386/vector.S	Sat Sep 21 12:37:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.89 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: vector.S,v 1.89.4.1 2024/09/21 12:37:02 martin Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.89 2022/09/07 00:40:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.89.4.1 2024/09/21 12:37:02 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -354,7 +354,7 @@ IDTVEC(resume_hyperv_hypercall)
 	cli
 	jmp	_C_LABEL(Xdoreti)
 2:
-	btsl	$(LIR_HV - 32),CPUVAR(IPENDING)+4
+	orl	$(1 << LIR_HV),CPUVAR(IPENDING)
 	INTRFASTEXIT
 IDTVEC_END(resume_hyperv_hypercall)
 #endif	/* NHYPERV > 0 */



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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:20:23 UTC 2024

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-10]: db_interface.c
src/sys/arch/i386/i386 [netbsd-10]: db_interface.c

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

sys/arch/amd64/amd64/db_interface.c: revision 1.42
sys/arch/i386/i386/db_interface.c: revision 1.89

when cpus are paused (spinning) in DDB, call x86_pause() in the loop,
hopefully this can reduce power usage while doing nothing.

ok chs@
XXX: apply to i386

i386: DDB: Call x86_pause() (`pause` insn) when CPUs are paused
as already done for amd64:
https://mail-index.netbsd.org/source-changes/2023/07/31/msg146423.html

`pause` insn has been introduced to Pentium 4. However, its opcode is
consisted of `nop` (0x90) followed by `rep` prefix (0xf3), and therefore
interpreted as `nop` for older processors. Intel assured this behavior [1].

Also note that we already use `pause` unconditionally for i386.

Briefly tested on QEMU.

[1] Intel, ``AP-949 Using Spin-Loops on Intel Pentium 4 Processor and
Intel Xeon Processor'', Version 2.1, Sec 2.1.1. (2001)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.88 -r1.88.2.1 src/sys/arch/i386/i386/db_interface.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.41 src/sys/arch/amd64/amd64/db_interface.c:1.41.2.1
--- src/sys/arch/amd64/amd64/db_interface.c:1.41	Wed Oct 26 23:38:06 2022
+++ src/sys/arch/amd64/amd64/db_interface.c	Sat Sep 21 12:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.41 2022/10/26 23:38:06 riastradh Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.41.2.1 2024/09/21 12:20:22 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2022/10/26 23:38:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41.2.1 2024/09/21 12:20:22 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -303,7 +303,7 @@ ddb_suspend(struct trapframe *frame)
 	atomic_or_32(&ci->ci_flags, CPUF_PAUSE);
 
 	while (ci->ci_flags & CPUF_PAUSE)
-		;
+		x86_pause();
 	ci->ci_ddb_regs = 0;
 	tlbflushg();
 }

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.88 src/sys/arch/i386/i386/db_interface.c:1.88.2.1
--- src/sys/arch/i386/i386/db_interface.c:1.88	Wed Oct 26 23:38:07 2022
+++ src/sys/arch/i386/i386/db_interface.c	Sat Sep 21 12:20:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.88 2022/10/26 23:38:07 riastradh Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.88.2.1 2024/09/21 12:20:23 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.88 2022/10/26 23:38:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.88.2.1 2024/09/21 12:20:23 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -369,7 +369,7 @@ ddb_suspend(struct trapframe *frame)
 	atomic_or_32(&ci->ci_flags, CPUF_PAUSE);
 
 	while (ci->ci_flags & CPUF_PAUSE)
-		;
+		x86_pause();
 	ci->ci_ddb_regs = 0;
 	tlbflushg();
 }



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

2024-09-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 21 12:20:23 UTC 2024

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-10]: db_interface.c
src/sys/arch/i386/i386 [netbsd-10]: db_interface.c

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

sys/arch/amd64/amd64/db_interface.c: revision 1.42
sys/arch/i386/i386/db_interface.c: revision 1.89

when cpus are paused (spinning) in DDB, call x86_pause() in the loop,
hopefully this can reduce power usage while doing nothing.

ok chs@
XXX: apply to i386

i386: DDB: Call x86_pause() (`pause` insn) when CPUs are paused
as already done for amd64:
https://mail-index.netbsd.org/source-changes/2023/07/31/msg146423.html

`pause` insn has been introduced to Pentium 4. However, its opcode is
consisted of `nop` (0x90) followed by `rep` prefix (0xf3), and therefore
interpreted as `nop` for older processors. Intel assured this behavior [1].

Also note that we already use `pause` unconditionally for i386.

Briefly tested on QEMU.

[1] Intel, ``AP-949 Using Spin-Loops on Intel Pentium 4 Processor and
Intel Xeon Processor'', Version 2.1, Sec 2.1.1. (2001)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.88 -r1.88.2.1 src/sys/arch/i386/i386/db_interface.c

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



CVS commit: [netbsd-10] src/sys/arch/evbppc/conf

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 11:33:52 UTC 2024

Modified Files:
src/sys/arch/evbppc/conf [netbsd-10]: WII

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #897):

sys/arch/evbppc/conf/WII: revision 1.5

Add DKWEDGE_AUTODISCOVER and DKWEDGE_METHOD_GPT to WII
>From Guilherme Janczak in PR 58676


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/arch/evbppc/conf/WII

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



CVS commit: [netbsd-10] src/sys/arch/evbppc/conf

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 11:33:52 UTC 2024

Modified Files:
src/sys/arch/evbppc/conf [netbsd-10]: WII

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #897):

sys/arch/evbppc/conf/WII: revision 1.5

Add DKWEDGE_AUTODISCOVER and DKWEDGE_METHOD_GPT to WII
>From Guilherme Janczak in PR 58676


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/arch/evbppc/conf/WII

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

Modified files:

Index: src/sys/arch/evbppc/conf/WII
diff -u src/sys/arch/evbppc/conf/WII:1.4.2.2 src/sys/arch/evbppc/conf/WII:1.4.2.3
--- src/sys/arch/evbppc/conf/WII:1.4.2.2	Sat Feb  3 11:47:06 2024
+++ src/sys/arch/evbppc/conf/WII	Fri Sep 20 11:33:51 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: WII,v 1.4.2.2 2024/02/03 11:47:06 martin Exp $
+#	$NetBSD: WII,v 1.4.2.3 2024/09/20 11:33:51 martin Exp $
 #
 #	Nintendo Wii
 #
@@ -46,6 +46,10 @@ makeoptions DEBUG="-g"	# compile full sy
 include 	"conf/compat_netbsd50.config"
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 11:08:25 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: fpu.c

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

sys/arch/x86/x86/fpu.c: revision 1.87

x86/fpu: In kernel mode fpu traps, print the instruction pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.79.4.3 -r1.79.4.4 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-10] src/sys/arch/x86/x86

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 11:08:25 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: fpu.c

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

sys/arch/x86/x86/fpu.c: revision 1.87

x86/fpu: In kernel mode fpu traps, print the instruction pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.79.4.3 -r1.79.4.4 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.79.4.3 src/sys/arch/x86/x86/fpu.c:1.79.4.4
--- src/sys/arch/x86/x86/fpu.c:1.79.4.3	Thu Jun 20 11:02:16 2024
+++ src/sys/arch/x86/x86/fpu.c	Fri Sep 20 11:08:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.79.4.4 2024/09/20 11:08:25 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,8 +96,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.4 2024/09/20 11:08:25 martin Exp $");
 
+#include "opt_ddb.h"
 #include "opt_multiprocessor.h"
 
 #include 
@@ -121,6 +122,10 @@ __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79
 #include 
 #include 
 
+#ifdef DDB
+#include 
+#endif
+
 #ifdef XENPV
 #define clts() HYPERVISOR_fpu_taskswitch(0)
 #define stts() HYPERVISOR_fpu_taskswitch(1)
@@ -560,7 +565,16 @@ fputrap(struct trapframe *frame)
 	ksiginfo_t ksi;
 
 	if (__predict_false(!USERMODE(frame->tf_cs))) {
-		panic("fpu trap from kernel, trapframe %p\n", frame);
+		register_t ip = X86_TF_RIP(frame);
+		char where[128];
+
+#ifdef DDB
+		db_symstr(where, sizeof(where), (db_expr_t)ip, DB_STGY_PROC);
+#else
+		snprintf(where, sizeof(where), "%p", (void *)ip);
+#endif
+		panic("fpu trap from kernel at %s, trapframe %p\n", where,
+		frame);
 	}
 
 	KASSERT(curlwp->l_md.md_flags & MDL_FPU_IN_CPU);



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:47:52 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: bus_dma.c

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

sys/arch/x86/x86/bus_dma.c: revision 1.90

x86/bus_dma.c: Sprinkle KASSERTMSG.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.4.1 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.89 src/sys/arch/x86/x86/bus_dma.c:1.89.4.1
--- src/sys/arch/x86/x86/bus_dma.c:1.89	Sat Aug 20 23:48:51 2022
+++ src/sys/arch/x86/x86/bus_dma.c	Fri Sep 20 10:47:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.89.4.1 2024/09/20 10:47:52 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.89.4.1 2024/09/20 10:47:52 martin Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -207,7 +207,8 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 	/* Always round the size. */
 	size = round_page(size);
 
-	KASSERT(boundary >= PAGE_SIZE || boundary == 0);
+	KASSERTMSG(boundary >= PAGE_SIZE || boundary == 0,
+	"boundary=0x%"PRIxBUSSIZE, boundary);
 
 	/*
 	 * Allocate pages from the VM system.
@@ -389,7 +390,9 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (buflen > map->_dm_size)
 		return EINVAL;
@@ -517,9 +520,12 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
-	KASSERT(m0->m_flags & M_PKTHDR);
+	KASSERTMSG(m0->m_flags & M_PKTHDR, "m0=%p m_flags=0x%x", m0,
+	m0->m_flags);
 	if (m0->m_pkthdr.len > map->_dm_size)
 		return (EINVAL);
 
@@ -545,9 +551,15 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 			break;
 
 		case M_EXT|M_EXT_PAGES:
-			KASSERT(m->m_ext.ext_buf <= m->m_data);
-			KASSERT(m->m_data <=
-			m->m_ext.ext_buf + m->m_ext.ext_size);
+			KASSERTMSG(m->m_ext.ext_buf <= m->m_data,
+			"m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+			" m_data=%p",
+			m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
+			KASSERTMSG((m->m_data <=
+m->m_ext.ext_buf + m->m_ext.ext_size),
+			"m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+			" m_data=%p",
+			m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
 
 			offset = (vaddr_t)m->m_data -
 			trunc_page((vaddr_t)m->m_ext.ext_buf);
@@ -655,7 +667,9 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	resid = uio->uio_resid;
 	iov = uio->uio_iov;
@@ -732,7 +746,9 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (size0 > map->_dm_size)
 		return EINVAL;
@@ -811,8 +827,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		"bad offset 0x%"PRIxBUSADDR" >= 0x%"PRIxBUSSIZE,
 		offset, map->dm_mapsize);
 		KASSERTMSG(len <= map->dm_mapsize - offset,
-		"bad length 0x%"PRIxBUSADDR" + %"PRIxBUSSIZE
-		" > %"PRIxBUSSIZE,
+		"bad length 0x%"PRIxBUSADDR" + 0x%"PRIxBUSSIZE
+		" > 0x%"PRIxBUSSIZE,
 		offset, len, map->dm_mapsize);
 	}
 



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:47:52 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: bus_dma.c

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

sys/arch/x86/x86/bus_dma.c: revision 1.90

x86/bus_dma.c: Sprinkle KASSERTMSG.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.4.1 src/sys/arch/x86/x86/bus_dma.c

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



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:17:22 UTC 2024

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-10]: amd64_trap.S

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

sys/arch/amd64/amd64/amd64_trap.S: revision 1.55

amd64_trap.S: Annotate trap vectors with their mnemonics.

Derived from Intel and AMD manuals.
Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3
(3A, 3B, 3C, & 3D: System Programming Guide, Order Number:
325384-077US, April 2022.
https://cdrdv2.intel.com/v1/dl/getContent/671447

AMD64 Technology: AMD64 Architecture Programmers' Manual, Volume 2:
System Programming, Publication No. 24953, Revision 3.40, January 2023.
https://www.amd.com/system/files/TechDocs/24593.pdf

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.4.1 src/sys/arch/amd64/amd64/amd64_trap.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.54 src/sys/arch/amd64/amd64/amd64_trap.S:1.54.4.1
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.54	Wed Sep  7 00:40:18 2022
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Fri Sep 20 10:17:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.54 2022/09/07 00:40:18 knakahara Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.54.4.1 2024/09/20 10:17:22 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -159,7 +159,7 @@
 
 	TEXT_USER_BEGIN
 
-IDTVEC(trap00)
+IDTVEC(trap00)		/* #DE - Divide-by-zero error */
 	ZTRAP(T_DIVIDE)
 IDTVEC_END(trap00)
 
@@ -178,7 +178,7 @@ IDTVEC_END(trap00)
  * not a problem, because in this particular case, the frame is known not
  * to contain secrets.
  */
-IDTVEC(trap01)
+IDTVEC(trap01)		/* #DB - Debug */
 #ifndef XENPV
 	subq	$(TF_REGSIZE+16),%rsp
 
@@ -247,7 +247,7 @@ IDTVEC_END(trap01)
  * We need to be careful about %gs too, because it is possible that we were
  * running in kernel mode with a userland %gs.
  */
-IDTVEC(trap02)
+IDTVEC(trap02)		/* NMI - Non-maskable interrupt */
 #if defined(XENPV)
 	ZTRAP(T_NMI)
 #else /* XENPV */
@@ -302,7 +302,7 @@ IDTVEC(trap02)
 #endif /* XENPV */
 IDTVEC_END(trap02)
 
-IDTVEC(trap03)
+IDTVEC(trap03)		/* #BP - Breakpoint */
 #ifndef KDTRACE_HOOKS
 	ZTRAP(T_BPTFLT)
 #else
@@ -331,19 +331,19 @@ IDTVEC(trap03)
 #endif
 IDTVEC_END(trap03)
 
-IDTVEC(trap04)
+IDTVEC(trap04)		/* #OF - Overflow */
 	ZTRAP(T_OFLOW)
 IDTVEC_END(trap04)
 
-IDTVEC(trap05)
+IDTVEC(trap05)		/* #BR - BOUND range exceeded */
 	ZTRAP(T_BOUND)
 IDTVEC_END(trap05)
 
-IDTVEC(trap06)
+IDTVEC(trap06)		/* #UD - Invalid opcode */
 	ZTRAP(T_PRIVINFLT)
 IDTVEC_END(trap06)
 
-IDTVEC(trap07)
+IDTVEC(trap07)		/* #NM - Device not available (x87) */
 	ZTRAP_NJ(T_DNA)
 	INTRENTRY
 #ifdef DIAGNOSTIC
@@ -358,7 +358,7 @@ IDTVEC_END(trap07)
  * Double faults execute on a particular stack, and we must not jump out
  * of it. So don't enable interrupts.
  */
-IDTVEC(trap08)
+IDTVEC(trap08)		/* #DF - Double fault */
 #if defined(XENPV)
 	TRAP(T_DOUBLEFLT)
 #else /* XENPV */
@@ -399,11 +399,11 @@ IDTVEC(trap08)
 #endif /* XENPV */
 IDTVEC_END(trap08)
 
-IDTVEC(trap09)
+IDTVEC(trap09)		/* Coprocessor segment overrun (legacy x87) */
 	ZTRAP(T_FPOPFLT)
 IDTVEC_END(trap09)
 
-IDTVEC(trap10)
+IDTVEC(trap10)		/* #TS - Invalid TSS */
 	TRAP(T_TSSFLT)
 IDTVEC_END(trap10)
 
@@ -416,26 +416,26 @@ IDTVEC_END(trap10)
 #define kernuser_reenter alltraps
 #endif /* XENPV */
 
-IDTVEC(trap11)		/* #NP() Segment not present */
+IDTVEC(trap11)		/* #NP - Segment not present */
 	TRAP_NJ(T_SEGNPFLT)
 	jmp	kernuser_reenter
 IDTVEC_END(trap11)
 
-IDTVEC(trap12)		/* #SS() Stack exception */
+IDTVEC(trap12)		/* #SS - Stack fault */
 	TRAP_NJ(T_STKFLT)
 	jmp	kernuser_reenter
 IDTVEC_END(trap12)
 
-IDTVEC(trap13)		/* #GP() General protection */
+IDTVEC(trap13)		/* #GP - General protection */
 	TRAP_NJ(T_PROTFLT)
 	jmp	kernuser_reenter
 IDTVEC_END(trap13)
 
-IDTVEC(trap14)
+IDTVEC(trap14)		/* #PF - Page fault */
 	TRAP(T_PAGEFLT)
 IDTVEC_END(trap14)
 
-IDTVEC(trap15)
+IDTVEC(trap15)		/* XXX ??? */
 	ZTRAP_NJ(T_ASTFLT)
 	INTRENTRY
 #ifdef DIAGNOSTIC
@@ -444,7 +444,7 @@ IDTVEC(trap15)
 	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap15)
 
-IDTVEC(trap16)
+IDTVEC(trap16)		/* #MF - x87 floating-point exception */
 	ZTRAP_NJ(T_ARITHTRAP)
 .Ldo_fputrap:
 	INTRENTRY
@@ -464,30 +464,30 @@ IDTVEC(trap16)
 	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap16)
 
-IDTVEC(trap17)
+IDTVEC(trap17)		/* #AC - Alignment check */
 	TRAP(T_ALIGNFLT)
 IDTVEC_END(trap17)
 
-IDTVEC(trap18)
+IDTVEC(trap18)		/* #MC - Machine check */
 	ZTRAP(T_MCA)
 IDTVEC_END(trap18)
 
-IDTVEC(trap19)
+IDTVEC(trap19)		/* #XM - SIMD floating-point exception */
 	ZTRAP_NJ(T_XMM)
 	jmp	.Ldo_fputrap
 IDTVEC_END(trap19)
 
-IDTVEC(trap20)
-IDTVEC(trap21)
+IDTVEC(trap20)		/* #VE - Virtualization (Intel) */
+IDTVEC(trap21)		/*

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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:17:22 UTC 2024

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-10]: amd64_trap.S

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

sys/arch/amd64/amd64/amd64_trap.S: revision 1.55

amd64_trap.S: Annotate trap vectors with their mnemonics.

Derived from Intel and AMD manuals.
Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3
(3A, 3B, 3C, & 3D: System Programming Guide, Order Number:
325384-077US, April 2022.
https://cdrdv2.intel.com/v1/dl/getContent/671447

AMD64 Technology: AMD64 Architecture Programmers' Manual, Volume 2:
System Programming, Publication No. 24953, Revision 3.40, January 2023.
https://www.amd.com/system/files/TechDocs/24593.pdf

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.4.1 src/sys/arch/amd64/amd64/amd64_trap.S

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



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:00:14 UTC 2024

Modified Files:
src/sys/arch/i386/i386 [netbsd-10]: bioscall.S

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

sys/arch/i386/i386/bioscall.S: revision 1.11

i386/bioscall: Disable preemption while we load the kernel pmap.

Fixes crash on boot in new KASSERT(kpreempt_disabled()) in
cpu_load_pmap.

We could do KASSERT(kpreempt_disabled() || cold), but I don't know if
bioscall is ever reachable after warm boot; this way is safer.

XXX Would be nice if bioscall were a C function, not asm -- I don't
see any reason why we need it to be asm?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.30.1 src/sys/arch/i386/i386/bioscall.S

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

Modified files:

Index: src/sys/arch/i386/i386/bioscall.S
diff -u src/sys/arch/i386/i386/bioscall.S:1.10 src/sys/arch/i386/i386/bioscall.S:1.10.30.1
--- src/sys/arch/i386/i386/bioscall.S:1.10	Sat Jul 14 14:29:40 2018
+++ src/sys/arch/i386/i386/bioscall.S	Fri Sep 20 10:00:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $ */
+/*	$NetBSD: bioscall.S,v 1.10.30.1 2024/09/20 10:00:14 martin Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.10 2018/07/14 14:29:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bioscall.S,v 1.10.30.1 2024/09/20 10:00:14 martin Exp $");
 
 #include 
 
@@ -67,6 +67,8 @@ ENTRY(bioscall)
 	pushl	%ebp
 	movl	%esp,%ebp		/* set up frame ptr */
 
+	call	_C_LABEL(kpreempt_disable)
+
 	/* install lwp0 pmap */
 	movl	_C_LABEL(kernel_pmap_ptr),%eax
 	pushl	%eax
@@ -85,5 +87,7 @@ ENTRY(bioscall)
 	call	_C_LABEL(cpu_load_pmap)
 	addl	$4,%esp
 
+	call	_C_LABEL(kpreempt_enable)
+
 	leave
 	ret



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 10:00:14 UTC 2024

Modified Files:
src/sys/arch/i386/i386 [netbsd-10]: bioscall.S

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

sys/arch/i386/i386/bioscall.S: revision 1.11

i386/bioscall: Disable preemption while we load the kernel pmap.

Fixes crash on boot in new KASSERT(kpreempt_disabled()) in
cpu_load_pmap.

We could do KASSERT(kpreempt_disabled() || cold), but I don't know if
bioscall is ever reachable after warm boot; this way is safer.

XXX Would be nice if bioscall were a C function, not asm -- I don't
see any reason why we need it to be asm?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.30.1 src/sys/arch/i386/i386/bioscall.S

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



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 09:58:19 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-10]: lock_stubs.s

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

sys/arch/sparc64/sparc64/lock_stubs.s: revision 1.12

sparc64: Add missing LoadStore ordering for mutex_enter stub.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/sparc64/sparc64/lock_stubs.s

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



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 09:58:19 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-10]: lock_stubs.s

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

sys/arch/sparc64/sparc64/lock_stubs.s: revision 1.12

sparc64: Add missing LoadStore ordering for mutex_enter stub.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/sparc64/sparc64/lock_stubs.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/sparc64/sparc64/lock_stubs.s
diff -u src/sys/arch/sparc64/sparc64/lock_stubs.s:1.11 src/sys/arch/sparc64/sparc64/lock_stubs.s:1.11.4.1
--- src/sys/arch/sparc64/sparc64/lock_stubs.s:1.11	Wed Apr  6 22:47:57 2022
+++ src/sys/arch/sparc64/sparc64/lock_stubs.s	Fri Sep 20 09:58:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.11 2022/04/06 22:47:57 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.11.4.1 2024/09/20 09:58:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 #define	CURLWP	(CPUINFO_VA+CI_CURLWP)
 
 #if defined(MULTIPROCESSOR)
-#define	MB_READ	membar #LoadLoad
+#define	MB_READ	membar #LoadLoad | #LoadStore
 #define	MB_MEM	membar #LoadStore | #StoreStore
 #else
 #define	MB_READ	/* nothing */



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 09:30:52 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-10]: db_trace.c

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

sys/arch/sparc64/sparc64/db_trace.c: revision 1.56
sys/arch/sparc64/sparc64/db_trace.c: revision 1.57

sparc64/db_trace.c: Nix trailing whitespace.
No functional change intended.

sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.20.1 src/sys/arch/sparc64/sparc64/db_trace.c

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



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

2024-09-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 20 09:30:52 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64 [netbsd-10]: db_trace.c

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

sys/arch/sparc64/sparc64/db_trace.c: revision 1.56
sys/arch/sparc64/sparc64/db_trace.c: revision 1.57

sparc64/db_trace.c: Nix trailing whitespace.
No functional change intended.

sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.20.1 src/sys/arch/sparc64/sparc64/db_trace.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.55 src/sys/arch/sparc64/sparc64/db_trace.c:1.55.20.1
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.55	Sun May 31 11:28:52 2020
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Fri Sep 20 09:30:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $ */
+/*	$NetBSD: db_trace.c,v 1.55.20.1 2024/09/20 09:30:52 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55.20.1 2024/09/20 09:30:52 martin Exp $");
 
 #include 
 #include 
@@ -57,7 +57,7 @@ void db_print_window(uint64_t);
 #endif
 
 #ifdef _KERNEL
-#define	KLOAD(x)	probeget((paddr_t)(u_long)&(x), ASI_PRIMARY, sizeof(x))	
+#define	KLOAD(x)	probeget((paddr_t)(u_long)&(x), ASI_PRIMARY, sizeof(x))
 #else
 static long
 kload(db_addr_t addr)
@@ -127,12 +127,8 @@ db_stack_trace_print(db_expr_t addr, boo
 			}
 			(*pr)("lid %d ", l.l_lid);
 			pcb = lwp_getpcb(&l);
-#ifndef _KERNEL
 			db_read_bytes((db_addr_t)&pcb->pcb_sp,
 			sizeof(frame), (char *)&frame);
-#else
-			frame = (vaddr_t)pcb->pcb_sp;
-#endif
 			(*pr)("at %p\n", frame);
 		} else {
 			frame = (vaddr_t)addr;
@@ -153,12 +149,12 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (frame & 1) {
 			f64 = (struct frame64 *)(frame + BIAS);
 			pc = (db_addr_t)KLOAD(f64->fr_pc);
-		
+
 			frame = KLOAD(f64->fr_fp);
 		} else {
 			f32 = (struct frame32 *)(frame);
 			pc = (db_addr_t)KLOAD(f32->fr_pc);
-		
+
 			frame = (long)KLOAD(f32->fr_fp);
 		}
 
@@ -175,13 +171,13 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (!INKERNEL(frame))
 			break;
 #endif
-		
+
 		db_find_sym_and_offset(pc, &name, &offset);
 		if (name == NULL)
 			name = "?";
-		
+
 		(*pr)("%s(", name);
-		
+
 		/*
 		 * Print %i0..%i5; hope these still reflect the
 		 * actual arguments somewhat...
@@ -216,7 +212,7 @@ db_dump_window(db_expr_t addr, bool have
 
 	/* Traverse window stack */
 	for (i=0; ifr_fp;
 		else frame = (uint64_t)((struct frame32 *)(u_long)frame)->fr_fp;
 	}
@@ -226,13 +222,13 @@ db_dump_window(db_expr_t addr, bool have
 }
 #endif
 
-void 
+void
 db_print_window(uint64_t frame)
 {
 	if (frame & 1) {
 		struct frame64* f = (struct frame64*)(u_long)(frame + BIAS);
 
-		db_printf("frame64 %p locals, ins:\n", f);		
+		db_printf("frame64 %p locals, ins:\n", f);
 		if (INKERNEL(f)) {
 			db_printf("%llx %llx %llx %llx ",
   (unsigned long long)f->fr_local[0],
@@ -245,12 +241,12 @@ db_print_window(uint64_t frame)
   (unsigned long long)f->fr_local[6],
   (unsigned long long)f->fr_local[7]);
 			db_printf("%llx %llx %llx %llx ",
-  (unsigned long long)f->fr_arg[0],	
+  (unsigned long long)f->fr_arg[0],
   (unsigned long long)f->fr_arg[1],
   (unsigned long long)f->fr_arg[2],
   (unsigned long long)f->fr_arg[3]);
 			db_printf("%llx %llx %llx=sp %llx=pc:",
-  (unsigned long long)f->fr_arg[4],	
+  (unsigned long long)f->fr_arg[4],
   (unsigned long long)f->fr_arg[5],
   (unsigned long long)f->fr_fp,
   (unsigned long long)f->fr_pc);
@@ -276,7 +272,7 @@ db_print_window(uint64_t frame)
   (unsigned long long)f->fr_arg[5],
   (unsigned long long)f->fr_fp,
   (unsigned long long)f->fr_pc);
-			db_printf("\n");	 
+			db_printf("\n");
 		}
 	} else {
 		struct frame32* f = (struct frame32*)(u_long)frame;
@@ -297,14 +293,14 @@ db_print_window(uint64_t frame)
 			if (copyin(f, &fr, sizeof(fr))) return;
 			f = &fr;
 			db_printf("%8x %8x %8x %8x %8x %8x %8x %8x\n",
-  f->fr_local[0], f->fr_local[1], 
+  f->fr_local[0], f->fr_local[1],
   f->fr_local[2], f->fr_local[3],
-  f->fr_local[4], f->fr_local[5], 
+  f->fr_local[4], f->fr_local[5],
   f->fr_local[6], f->fr_local[7]);
 			db_printf("%8x %8x %8x %8x %8x %8x %8x=sp %8x=pc\n",
-  f->fr_arg[0], f->fr_arg[1], 
+  f->fr_arg[0], f->fr_arg[1],
   f->fr_arg[2], f->fr_arg[3],
-  f->fr_arg[4], f->fr_arg[5], 
+  f->fr_arg[4], f->fr_arg[5],
 	

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

2024-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:50:47 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga [netbsd-10]: trap.c

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

sys/arch/amiga/amiga/trap.c: revision 1.143

Don't panic on NULL pointer dereference when done by copyin, ...


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.139.20.1 src/sys/arch/amiga/amiga/trap.c

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

Modified files:

Index: src/sys/arch/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.139 src/sys/arch/amiga/amiga/trap.c:1.139.20.1
--- src/sys/arch/amiga/amiga/trap.c:1.139	Mon Aug 10 10:51:21 2020
+++ src/sys/arch/amiga/amiga/trap.c	Thu Sep 12 19:50:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.139.20.1 2024/09/12 19:50:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139.20.1 2024/09/12 19:50:47 martin Exp $");
 
 #include 
 #include 
@@ -363,7 +363,7 @@ trapmmufault(int type, u_int code, u_int
 		ftype = VM_PROT_READ;
 	va = trunc_page((vaddr_t)v);
 #ifdef DEBUG
-	if (map == kernel_map && va == 0) {
+	if (map == kernel_map && va == 0 && onfault == 0) {
 		printf("trap: bad kernel access at %x pc %x\n", v, fp->f_pc);
 		panictrap(type, code, v, fp);
 	}



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

2024-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:56:08 UTC 2024

Modified Files:
src/sys/arch/macppc/macppc [netbsd-10]: machdep.c

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

sys/arch/macppc/macppc/machdep.c: revision 1.177

macppc/machdep: Correctly disable have_backlight for ofw_quiesce
instead of have_palette (copy-paste bug by myself).


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/macppc/macppc/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/macppc/macppc/machdep.c
diff -u src/sys/arch/macppc/macppc/machdep.c:1.175 src/sys/arch/macppc/macppc/machdep.c:1.175.4.1
--- src/sys/arch/macppc/macppc/machdep.c:1.175	Sun Jun 26 09:23:32 2022
+++ src/sys/arch/macppc/macppc/machdep.c	Thu Sep 12 19:56:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.175 2022/06/26 09:23:32 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.175.4.1 2024/09/12 19:56:08 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175 2022/06/26 09:23:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.4.1 2024/09/12 19:56:08 martin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -421,7 +421,7 @@ copy_disp_props(device_t dev, int node, 
 	if (have_backlight && ofw_quiesce) {
 		aprint_debug(
 		"OFW has been quiesced - disabling backlight callbacks\n");
-		have_palette = 0;
+		have_backlight = 0;
 	}
 
 	if (have_backlight) {



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

2024-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:56:08 UTC 2024

Modified Files:
src/sys/arch/macppc/macppc [netbsd-10]: machdep.c

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

sys/arch/macppc/macppc/machdep.c: revision 1.177

macppc/machdep: Correctly disable have_backlight for ofw_quiesce
instead of have_palette (copy-paste bug by myself).


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/macppc/macppc/machdep.c

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



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

2024-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:50:47 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga [netbsd-10]: trap.c

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

sys/arch/amiga/amiga/trap.c: revision 1.143

Don't panic on NULL pointer dereference when done by copyin, ...


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.139.20.1 src/sys/arch/amiga/amiga/trap.c

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



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

2024-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 11 16:32:56 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: intr.c

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

sys/arch/x86/x86/intr.c: revision 1.166

Fix use-after-free (source->is_type) when detecting unsharable
interrupts. Doesn't solve the interrupt conflict itself, but
avoids a panic.


To generate a diff of this commit:
cvs rdiff -u -r1.163.2.2 -r1.163.2.3 src/sys/arch/x86/x86/intr.c

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



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

2024-09-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 11 16:32:56 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: intr.c

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

sys/arch/x86/x86/intr.c: revision 1.166

Fix use-after-free (source->is_type) when detecting unsharable
interrupts. Doesn't solve the interrupt conflict itself, but
avoids a panic.


To generate a diff of this commit:
cvs rdiff -u -r1.163.2.2 -r1.163.2.3 src/sys/arch/x86/x86/intr.c

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.163.2.2 src/sys/arch/x86/x86/intr.c:1.163.2.3
--- src/sys/arch/x86/x86/intr.c:1.163.2.2	Wed Sep 11 10:09:19 2024
+++ src/sys/arch/x86/x86/intr.c	Wed Sep 11 16:32:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.163.2.2 2024/09/11 10:09:19 martin Exp $	*/
+/*	$NetBSD: intr.c,v 1.163.2.3 2024/09/11 16:32:56 martin Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.163.2.2 2024/09/11 10:09:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.163.2.3 2024/09/11 16:32:56 martin Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -911,6 +911,8 @@ intr_establish_xname(int legacy_irq, str
 		/* FALLTHROUGH */
 	case IST_PULSE:
 		if (type != IST_NONE) {
+			int otype = source->is_type;
+
 			intr_source_free(ci, slot, pic, idt_vec);
 			intr_free_io_intrsource_direct(chained);
 			mutex_exit(&cpu_lock);
@@ -918,7 +920,7 @@ intr_establish_xname(int legacy_irq, str
 			printf("%s: pic %s pin %d: can't share "
 			   "type %d with %d\n",
 __func__, pic->pic_name, pin,
-source->is_type, type);
+otype, type);
 			return NULL;
 		}
 		break;



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

2024-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep  3 15:23:41 UTC 2024

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-10]: biosmemx.S bootinfo_memmap.c
getextmemx.c

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

sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.7
sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.8
sys/arch/i386/stand/lib/getextmemx.c: revision 1.11
sys/arch/i386/stand/lib/getextmemx.c: revision 1.12
sys/arch/i386/stand/lib/biosmemx.S: revision 1.12
sys/arch/i386/stand/lib/biosmemx.S: revision 1.13

Allocate buf[6] instead of buf[5] to work around buggy firmware, which may
write mementry to 24 bytes instead 20 requested with ACPI 3.0 enabled,
causing corrupted stack and wrong marks[] values in common_load_kernel().

This in turn was leading to erroneous caluclations and memory addresses.

This eventually may result in null pointer dereference in the kernel and sudden
reboot for VIA based systems.

Commit should fix boot issues for VIA C7-M based HP 2133 Mini-Note,
mentioned in the original bug report. For AMD based HP Compaq 6005 Pro
discussed in a separate thread, the issue may be different.

Tested on my VIA C7-D based Biostar Viotech 3100+ motherboard.
PR install/49470

i386/stand/lib: Nix trailing whitespace and tidy comments a bit.
No functional change intended.
PR port-amd64/49470: NetBSD 7 BETA reboots after bootloader (HP 2133)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/i386/stand/lib/biosmemx.S
cvs rdiff -u -r1.6 -r1.6.26.1 src/sys/arch/i386/stand/lib/bootinfo_memmap.c
cvs rdiff -u -r1.10 -r1.10.84.1 src/sys/arch/i386/stand/lib/getextmemx.c

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

Modified files:

Index: src/sys/arch/i386/stand/lib/biosmemx.S
diff -u src/sys/arch/i386/stand/lib/biosmemx.S:1.11 src/sys/arch/i386/stand/lib/biosmemx.S:1.11.8.1
--- src/sys/arch/i386/stand/lib/biosmemx.S:1.11	Mon Aug  2 12:56:23 2021
+++ src/sys/arch/i386/stand/lib/biosmemx.S	Tue Sep  3 15:23:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosmemx.S,v 1.11 2021/08/02 12:56:23 andvar Exp $	*/
+/*	$NetBSD: biosmemx.S,v 1.11.8.1 2024/09/03 15:23:40 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999
@@ -84,12 +84,30 @@ ENTRY(getextmem2)
 	ret
 
 /*
- * int getmementry(int *iterator, int buffer[5])
+ * int getmementry(int *iterator, int buffer[6])
  *
  * return: 0=ok, else error
  * buffer[0]: start of memory chunk
  * buffer[2]: length (bytes)
  * buffer[4]: type
+ * buffer[5]: ACPI 3.0 Extended Attributes bitfield (unused)
+ *
+ * Some buggy BIOSes may write to 24 bytes even if only 20 were requested.
+ * Therefore, the buffer is defined for 6 elements to avoid stack buffer
+ * overruns.  See PR install/49470.
+ *
+ * More details can be found in the:
+ *
+ *	Advanced Configuration and Power Interface (ACPI)
+ *	Specification, Release 6.5, 2022-08-29, UEFI Forum, Inc.,
+ *	Sec. 15.1 `INT 15H E820H - Query System Address Map',
+ *	pp. 756-757
+ *	https://uefi.org/sites/default/files/resources/ACPI_Spec_6_5_Aug29.pdf#page=824
+ *	https://uefi.org/specs/ACPI/6.5/15_System_Address_Map_Interfaces.html#int-15h-e820h-query-system-address-map
+ *
+ * as well as this OSDev.org wiki page:
+ *
+ *	https://wiki.osdev.org/Detecting_Memory_(x86)#BIOS_Function:_INT_0x15,_EAX_=_0xE820
  */
 ENTRY(getmementry)
 	pushl	%ebp

Index: src/sys/arch/i386/stand/lib/bootinfo_memmap.c
diff -u src/sys/arch/i386/stand/lib/bootinfo_memmap.c:1.6 src/sys/arch/i386/stand/lib/bootinfo_memmap.c:1.6.26.1
--- src/sys/arch/i386/stand/lib/bootinfo_memmap.c:1.6	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/lib/bootinfo_memmap.c	Tue Sep  3 15:23:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo_memmap.c,v 1.6 2019/09/13 02:19:46 manu Exp $	*/
+/*	$NetBSD: bootinfo_memmap.c,v 1.6.26.1 2024/09/03 15:23:40 martin Exp $	*/
 
 /*
  * Copyright (c) 1999
@@ -37,7 +37,11 @@ extern int getmementry(int *, int *);
 void
 bi_getmemmap(void)
 {
-	int buf[5], i, nranges, n;
+	/*
+	 * Allocate 6 words, not 5, to work around buggy firmware --
+	 * see comment on getmementry in biosmemx.S.
+	 */
+	int buf[6], i, nranges, n;
 
 	nranges = 0;
 	i = 0;

Index: src/sys/arch/i386/stand/lib/getextmemx.c
diff -u src/sys/arch/i386/stand/lib/getextmemx.c:1.10 src/sys/arch/i386/stand/lib/getextmemx.c:1.10.84.1
--- src/sys/arch/i386/stand/lib/getextmemx.c:1.10	Thu Jun 16 13:27:59 2011
+++ src/sys/arch/i386/stand/lib/getextmemx.c	Tue Sep  3 15:23:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getextmemx.c,v 1.10 2011/06/16 13:27:59 joerg Exp $	*/
+/*	$NetBSD: getextmemx.c,v 1.10.84.1 2024/09/03 15:23:40 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999
@@ -38,7 +38,11 @@
 int
 getextmemx(void)
 {
-	int buf[5], i;
+	/*
+	 * Allocate 6 words, not 5, to work around buggy firmware --
+	 * see comment on getmementry in biosmemx.S.
+	 */
+	int buf[6], i;

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

2024-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep  3 15:23:41 UTC 2024

Modified Files:
src/sys/arch/i386/stand/lib [netbsd-10]: biosmemx.S bootinfo_memmap.c
getextmemx.c

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

sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.7
sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.8
sys/arch/i386/stand/lib/getextmemx.c: revision 1.11
sys/arch/i386/stand/lib/getextmemx.c: revision 1.12
sys/arch/i386/stand/lib/biosmemx.S: revision 1.12
sys/arch/i386/stand/lib/biosmemx.S: revision 1.13

Allocate buf[6] instead of buf[5] to work around buggy firmware, which may
write mementry to 24 bytes instead 20 requested with ACPI 3.0 enabled,
causing corrupted stack and wrong marks[] values in common_load_kernel().

This in turn was leading to erroneous caluclations and memory addresses.

This eventually may result in null pointer dereference in the kernel and sudden
reboot for VIA based systems.

Commit should fix boot issues for VIA C7-M based HP 2133 Mini-Note,
mentioned in the original bug report. For AMD based HP Compaq 6005 Pro
discussed in a separate thread, the issue may be different.

Tested on my VIA C7-D based Biostar Viotech 3100+ motherboard.
PR install/49470

i386/stand/lib: Nix trailing whitespace and tidy comments a bit.
No functional change intended.
PR port-amd64/49470: NetBSD 7 BETA reboots after bootloader (HP 2133)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/i386/stand/lib/biosmemx.S
cvs rdiff -u -r1.6 -r1.6.26.1 src/sys/arch/i386/stand/lib/bootinfo_memmap.c
cvs rdiff -u -r1.10 -r1.10.84.1 src/sys/arch/i386/stand/lib/getextmemx.c

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



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

2024-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 23 18:15:31 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: cpu_rng.c

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

sys/arch/x86/x86/cpu_rng.c: revision 1.21

x86/cpu_rng: Fix false alarm rate of CPU RNG health test.

Lower it from 1/2^32 (about one in four billion) to 1/2^256
(approximately not gonna happen squared).

PR port-amd64/58122


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/arch/x86/x86/cpu_rng.c

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



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

2024-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 23 18:15:31 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: cpu_rng.c

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

sys/arch/x86/x86/cpu_rng.c: revision 1.21

x86/cpu_rng: Fix false alarm rate of CPU RNG health test.

Lower it from 1/2^32 (about one in four billion) to 1/2^256
(approximately not gonna happen squared).

PR port-amd64/58122


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/arch/x86/x86/cpu_rng.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/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.20 src/sys/arch/x86/x86/cpu_rng.c:1.20.4.1
--- src/sys/arch/x86/x86/cpu_rng.c:1.20	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/cpu_rng.c	Fri Aug 23 18:15:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.20 2021/10/07 12:52:27 msaitoh Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.20.4.1 2024/08/23 18:15:31 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -260,8 +260,12 @@ cpu_rng(enum cpu_rng_mode mode, uint64_t
 static void
 cpu_rng_get(size_t nbytes, void *cookie)
 {
-#define N howmany(256, 64)
-	uint64_t buf[2*N];
+	enum {
+		NBITS = 256,
+		NBYTES = howmany(NBITS, 8),
+		NWORDS = howmany(NBITS, 64),
+	};
+	uint64_t buf[2*NWORDS];
 	unsigned i, nbits = 0;
 
 	while (nbytes) {
@@ -273,7 +277,7 @@ cpu_rng_get(size_t nbytes, void *cookie)
 		 */
 		for (i = 0; i < __arraycount(buf); i++)
 			nbits += cpu_rng(cpu_rng_mode, &buf[i]);
-		if (consttime_memequal(buf, buf + N, N)) {
+		if (consttime_memequal(buf, buf + NWORDS, NBYTES)) {
 			printf("cpu_rng %s: failed repetition test\n",
 			cpu_rng_name[cpu_rng_mode]);
 			nbits = 0;
@@ -281,7 +285,6 @@ cpu_rng_get(size_t nbytes, void *cookie)
 		rnd_add_data_sync(&cpu_rng_source, buf, sizeof buf, nbits);
 		nbytes -= MIN(MIN(nbytes, sizeof buf), MAX(1, 8*nbits));
 	}
-#undef N
 }
 
 void



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

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

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

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

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.198.2.4 -r1.198.2.5 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.123 -r1.123.4.1 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-10] src/sys/arch/x86

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

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

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

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.198.2.4 -r1.198.2.5 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.123 -r1.123.4.1 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.198.2.4 src/sys/arch/x86/include/specialreg.h:1.198.2.5
--- src/sys/arch/x86/include/specialreg.h:1.198.2.4	Sat Jul 29 09:44:34 2023
+++ src/sys/arch/x86/include/specialreg.h	Sat Jul 20 14:19:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.198.2.4 2023/07/29 09:44:34 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.198.2.5 2024/07/20 14:19:31 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.123 src/sys/arch/x86/x86/identcpu.c:1.123.4.1
--- src/sys/arch/x86/x86/identcpu.c:1.123	Thu Oct  7 13:04:18 2021
+++ src/sys/arch/x86/x86/identcpu.c	Sat Jul 20 14:19:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.123 2021/10/07 13:04:18 msaitoh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.123.4.1 2024/07/20 14:19:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  

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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 18:12:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea [netbsd-10]: altivec.c

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

sys/arch/powerpc/oea/altivec.c: revision 1.35

don't do anything in vec_restore_from_mcontext() if no altivec.
fixes a crash seen on netbsd-10 in PR#58283.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/powerpc/oea/altivec.c

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

Modified files:

Index: src/sys/arch/powerpc/oea/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.34 src/sys/arch/powerpc/oea/altivec.c:1.34.4.1
--- src/sys/arch/powerpc/oea/altivec.c:1.34	Sat Oct 30 19:44:56 2021
+++ src/sys/arch/powerpc/oea/altivec.c	Wed Jul  3 18:12:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $	*/
+/*	$NetBSD: altivec.c,v 1.34.4.1 2024/07/03 18:12:35 martin Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.34.4.1 2024/07/03 18:12:35 martin Exp $");
 
 #include 
 #include 
@@ -163,6 +163,10 @@ vec_restore_from_mcontext(struct lwp *l,
 
 	KASSERT(l == curlwp);
 
+	/* Nothing to do here. */
+	if (!vec_used_p(l))
+		return;
+
 	/* we don't need to save the state, just drop it */
 	pcu_discard(&vec_ops, l, true);
 



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

2024-07-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  3 18:12:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea [netbsd-10]: altivec.c

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

sys/arch/powerpc/oea/altivec.c: revision 1.35

don't do anything in vec_restore_from_mcontext() if no altivec.
fixes a crash seen on netbsd-10 in PR#58283.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/powerpc/oea/altivec.c

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



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

2024-06-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 27 19:27:29 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga [netbsd-10]: locore.s
src/sys/arch/atari/atari [netbsd-10]: locore.s
src/sys/arch/cesfic/cesfic [netbsd-10]: locore.s
src/sys/arch/hp300/hp300 [netbsd-10]: locore.s
src/sys/arch/luna68k/luna68k [netbsd-10]: locore.s
src/sys/arch/m68k/conf [netbsd-10]: files.m68k
src/sys/arch/m68k/include [netbsd-10]: pte_motorola.h
src/sys/arch/m68k/m68k [netbsd-10]: compat_13_sigreturn13.s
compat_16_sigreturn14.s
src/sys/arch/mac68k/mac68k [netbsd-10]: locore.s
src/sys/arch/mvme68k/mvme68k [netbsd-10]: locore.s
src/sys/arch/news68k/news68k [netbsd-10]: locore.s
src/sys/arch/next68k/next68k [netbsd-10]: locore.s
src/sys/arch/sun2/sun2 [netbsd-10]: locore.s
src/sys/arch/sun3/sun3 [netbsd-10]: locore.s
src/sys/arch/sun3/sun3x [netbsd-10]: locore.s
src/sys/arch/x68k/x68k [netbsd-10]: locore.s
Removed Files:
src/sys/arch/m68k/m68k [netbsd-10]: sigreturn.s

Log Message:
Pull up following revision(s) (requested by rin in ticket #724
to fix build fallout on the branch):

sys/arch/m68k/m68k/compat_16_sigreturn14.s: revision 1.6
sys/arch/mvme68k/mvme68k/locore.s: revision 1.129
sys/arch/news68k/news68k/locore.s: revision 1.84
sys/arch/hp300/hp300/locore.s: revision 1.183
sys/arch/m68k/m68k/compat_13_sigreturn13.s: revision 1.8
sys/arch/m68k/m68k/sigreturn.s: file removal
sys/arch/m68k/include/pte_motorola.h: revision 1.10
sys/arch/atari/atari/locore.s: revision 1.125
sys/arch/amiga/amiga/locore.s: revision 1.169
sys/arch/sun2/sun2/locore.s: revision 1.37
sys/arch/next68k/next68k/locore.s: revision 1.84
sys/arch/x68k/x68k/locore.s: revision 1.130
sys/arch/sun3/sun3x/locore.s: revision 1.77
sys/arch/cesfic/cesfic/locore.s: revision 1.45
sys/arch/m68k/conf/files.m68k: revision 1.53
sys/arch/sun3/sun3/locore.s: revision 1.109
sys/arch/luna68k/luna68k/locore.s: revision 1.81
sys/arch/mac68k/mac68k/locore.s: revision 1.182

Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.

Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.161.4.1 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.116 -r1.116.4.1 src/sys/arch/atari/atari/locore.s
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/cesfic/cesfic/locore.s
cvs rdiff -u -r1.173 -r1.173.4.1 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.51 -r1.51.20.1 src/sys/arch/m68k/conf/files.m68k
cvs rdiff -u -r1.8 -r1.8.86.1 src/sys/arch/m68k/include/pte_motorola.h
cvs rdiff -u -r1.7 -r1.7.60.1 src/sys/arch/m68k/m68k/compat_13_sigreturn13.s
cvs rdiff -u -r1.5 -r1.5.60.1 src/sys/arch/m68k/m68k/compat_16_sigreturn14.s
cvs rdiff -u -r1.11 -r0 src/sys/arch/m68k/m68k/sigreturn.s
cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.68.4.2 -r1.68.4.3 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/sun2/sun2/locore.s
cvs rdiff -u -r1.101 -r1.101.4.1 src/sys/arch/sun3/sun3/locore.s
cvs rdiff -u -r1.69 -r1.69.4.1 src/sys/arch/sun3/sun3x/locore.s
cvs rdiff -u -r1.121 -r1.121.4.1 src/sys/arch/x68k/x68k/locore.s

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

Modified files:

Index: src/sys/arch/amiga/amiga/locore.s
diff -u src/sys/arch/amiga/amiga/locore.s:1.161 src/sys/arch/amiga/amiga/locore.s:1.161.4.1
--- src/sys/arch/amiga/amiga/locore.s:1.161	Mon May 30 09:56:02 2022
+++ src/sys/arch/amiga/amiga/locore.s	Thu Jun 27 19:27:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.161 2022/05/30 09:56:02 andvar Exp $	*/
+/*	$NetBSD: locore.s,v 1.161.4.1 2024/06/27 19:27:28 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -423,9 +423,6 @@ ENTRY_NOPROFILE(trace)
 	moveq	#T_TRACE,%d0
 	jra	_ASM_LABEL(fault)
 
-/* Use common m68k sigreturn */
-#include 
-
 /*
  * Interrupt handlers.
  *

Index: src/sys/arch/atari/atari/locore.s
diff -u src/sys/arch/atari/atari/locore.s:1.116 src/sys/arch/atari/atari/locore.s:1.116.4.1
--- src/sys/arch/atari/atari/locore.s:1.116	Mon May 30 09:56:03 2022
+++ src/sys/arch/atari/atari/locore.s	Thu Jun 27 19:27:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.116 2022/05/30 09:56:03 andvar Exp $	*/
+/*	$NetBSD: locore.s,v 1.116.4.1 2024/06/27 19:27:28 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -618,9 +618,6 @@ Lbrkpt3:
 	movl	%sp@,%s

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

2024-06-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 27 19:27:29 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga [netbsd-10]: locore.s
src/sys/arch/atari/atari [netbsd-10]: locore.s
src/sys/arch/cesfic/cesfic [netbsd-10]: locore.s
src/sys/arch/hp300/hp300 [netbsd-10]: locore.s
src/sys/arch/luna68k/luna68k [netbsd-10]: locore.s
src/sys/arch/m68k/conf [netbsd-10]: files.m68k
src/sys/arch/m68k/include [netbsd-10]: pte_motorola.h
src/sys/arch/m68k/m68k [netbsd-10]: compat_13_sigreturn13.s
compat_16_sigreturn14.s
src/sys/arch/mac68k/mac68k [netbsd-10]: locore.s
src/sys/arch/mvme68k/mvme68k [netbsd-10]: locore.s
src/sys/arch/news68k/news68k [netbsd-10]: locore.s
src/sys/arch/next68k/next68k [netbsd-10]: locore.s
src/sys/arch/sun2/sun2 [netbsd-10]: locore.s
src/sys/arch/sun3/sun3 [netbsd-10]: locore.s
src/sys/arch/sun3/sun3x [netbsd-10]: locore.s
src/sys/arch/x68k/x68k [netbsd-10]: locore.s
Removed Files:
src/sys/arch/m68k/m68k [netbsd-10]: sigreturn.s

Log Message:
Pull up following revision(s) (requested by rin in ticket #724
to fix build fallout on the branch):

sys/arch/m68k/m68k/compat_16_sigreturn14.s: revision 1.6
sys/arch/mvme68k/mvme68k/locore.s: revision 1.129
sys/arch/news68k/news68k/locore.s: revision 1.84
sys/arch/hp300/hp300/locore.s: revision 1.183
sys/arch/m68k/m68k/compat_13_sigreturn13.s: revision 1.8
sys/arch/m68k/m68k/sigreturn.s: file removal
sys/arch/m68k/include/pte_motorola.h: revision 1.10
sys/arch/atari/atari/locore.s: revision 1.125
sys/arch/amiga/amiga/locore.s: revision 1.169
sys/arch/sun2/sun2/locore.s: revision 1.37
sys/arch/next68k/next68k/locore.s: revision 1.84
sys/arch/x68k/x68k/locore.s: revision 1.130
sys/arch/sun3/sun3x/locore.s: revision 1.77
sys/arch/cesfic/cesfic/locore.s: revision 1.45
sys/arch/m68k/conf/files.m68k: revision 1.53
sys/arch/sun3/sun3/locore.s: revision 1.109
sys/arch/luna68k/luna68k/locore.s: revision 1.81
sys/arch/mac68k/mac68k/locore.s: revision 1.182

Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.

Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.161.4.1 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.116 -r1.116.4.1 src/sys/arch/atari/atari/locore.s
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/arch/cesfic/cesfic/locore.s
cvs rdiff -u -r1.173 -r1.173.4.1 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.51 -r1.51.20.1 src/sys/arch/m68k/conf/files.m68k
cvs rdiff -u -r1.8 -r1.8.86.1 src/sys/arch/m68k/include/pte_motorola.h
cvs rdiff -u -r1.7 -r1.7.60.1 src/sys/arch/m68k/m68k/compat_13_sigreturn13.s
cvs rdiff -u -r1.5 -r1.5.60.1 src/sys/arch/m68k/m68k/compat_16_sigreturn14.s
cvs rdiff -u -r1.11 -r0 src/sys/arch/m68k/m68k/sigreturn.s
cvs rdiff -u -r1.175 -r1.175.4.1 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.68.4.2 -r1.68.4.3 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/sun2/sun2/locore.s
cvs rdiff -u -r1.101 -r1.101.4.1 src/sys/arch/sun3/sun3/locore.s
cvs rdiff -u -r1.69 -r1.69.4.1 src/sys/arch/sun3/sun3x/locore.s
cvs rdiff -u -r1.121 -r1.121.4.1 src/sys/arch/x68k/x68k/locore.s

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



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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 18:30:13 UTC 2024

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

Log Message:
Pull up the following, requested by bouyer in ticket #726:

sys/arch/xen/xen/xbdback_xenbus.c   upto 1.107

Restore "sparse" segements support which was lost in rev 1.83, causing
VBD corruption with linux guests.
The segments in a single request are not always contigous in VA; this means
that the end of a segment is not always 7 and the start of the next one is not
always 0. When this happens this means that a contigous chunk of data from
disk has to be dispatched to various non-contigous VA, in chunks of VBD_BSIZE
bytes (or the other way round for writes).
Linux I/O subsystems seems to support this natively; to emulate this allocate
a MAXPHYS bounce buffer to do the I/O and then memcpy() the data from/to
the segments as requested. If the request is contigous do the I/O
directly to the mapped VA.

This means that we need to keep segments details until iodone(); so move
the blkif_request_segment array from xbdback_instance to xbdback_io. The
array is allocated separately to guarantee proper page alignement.

non-contigous segments seems rare so allocate one bounce buffer per
xbdback_instance, and stall the ring if the bounce buffer is already in use.
For this add back a mechanism to restart an I/O at a specific point
after thread sleep/wakeup.

While there guard some more printfs with ratecheck() and add more checks on
segments bounds.

Tested with a HVM scientific linux install from iso image; the install would
fail with a xfs corruption when installing grub.

(Plus mostly cosmetic/minor changes.)


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

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

Modified files:

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.101.4.1 src/sys/arch/xen/xen/xbdback_xenbus.c:1.101.4.2
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.101.4.1	Mon Jul 31 15:23:02 2023
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Sat Jun 22 18:30:13 2024
@@ -1,7 +1,7 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.101.4.1 2023/07/31 15:23:02 martin Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.101.4.2 2024/06/22 18:30:13 martin Exp $  */
 
 /*
- * Copyright (c) 2006 Manuel Bouyer.
+ * Copyright (c) 2006,2024 Manuel Bouyer.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.101.4.1 2023/07/31 15:23:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.101.4.2 2024/06/22 18:30:13 martin Exp $");
 
 #include 
 #include 
@@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb
 #define VBD_MAXSECT ((PAGE_SIZE / VBD_BSIZE) - 1)
 
 #define VBD_VA_SIZE			MAXPHYS
-#define VBD_MAX_INDIRECT_SEGMENTS	VBD_VA_SIZE >> PAGE_SHIFT
+#define VBD_MAX_INDIRECT_SEGMENTS	(VBD_VA_SIZE >> PAGE_SHIFT)
 
 CTASSERT(XENSHM_MAX_PAGES_PER_REQUEST >= VBD_MAX_INDIRECT_SEGMENTS);
 
@@ -100,6 +100,10 @@ typedef enum {WAITING, RUN, DISCONNECTIN
  * condition before it starts processing requests again from where it left.
  * Continuation state is "stored" in the xbdback instance (xbdi_cont),
  * and should only be manipulated by the instance thread.
+ * If a continuation has to be restarted from a specific point,
+ * the callback and argument can be stored in xbdi_cont_restart and
+ * xbdi_cont_restart_obj
+ *
  *
  * As xbdback(4) has to handle different sort of asynchronous events (Xen
  * event channels, biointr() soft interrupts, xenbus commands), the xbdi_lock
@@ -111,9 +115,7 @@ typedef enum {WAITING, RUN, DISCONNECTIN
  * xbdback_co_main()
  *|   --> xbdback_co_cache_flush()
  *|   ||
- *|   |-> xbdback_co_cache_doflush() or NULL
- *|   ||
- *|   |-> xbdback_co_do_io()
+ *|   |-> xbdback_co_do_io() or NULL
  * xbdback_co_main_loop()-|
  *|   |-> xbdback_co_main_done2() or NULL
  *|   |
@@ -121,9 +123,7 @@ typedef enum {WAITING, RUN, DISCONNECTIN
  *|
  * xbdback_co_io() -> xbdback_co_main_incr() -> xbdback_co_main_loop()
  *|
- * xbdback_co_io_gotio() -> xbdback_map_shm()
- *| |
- *| xbdback_co_main_incr() -> xbdback_co_main_loop()
+ * xbdback_co_io_gotio() -> xbdback_co_main_incr() -> xbdback_co_main_loop()
  *|
  * xbdback_co_do_io()
  *|
@@ -152,8 +152,12 @@ struct xbdback_io {
 	SLIST_ENTRY(xbdback_io) xio_next;
 	/* The instance pointer is duplicated for convenience. */
 	struct xbd

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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 18:30:13 UTC 2024

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

Log Message:
Pull up the following, requested by bouyer in ticket #726:

sys/arch/xen/xen/xbdback_xenbus.c   upto 1.107

Restore "sparse" segements support which was lost in rev 1.83, causing
VBD corruption with linux guests.
The segments in a single request are not always contigous in VA; this means
that the end of a segment is not always 7 and the start of the next one is not
always 0. When this happens this means that a contigous chunk of data from
disk has to be dispatched to various non-contigous VA, in chunks of VBD_BSIZE
bytes (or the other way round for writes).
Linux I/O subsystems seems to support this natively; to emulate this allocate
a MAXPHYS bounce buffer to do the I/O and then memcpy() the data from/to
the segments as requested. If the request is contigous do the I/O
directly to the mapped VA.

This means that we need to keep segments details until iodone(); so move
the blkif_request_segment array from xbdback_instance to xbdback_io. The
array is allocated separately to guarantee proper page alignement.

non-contigous segments seems rare so allocate one bounce buffer per
xbdback_instance, and stall the ring if the bounce buffer is already in use.
For this add back a mechanism to restart an I/O at a specific point
after thread sleep/wakeup.

While there guard some more printfs with ratecheck() and add more checks on
segments bounds.

Tested with a HVM scientific linux install from iso image; the install would
fail with a xfs corruption when installing grub.

(Plus mostly cosmetic/minor changes.)


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

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



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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 09:57:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: coretemp.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #717):

sys/arch/x86/x86/coretemp.c: revision 1.40

sys/arch/x86/x86/coretemp.c: revision 1.41

coretemp.c: fix grammar in a warning message
(I get several of these warnings on boot on a particular machine. Now,
it also seems that the code isn't retrieving the correct value, either;
TBD.)

coretemp.c: don't accept impossibly low TjMax values
r. 1.39 introduced a regression where instead of applying a reasonable
default maximum (as was done prior to that change), incorrect values
were accepted and applied, as failures to retrieve an expected MSR
value weren't accounted for.

Apply different logic for unexpectedly low vs. high maximums, with
distinct warnings for each. Also add another warning about a retrieval
failure right at the outset (which also just uses the default, then).

This change fundamentally doesn't address the fact that
__SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT)
doesn't necessarily return a valid value. It just restores prior
behaviour, which is more reasonable than applying a zero value, which
started happening on some older hardware. (I infer this is most likely
an issue with dated generations of Intel hardware with this feature.)

The challenge is that this evidently isn't all documented properly
anywhere. Various "magic values" in this driver need further
investigation.

While here, also fix output so warnings are cleanly formatted, rather
than the slightly scrambled way they were appearing.

Tested on older Intel hardware I had on hand:
E7500 (now falls back to default 100 rather than 0)
E5540 (successfully retrieves 97, as before)
i5-3340M (successfully retrieves 105, as before)


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/arch/x86/x86/coretemp.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/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.38.4.1 src/sys/arch/x86/x86/coretemp.c:1.38.4.2
--- src/sys/arch/x86/x86/coretemp.c:1.38.4.1	Sat Jul 29 10:58:02 2023
+++ src/sys/arch/x86/x86/coretemp.c	Sat Jun 22 09:57:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.38.4.1 2023/07/29 10:58:02 martin Exp $ */
+/* $NetBSD: coretemp.c,v 1.38.4.2 2024/06/22 09:57:21 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.38.4.1 2023/07/29 10:58:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.38.4.2 2024/06/22 09:57:21 martin Exp $");
 
 #include 
 #include 
@@ -110,7 +110,7 @@ static int	coretemp_match(device_t, cfda
 static void	coretemp_attach(device_t, device_t, void *);
 static int	coretemp_detach(device_t, int);
 static int	coretemp_quirks(struct cpu_info *);
-static void	coretemp_tjmax(device_t);
+static int	coretemp_tjmax(device_t);
 static void	coretemp_refresh(struct sysmon_envsys *, envsys_data_t *);
 static void	coretemp_refresh_xcall(void *, void *);
 
@@ -194,9 +194,10 @@ coretemp_attach(device_t parent, device_
 	if (sysmon_envsys_register(sc->sc_sme) != 0)
 		goto fail;
 
-	coretemp_tjmax(self);
-	aprint_verbose(", Tjmax=%d", sc->sc_tjmax);
-	aprint_normal("\n");
+	if (coretemp_tjmax(self) == 0) {
+		aprint_verbose(", Tjmax=%d", sc->sc_tjmax);
+		aprint_normal("\n");
+	}
 	return;
 
 fail:
@@ -258,7 +259,7 @@ coretemp_quirks(struct cpu_info *ci)
 	return 1;
 }
 
-void
+static int
 coretemp_tjmax(device_t self)
 {
 	struct coretemp_softc *sc = device_private(self);
@@ -288,17 +289,19 @@ coretemp_tjmax(device_t self)
 		if ((model < 0x17) && ((msr & __BIT(28)) == 0))
 			goto notee;
 
-		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, &msr) == EFAULT)
-			return;
+		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, &msr) == EFAULT) {
+			aprint_normal("\n");
+			aprint_error_dev(sc->sc_dev,
+			"Failed to read MSR_IA32_EXT_CONFIG MSR. "
+			"Using default (%d)\n", sc->sc_tjmax);
+			return 1;
+		}
 
-		if ((msr & __BIT(30)) != 0) {
+		if ((msr & __BIT(30)) != 0)
 			sc->sc_tjmax = 85;
-			return;
-		}
 	} else if (model == 0x17 && stepping == 0x06) {
 		/* The mobile Penryn family. */
 		sc->sc_tjmax = 105;
-		return;
 	} else if (model == 0x1c) {
 		if (stepping == 0x0a) {
 			/* 45nm Atom D400, N400 and D500 series */
@@ -307,21 +310,39 @@ coretemp_tjmax(device_t self)
 			sc->sc_tjmax = 90;
 	} else {
 notee:
-		/* Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET. */
+		/* 
+		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET.
+		 * It is not fully known which CPU models have the MSR.
+		 */
 		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, &msr) == EFAULT) {
+			aprint_normal("\n");
 			aprint_error_dev(sc->sc_dev,
 			"Failed to read TEMPERATURE_TARGET MSR. "
-			"Use the default (%d)\

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

2024-06-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 22 09:57:21 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: coretemp.c

Log Message:
Pull up following revision(s) (requested by gutteridge in ticket #717):

sys/arch/x86/x86/coretemp.c: revision 1.40

sys/arch/x86/x86/coretemp.c: revision 1.41

coretemp.c: fix grammar in a warning message
(I get several of these warnings on boot on a particular machine. Now,
it also seems that the code isn't retrieving the correct value, either;
TBD.)

coretemp.c: don't accept impossibly low TjMax values
r. 1.39 introduced a regression where instead of applying a reasonable
default maximum (as was done prior to that change), incorrect values
were accepted and applied, as failures to retrieve an expected MSR
value weren't accounted for.

Apply different logic for unexpectedly low vs. high maximums, with
distinct warnings for each. Also add another warning about a retrieval
failure right at the outset (which also just uses the default, then).

This change fundamentally doesn't address the fact that
__SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT)
doesn't necessarily return a valid value. It just restores prior
behaviour, which is more reasonable than applying a zero value, which
started happening on some older hardware. (I infer this is most likely
an issue with dated generations of Intel hardware with this feature.)

The challenge is that this evidently isn't all documented properly
anywhere. Various "magic values" in this driver need further
investigation.

While here, also fix output so warnings are cleanly formatted, rather
than the slightly scrambled way they were appearing.

Tested on older Intel hardware I had on hand:
E7500 (now falls back to default 100 rather than 0)
E5540 (successfully retrieves 97, as before)
i5-3340M (successfully retrieves 105, as before)


To generate a diff of this commit:
cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/arch/x86/x86/coretemp.c

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



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

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

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

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

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.38 -r1.38.4.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.34 -r1.34.4.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.38 src/sys/arch/mac68k/dev/aed.c:1.38.4.1
--- src/sys/arch/mac68k/dev/aed.c:1.38	Sun Sep 26 16:36:18 2021
+++ src/sys/arch/mac68k/dev/aed.c	Thu Jun 20 18:15:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.38 2021/09/26 16:36:18 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.38.4.1 2024/06/20 18:15:15 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.38 2021/09/26 16:36:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.38.4.1 2024/06/20 18:15:15 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.34 src/sys/arch/macppc/dev/aed.c:1.34.4.1
--- src/sys/arch/macppc/dev/aed.c:1.34	Sun Sep 26 16:36:19 2021
+++ src/sys/arch/macppc/dev/aed.c	Thu Jun 20 18:15:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: aed.c,v 1.34 2021/09/26 16:36:19 thorpej Exp $	*/
+/*	$NetBSD: aed.c,v 1.34.4.1 2024/06/20 18:15:15 martin Exp $	*/
 
 /*
  * Copyright (C) 1994	Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34 2021/09/26 16:36:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.34.4.1 2024/06/20 18:15:15 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-10] src/sys/arch

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

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

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

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.38 -r1.38.4.1 src/sys/arch/mac68k/dev/aed.c
cvs rdiff -u -r1.34 -r1.34.4.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-10] src/sys/arch/macppc/macppc

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

Modified Files:
src/sys/arch/macppc/macppc [netbsd-10]: mainbus.c

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

sys/arch/macppc/macppc/mainbus.c: revision 1.26

check for proper error value from OF_finddevice()

should fix PR57394


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/macppc/macppc/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/macppc/macppc/mainbus.c
diff -u src/sys/arch/macppc/macppc/mainbus.c:1.25 src/sys/arch/macppc/macppc/mainbus.c:1.25.4.1
--- src/sys/arch/macppc/macppc/mainbus.c:1.25	Sat Jan 22 11:49:16 2022
+++ src/sys/arch/macppc/macppc/mainbus.c	Thu Jun 20 18:11:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.25.4.1 2024/06/20 18:11:53 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2022/01/22 11:49:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25.4.1 2024/06/20 18:11:53 martin Exp $");
 
 #include 
 #include 
@@ -76,7 +76,13 @@ mainbus_attach(device_t parent, device_t
 	devhandle_t selfh = device_handle(self);
 
 	cpus = OF_finddevice("/cpus");
-	if (cpus != 0) {
+	/*
+	 * XXX
+	 * the canonical error value is -1 but I dimly remember some OF
+	 * variants returning 0 here, so check for both just in case.
+	 * It's not like this is a performance critical path.
+	 */
+	if ((cpus != -1) && (cpus != 0)) {
 		node = OF_child(cpus);
 		while (node != 0) {
 			ca.ca_name = "cpu";



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

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

Modified Files:
src/sys/arch/macppc/macppc [netbsd-10]: mainbus.c

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

sys/arch/macppc/macppc/mainbus.c: revision 1.26

check for proper error value from OF_finddevice()

should fix PR57394


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/macppc/macppc/mainbus.c

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



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 11:02:17 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: fpu.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #701):

sys/arch/x86/x86/fpu.c: revision 1.88

Workaround panic: fpudna from userland

i386 Xen PV domU get spurious fpudna traps from userland. Older eager FPU
contact switching code took care of ignoring them. When transitioning
from eager switching to awlays switching, this special handling was
removed, causing "fpudna from userland" panics.

This change restores the previosu behavior where fpudna traps from
userland are ignored on Xen PV domU.


To generate a diff of this commit:
cvs rdiff -u -r1.79.4.2 -r1.79.4.3 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.79.4.2 src/sys/arch/x86/x86/fpu.c:1.79.4.3
--- src/sys/arch/x86/x86/fpu.c:1.79.4.2	Tue Jul 25 11:41:42 2023
+++ src/sys/arch/x86/x86/fpu.c	Thu Jun 20 11:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.79.4.2 2023/07/25 11:41:42 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.2 2023/07/25 11:41:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -603,6 +603,15 @@ fputrap(struct trapframe *frame)
 void
 fpudna(struct trapframe *frame)
 {
+#ifdef XENPV
+	/*
+	 * Xen produes spurious fpudna traps, just do nothing.
+	 */
+	if (USERMODE(frame->tf_cs)) {
+		clts();
+		return;
+	} 
+#endif
 	panic("fpudna from %s, ip %p, trapframe %p",
 	USERMODE(frame->tf_cs) ? "userland" : "kernel",
 	(void *)X86_TF_RIP(frame), frame);



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

2024-06-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jun 20 11:02:17 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: fpu.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #701):

sys/arch/x86/x86/fpu.c: revision 1.88

Workaround panic: fpudna from userland

i386 Xen PV domU get spurious fpudna traps from userland. Older eager FPU
contact switching code took care of ignoring them. When transitioning
from eager switching to awlays switching, this special handling was
removed, causing "fpudna from userland" panics.

This change restores the previosu behavior where fpudna traps from
userland are ignored on Xen PV domU.


To generate a diff of this commit:
cvs rdiff -u -r1.79.4.2 -r1.79.4.3 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-10] src/sys/arch/sgimips/sgimips

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 18:05:30 UTC 2024

Modified Files:
src/sys/arch/sgimips/sgimips [netbsd-10]: machdep.c

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

sys/arch/sgimips/sgimips/machdep.c: revision 1.155

sgimips: call mips_vector_init earlier to fix boot.

PR port-sgimips/58269


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.152.4.1 src/sys/arch/sgimips/sgimips/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/sgimips/sgimips/machdep.c
diff -u src/sys/arch/sgimips/sgimips/machdep.c:1.152 src/sys/arch/sgimips/sgimips/machdep.c:1.152.4.1
--- src/sys/arch/sgimips/sgimips/machdep.c:1.152	Thu Aug 12 20:53:18 2021
+++ src/sys/arch/sgimips/sgimips/machdep.c	Mon Jun 17 18:05:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.152 2021/08/12 20:53:18 andvar Exp $	*/
+/*	$NetBSD: machdep.c,v 1.152.4.1 2024/06/17 18:05:30 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152 2021/08/12 20:53:18 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152.4.1 2024/06/17 18:05:30 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -286,6 +286,13 @@ mach_init(int argc, int32_t argv32[], ui
 
 	cpu_setmodel("%s", arcbios_system_identifier);
 
+	/*
+	 * Copy exception-dispatch code down to exception vector.
+	 * Initialize locore-function vector.
+	 * Clear out the I and D caches.
+	 */
+	mips_vector_init(NULL, false);
+
 	uvm_md_init();
 
 	/* set up bootinfo structures */
@@ -662,13 +669,6 @@ mach_init(int argc, int32_t argv32[], ui
 	arcbios_tree_walk(sgimips_count_cpus, NULL);
 
 	/*
-	 * Copy exception-dispatch code down to exception vector.
-	 * Initialize locore-function vector.
-	 * Clear out the I and D caches.
-	 */
-	mips_vector_init(NULL, false);
-
-	/*
 	 * Initialize error message buffer (at end of core).
 	 */
 	mips_init_msgbuf();



CVS commit: [netbsd-10] src/sys/arch/sgimips/sgimips

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 18:05:30 UTC 2024

Modified Files:
src/sys/arch/sgimips/sgimips [netbsd-10]: machdep.c

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

sys/arch/sgimips/sgimips/machdep.c: revision 1.155

sgimips: call mips_vector_init earlier to fix boot.

PR port-sgimips/58269


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.152.4.1 src/sys/arch/sgimips/sgimips/machdep.c

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



CVS commit: [netbsd-10] src/sys/arch/evbarm/conf

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:55:34 UTC 2024

Modified Files:
src/sys/arch/evbarm/conf [netbsd-10]: GENERIC64

Log Message:
Pull up following revision(s) (requested by nia in ticket #698):

sys/arch/evbarm/conf/GENERIC64: revision 1.216

Add some "simpler" PCI audio devices to aarch64's GENERIC64

These serve as alternatives to hdaudio.  Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.206.2.3 -r1.206.2.4 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-10] src/sys/arch/evbarm/conf

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 17:55:34 UTC 2024

Modified Files:
src/sys/arch/evbarm/conf [netbsd-10]: GENERIC64

Log Message:
Pull up following revision(s) (requested by nia in ticket #698):

sys/arch/evbarm/conf/GENERIC64: revision 1.216

Add some "simpler" PCI audio devices to aarch64's GENERIC64

These serve as alternatives to hdaudio.  Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.206.2.3 -r1.206.2.4 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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.206.2.3 src/sys/arch/evbarm/conf/GENERIC64:1.206.2.4
--- src/sys/arch/evbarm/conf/GENERIC64:1.206.2.3	Sat Oct 14 06:43:06 2023
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Jun 17 17:55:34 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.206.2.3 2023/10/14 06:43:06 martin Exp $
+#	$NetBSD: GENERIC64,v 1.206.2.4 2024/06/17 17:55:34 martin Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -440,6 +440,8 @@ vcaudio0 	at vchiq?
 # Audio support
 hdaudio*	at fdt?			# Intel HDA
 hdaudio*	at pci? dev ? function ?
+auich*		at pci? dev ? function ?	# Intel AC'97 Audio (QEMU)
+eap*		at pci? dev ? function ?	# Ensoniq AudioPCI (QEMU)
 hdafg*		at hdaudiobus?
 options 	HDAUDIOVERBOSE
 ausoc*		at fdt?			# Simple SoC audio card



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:48:57 UTC 2024

Modified Files:
src/sys/arch/vax/include [netbsd-10]: mcontext.h
src/sys/arch/vax/vax [netbsd-10]: machdep.c sig_machdep.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #694):

sys/arch/vax/vax/sig_machdep.c: revision 1.27
sys/arch/vax/include/mcontext.h: revision 1.11
sys/arch/vax/vax/machdep.c: revision 1.200

Implement _UC_SETSTACK / _UC_CLRSTACK.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.26.1 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.196.20.2 -r1.196.20.3 src/sys/arch/vax/vax/machdep.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/vax/vax/sig_machdep.c

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



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:48:57 UTC 2024

Modified Files:
src/sys/arch/vax/include [netbsd-10]: mcontext.h
src/sys/arch/vax/vax [netbsd-10]: machdep.c sig_machdep.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #694):

sys/arch/vax/vax/sig_machdep.c: revision 1.27
sys/arch/vax/include/mcontext.h: revision 1.11
sys/arch/vax/vax/machdep.c: revision 1.200

Implement _UC_SETSTACK / _UC_CLRSTACK.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.26.1 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.196.20.2 -r1.196.20.3 src/sys/arch/vax/vax/machdep.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/vax/vax/sig_machdep.c

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

Modified files:

Index: src/sys/arch/vax/include/mcontext.h
diff -u src/sys/arch/vax/include/mcontext.h:1.10 src/sys/arch/vax/include/mcontext.h:1.10.26.1
--- src/sys/arch/vax/include/mcontext.h:1.10	Fri Dec 27 00:32:17 2019
+++ src/sys/arch/vax/include/mcontext.h	Mon Jun 17 16:48:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.10.26.1 2024/06/17 16:48:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,9 @@ typedef struct {
 } mcontext_t;
 
 /* Machine-dependent uc_flags */
-#define _UC_TLSBASE	0x0008
+#define	_UC_SETSTACK	0x0001
+#define	_UC_CLRSTACK	0x0002
+#define	_UC_TLSBASE	0x0008
 
 #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_SP])
 #define	_UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[_REG_FP])

Index: src/sys/arch/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.196.20.2 src/sys/arch/vax/vax/machdep.c:1.196.20.3
--- src/sys/arch/vax/vax/machdep.c:1.196.20.2	Sat Feb 17 15:50:20 2024
+++ src/sys/arch/vax/vax/machdep.c	Mon Jun 17 16:48:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.196.20.2 2024/02/17 15:50:20 martin Exp $	 */
+/* $NetBSD: machdep.c,v 1.196.20.3 2024/06/17 16:48:57 martin Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196.20.2 2024/02/17 15:50:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196.20.3 2024/06/17 16:48:57 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -701,6 +701,14 @@ cpu_setmcontext(struct lwp *l, const mco
 		lwp_setprivate(l, tlsbase);
 		tf->tf_sp += sizeof(tlsbase);
 	}
+
+	mutex_enter(l->l_proc->p_lock);
+	if (flags & _UC_SETSTACK)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	if (flags & _UC_CLRSTACK)
+		l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+	mutex_exit(l->l_proc->p_lock);
+
 	return 0;
 }
 

Index: src/sys/arch/vax/vax/sig_machdep.c
diff -u src/sys/arch/vax/vax/sig_machdep.c:1.26 src/sys/arch/vax/vax/sig_machdep.c:1.26.4.1
--- src/sys/arch/vax/vax/sig_machdep.c:1.26	Mon Nov  1 05:07:16 2021
+++ src/sys/arch/vax/vax/sig_machdep.c	Mon Jun 17 16:48:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.26 2021/11/01 05:07:16 thorpej Exp $	 */
+/* $NetBSD: sig_machdep.c,v 1.26.4.1 2024/06/17 16:48:57 martin Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.26 2021/11/01 05:07:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.26.4.1 2024/06/17 16:48:57 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -171,6 +171,8 @@ setupstack_siginfo3(const struct ksiginf
 	uc.uc_flags = _UC_SIGMASK;
 	uc.uc_sigmask = *mask;
 	uc.uc_link = l->l_ctxlink;
+	uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+	? _UC_SETSTACK : _UC_CLRSTACK;
 	sendsig_reset(l, ksi->ksi_signo);
 	mutex_exit(p->p_lock);
 	cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:41:50 UTC 2024

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-10]: autoconf.c

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

sys/arch/hp300/hp300/autoconf.c: revision 1.113

Fix a 20 years old botch by me in setbootdev() on switching to MI SCSI.
setbootdev() updates bootdev data shared between BOOTROM and
it notifies BOOTROM to choose a current root device as a boot device
on the next boot, but I didn't understand the intention and then
it has been broken on SCSI disks. Sigh.

(I wonder if no one has noticed this old feature for 20 years..)


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.6.1 src/sys/arch/hp300/hp300/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/hp300/hp300/autoconf.c
diff -u src/sys/arch/hp300/hp300/autoconf.c:1.110 src/sys/arch/hp300/hp300/autoconf.c:1.110.6.1
--- src/sys/arch/hp300/hp300/autoconf.c:1.110	Sat Aug  7 16:18:53 2021
+++ src/sys/arch/hp300/hp300/autoconf.c	Mon Jun 17 16:41:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.110 2021/08/07 16:18:53 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.110.6.1 2024/06/17 16:41:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.110 2021/08/07 16:18:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.110.6.1 2024/06/17 16:41:50 martin Exp $");
 
 #include "dvbox.h"
 #include "gbox.h"
@@ -652,10 +652,9 @@ setbootdev(void)
 	 */
 	switch (type) {
 	case 2: /* rd */
-	case 4: /* sd */
 		/*
 		 * "rd" -> "hpibbus" -> "fhpib"
-		 * "sd" -> "scsibus" -> "spc"
+		 * "rd" -> "hpibbus" -> "nhpib"
 		 */
 		for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0;
 		cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
@@ -671,6 +670,24 @@ setbootdev(void)
 			}
 		}
 		break;
+	case 4: /* sd */
+		/*
+		 * "sd" -> "scsibus" -> "spc"
+		 */
+		for (cdd = LIST_FIRST(&dev_data_list_scsi), ctlr = 0;
+		cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
+			if (cdd->dd_dev ==
+			device_parent(device_parent(root_device))) {
+/*
+ * Found it!
+ */
+bootdev = MAKEBOOTDEV(type,
+ctlr, dd->dd_slave, dd->dd_punit,
+DISKPART(rootdev));
+break;
+			}
+		}
+		break;
 	}
 
  out:



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

2024-06-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 17 16:41:50 UTC 2024

Modified Files:
src/sys/arch/hp300/hp300 [netbsd-10]: autoconf.c

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

sys/arch/hp300/hp300/autoconf.c: revision 1.113

Fix a 20 years old botch by me in setbootdev() on switching to MI SCSI.
setbootdev() updates bootdev data shared between BOOTROM and
it notifies BOOTROM to choose a current root device as a boot device
on the next boot, but I didn't understand the intention and then
it has been broken on SCSI disks. Sigh.

(I wonder if no one has noticed this old feature for 20 years..)


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.6.1 src/sys/arch/hp300/hp300/autoconf.c

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



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

2024-05-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 16 12:29:12 UTC 2024

Modified Files:
src/sys/arch/i386/conf [netbsd-10]: LEGACY

Log Message:
Pull up following revision(s) (requested by nia in ticket #691):

sys/arch/i386/conf/LEGACY: revision 1.4

also exclude DRM_LEGACY from the ISA kernel


To generate a diff of this commit:
cvs rdiff -u -r1.1.54.1 -r1.1.54.2 src/sys/arch/i386/conf/LEGACY

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



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

2024-05-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 16 12:29:12 UTC 2024

Modified Files:
src/sys/arch/i386/conf [netbsd-10]: LEGACY

Log Message:
Pull up following revision(s) (requested by nia in ticket #691):

sys/arch/i386/conf/LEGACY: revision 1.4

also exclude DRM_LEGACY from the ISA kernel


To generate a diff of this commit:
cvs rdiff -u -r1.1.54.1 -r1.1.54.2 src/sys/arch/i386/conf/LEGACY

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

Modified files:

Index: src/sys/arch/i386/conf/LEGACY
diff -u src/sys/arch/i386/conf/LEGACY:1.1.54.1 src/sys/arch/i386/conf/LEGACY:1.1.54.2
--- src/sys/arch/i386/conf/LEGACY:1.1.54.1	Sat May 11 14:31:56 2024
+++ src/sys/arch/i386/conf/LEGACY	Thu May 16 12:29:11 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: LEGACY,v 1.1.54.1 2024/05/11 14:31:56 martin Exp $
+#	$NetBSD: LEGACY,v 1.1.54.2 2024/05/16 12:29:11 martin Exp $
 
 # LEGACY kernel -- includes vga@isa and pcdisplay@isa for pre-PCI
 # systems, due to significant pain making them fail to attach when
@@ -21,3 +21,5 @@ no radeondrmkmsfb*	at radeonfbbus?  
 
 no nouveau*		at pci?
 no nouveaufb*		at nouveaufbbus?
+
+no options		DRM_LEGACY



CVS commit: [netbsd-10] src/sys/arch/mac68k/dev

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:46:26 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-10]: pm_direct.c

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

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/mac68k/dev/pm_direct.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/pm_direct.c
diff -u src/sys/arch/mac68k/dev/pm_direct.c:1.30 src/sys/arch/mac68k/dev/pm_direct.c:1.30.4.1
--- src/sys/arch/mac68k/dev/pm_direct.c:1.30	Sat Aug 21 11:55:24 2021
+++ src/sys/arch/mac68k/dev/pm_direct.c	Sat May 11 14:46:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm_direct.c,v 1.30 2021/08/21 11:55:24 andvar Exp $	*/
+/*	$NetBSD: pm_direct.c,v 1.30.4.1 2024/05/11 14:46:26 martin Exp $	*/
 
 /*
  * Copyright (C) 1997 Takashi Hamada
@@ -32,7 +32,7 @@
 /* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.30 2021/08/21 11:55:24 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.30.4.1 2024/05/11 14:46:26 martin Exp $");
 
 #include "opt_adb.h"
 
@@ -562,6 +562,7 @@ pm_intr_pm1(void *arg)
 			printf("pm: PM is not ready. error code=%08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	if ((pmdata.data[2] & 0x10) == 0x10) {
@@ -821,6 +822,7 @@ pm_intr_pm2(void *arg)
 			printf("pm: PM is not ready. error code: %08x\n", rval);
 #endif
 		splx(s);
+		return;
 	}
 
 	switch ((u_int)(pmdata.data[2] & 0xff)) {



CVS commit: [netbsd-10] src/sys/arch/mac68k/dev

2024-05-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 11 14:46:26 UTC 2024

Modified Files:
src/sys/arch/mac68k/dev [netbsd-10]: pm_direct.c

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

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/mac68k/dev/pm_direct.c

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



CVS commit: [netbsd-10] src/sys/arch/hp300/stand/common

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

Modified Files:
src/sys/arch/hp300/stand/common [netbsd-10]: if_le.c

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

sys/arch/hp300/stand/common/if_le.c: revision 1.15
sys/arch/hp300/stand/common/if_le.c: revision 1.16

Avoid an extern declaration in .c file.  Just declare it as static.
Suggested on tech-userlevel@.

Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/hp300/stand/common/if_le.c

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



CVS commit: [netbsd-10] src/sys/arch/hp300/stand/common

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

Modified Files:
src/sys/arch/hp300/stand/common [netbsd-10]: if_le.c

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

sys/arch/hp300/stand/common/if_le.c: revision 1.15
sys/arch/hp300/stand/common/if_le.c: revision 1.16

Avoid an extern declaration in .c file.  Just declare it as static.
Suggested on tech-userlevel@.

Don't panic as a fatal error on receiving packets with invalid length.

Such errors could happen on aged and fragile 10BASE-2 hub etc.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/hp300/stand/common/if_le.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/stand/common/if_le.c
diff -u src/sys/arch/hp300/stand/common/if_le.c:1.14 src/sys/arch/hp300/stand/common/if_le.c:1.14.2.1
--- src/sys/arch/hp300/stand/common/if_le.c:1.14	Mon Nov 21 15:36:29 2022
+++ src/sys/arch/hp300/stand/common/if_le.c	Sat May 11 14:43:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.14 2022/11/21 15:36:29 tsutsui Exp $	*/
+/*	$NetBSD: if_le.c,v 1.14.2.1 2024/05/11 14:43:00 martin Exp $	*/
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -98,7 +98,7 @@ static struct le_sel le0conf[] = {
 };
 #define NLE0CONF (sizeof(le0conf) / sizeof(le0conf[0]))
 
-extern struct netif_stats	le_stats[];
+static struct netif_stats	le_stats[];
 
 static struct netif_dif le_ifs[] = {
 /*	dif_unit	dif_nsel	dif_stats	dif_private	*/
@@ -106,7 +106,7 @@ static struct netif_dif le_ifs[] = {
 };
 #define NLE_IFS (sizeof(le_ifs) / sizeof(le_ifs[0]))
 
-struct netif_stats le_stats[NLE_IFS];
+static struct netif_stats le_stats[NLE_IFS];
 
 struct netif_driver le_driver = {
 	"le",			/* netif_bname */
@@ -492,8 +492,9 @@ le_poll(struct iodesc *desc, void *pkt, 
 		printf("le_poll: length %d\n", length);
 #endif
 	if (length >= BUFSIZE) {
+		printf("le%d_poll: invalid length %d, status 0x%x\n",
+		unit, length, stat);
 		length = 0;
-		panic("csr0 when bad things happen: %x", stat);
 		goto cleanup;
 	}
 	if (!length)



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

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

Modified Files:
src/sys/arch/hp300/stand/inst [netbsd-10]: Makefile
src/sys/arch/hp300/stand/uboot [netbsd-10]: Makefile

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

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.26.1 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/hp300/stand/uboot/Makefile

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

Modified files:

Index: src/sys/arch/hp300/stand/inst/Makefile
diff -u src/sys/arch/hp300/stand/inst/Makefile:1.10 src/sys/arch/hp300/stand/inst/Makefile:1.10.26.1
--- src/sys/arch/hp300/stand/inst/Makefile:1.10	Mon Sep 23 13:42:36 2019
+++ src/sys/arch/hp300/stand/inst/Makefile	Sat May 11 14:38:40 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2019/09/23 13:42:36 christos Exp $
+#	$NetBSD: Makefile,v 1.10.26.1 2024/05/11 14:38:40 martin Exp $
 
 PROGAOUT=	inst
 PROGSOURCE=	inst.c
@@ -6,16 +6,14 @@ NEWVERSWHAT=	"Miniroot Installer"
 
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_INST
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL} ${COPY} -m 444 -o ${BINOWN} -g ${BINGRP} ${INSTPRIV} \
-	inst.lif ${DESTDIR}${BINDIR}/inst.lif
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_INST
-	ln ${DESTDIR}${BINDIR}/inst.lif ${DESTDIR}${BINDIR}/rbootd/SYS_INST
 
-release: check_RELEASEDIR .WAIT inst.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} inst.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc/SYS_INST

Index: src/sys/arch/hp300/stand/uboot/Makefile
diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.10 src/sys/arch/hp300/stand/uboot/Makefile:1.10.2.1
--- src/sys/arch/hp300/stand/uboot/Makefile:1.10	Sun Dec 11 07:41:37 2022
+++ src/sys/arch/hp300/stand/uboot/Makefile	Sat May 11 14:38:40 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2022/12/11 07:41:37 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.10.2.1 2024/05/11 14:38:40 martin Exp $
 
 PROGAOUT=	uboot
 PROGSOURCE=	uboot.c tgets.c
@@ -7,28 +7,20 @@ NEWVERSWHAT=	"Primary Boot"
 CPPFLAGS+=	-DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK
 CPPFLAGS+=	-DSUPPORT_UFS2
 
+LINKS=	${BINDIR}/${PROG} ${BINDIR}/rdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootrd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/sdboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootsd
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/ctboot
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/bootct
+LINKS+=	${BINDIR}/${PROG} ${BINDIR}/rbootd/SYS_UBOOT
+
 .include "../Makefile.buildboot"
 
-install:
+beforeinstall:
 	${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 \
 	${DESTDIR}${BINDIR}/rbootd
-	${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
-	uboot.lif ${DESTDIR}${BINDIR}/uboot.lif
-	rm -f ${DESTDIR}${BINDIR}/rdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rdboot
-	rm -f ${DESTDIR}${BINDIR}/bootrd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootrd
-	rm -f ${DESTDIR}${BINDIR}/sdboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/sdboot
-	rm -f ${DESTDIR}${BINDIR}/bootsd
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootsd
-	rm -f ${DESTDIR}${BINDIR}/ctboot
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/ctboot
-	rm -f ${DESTDIR}${BINDIR}/bootct
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/bootct
-	rm -f ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
-	ln ${DESTDIR}${BINDIR}/uboot.lif ${DESTDIR}${BINDIR}/rbootd/SYS_UBOOT
 
-release: check_RELEASEDIR .WAIT uboot.lif
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} uboot.lif \
+release: check_RELEASEDIR .WAIT ${PROG}
+	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc/SYS_UBOOT



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

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

Modified Files:
src/sys/arch/hp300/stand/inst [netbsd-10]: Makefile
src/sys/arch/hp300/stand/uboot [netbsd-10]: Makefile

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

sys/arch/hp300/stand/uboot/Makefile: revision 1.11
sys/arch/hp300/stand/inst/Makefile: revision 1.11

Use LINKS to create hard links to generate proper METALOG files.

Also use the default ${PROG} variable and "install" target.

Fixes PR port-hp300/58211.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.26.1 src/sys/arch/hp300/stand/inst/Makefile
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/hp300/stand/uboot/Makefile

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



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

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

Modified Files:
src/sys/arch/aarch64/include [netbsd-10]: sljit_machdep.h

Log Message:
Additionally pull up the following, to fix 32bit compat compilation after
ticket #655, requested by riastradh:

sys/arch/aarch64/include/sljit_machdep.h1.5

aarch64/sljit_machdep.h: Make this work in compat32 context.


To generate a diff of this commit:
cvs rdiff -u -r1.3.18.1 -r1.3.18.2 \
src/sys/arch/aarch64/include/sljit_machdep.h

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

Modified files:

Index: src/sys/arch/aarch64/include/sljit_machdep.h
diff -u src/sys/arch/aarch64/include/sljit_machdep.h:1.3.18.1 src/sys/arch/aarch64/include/sljit_machdep.h:1.3.18.2
--- src/sys/arch/aarch64/include/sljit_machdep.h:1.3.18.1	Thu Apr 18 15:21:55 2024
+++ src/sys/arch/aarch64/include/sljit_machdep.h	Sat May 11 14:08:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sljit_machdep.h,v 1.3.18.1 2024/04/18 15:21:55 martin Exp $	*/
+/*	$NetBSD: sljit_machdep.h,v 1.3.18.2 2024/05/11 14:08:32 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 Alexander Nasonov.
@@ -29,6 +29,12 @@
 #ifndef _AARCH64_SLJITARCH_H
 #define _AARCH64_SLJITARCH_H
 
+#ifndef __aarch64__		/* compat32 */
+
+#include 
+
+#else  /* __aarch64__ */
+
 #include 
 
 #ifdef _KERNEL
@@ -56,4 +62,6 @@
 	(void)__builtin___clear_cache((char *)(from), (char *)(to))
 #endif
 
-#endif
+#endif	/* __aarch64__ (vs compat32) */
+
+#endif	/* _AARCH64_SLJITARCH_H */



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

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

Modified Files:
src/sys/arch/aarch64/include [netbsd-10]: sljit_machdep.h

Log Message:
Additionally pull up the following, to fix 32bit compat compilation after
ticket #655, requested by riastradh:

sys/arch/aarch64/include/sljit_machdep.h1.5

aarch64/sljit_machdep.h: Make this work in compat32 context.


To generate a diff of this commit:
cvs rdiff -u -r1.3.18.1 -r1.3.18.2 \
src/sys/arch/aarch64/include/sljit_machdep.h

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



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

2024-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 19 09:15:55 UTC 2024

Modified Files:
src/sys/arch/vax/vax [netbsd-10]: unimpl_emul.S

Log Message:
Pull up following revision(s) (requested by kalvisd in ticket #670):

sys/arch/vax/vax/unimpl_emul.S: revision 1.5

vax/unimpl_emul.S: Initialise locations storing floating-point values with
a constant of the appropriate format


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.40.1 src/sys/arch/vax/vax/unimpl_emul.S

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



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

2024-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr 19 09:15:55 UTC 2024

Modified Files:
src/sys/arch/vax/vax [netbsd-10]: unimpl_emul.S

Log Message:
Pull up following revision(s) (requested by kalvisd in ticket #670):

sys/arch/vax/vax/unimpl_emul.S: revision 1.5

vax/unimpl_emul.S: Initialise locations storing floating-point values with
a constant of the appropriate format


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.40.1 src/sys/arch/vax/vax/unimpl_emul.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/vax/vax/unimpl_emul.S
diff -u src/sys/arch/vax/vax/unimpl_emul.S:1.4 src/sys/arch/vax/vax/unimpl_emul.S:1.4.40.1
--- src/sys/arch/vax/vax/unimpl_emul.S:1.4	Mon May 22 16:53:05 2017
+++ src/sys/arch/vax/vax/unimpl_emul.S	Fri Apr 19 09:15:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: unimpl_emul.S,v 1.4 2017/05/22 16:53:05 ragge Exp $	*/
+/*	$NetBSD: unimpl_emul.S,v 1.4.40.1 2024/04/19 09:15:55 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Brandon Creighton.  All rights reserved.
@@ -683,7 +683,7 @@ emodd:	bsbw	touser
 	 * there aren't any bits left for the fraction.  Therefore we're
 	 * done here;  TMPFRAC1 is equal to TMPFRACTGT and TMPFRAC2 is 0.
 	 */
-	movq $0f0.0, TMPFRAC2
+	movq $0d0.0, TMPFRAC2
 	jmp 9f		/* we're done, move on */
 1:	
 	/*
@@ -727,7 +727,7 @@ emodd:	bsbw	touser
 	 * We are less than 1.0; TMPFRAC1 should be 0, and TMPFRAC2 should
 	 * be equal to TMPFRACTGT.
 	 */
-	movd $0f0.0, TMPFRAC1
+	movd $0d0.0, TMPFRAC1
 	movd TMPFRACTGT, TMPFRAC2
 9:			
 	/*
@@ -763,7 +763,7 @@ zeroexit:
 	bsbw getaddr_byte
 	movl $0x0, (%r0)
 	bsbw getaddr_byte
-	movd $0f0, (%r0)
+	movd $0d0, (%r0)
 	brw goback
 
 



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 18:17:06 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-10]: cpu_machdep.c sig_machdep.c

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

sys/arch/aarch64/aarch64/sig_machdep.c: revision 1.9
sys/arch/aarch64/aarch64/cpu_machdep.c: revision 1.15

kern/58149: aarch64: Cannot return from a signal handler if SP was
misaligned when the signal arrived

Apply the kernel diff from the PR
1. sendsig_siginfo() previously assumed that user SP was always aligned to
16 bytes and could call signal handlers with SP misaligned. This is a
wrong assumption because aarch64 demands that SP is aligned *only while*
it's being used to access memory. Now it properly aligns it before
pusing anything on the stack.
2. cpu_mcontext_validate() used to check if _REG_SP was aligned and
considered the ucontext invalid otherwise. This meant if a signal was
sent to a process whose SP was misaligned, the signal handler would fail
to return because the ucontext passed from the kernel was an invalid
one. Now setcontext(2) doesn't complain about misaligned SP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/arch/aarch64/aarch64/sig_machdep.c

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



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 18:17:06 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64 [netbsd-10]: cpu_machdep.c sig_machdep.c

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

sys/arch/aarch64/aarch64/sig_machdep.c: revision 1.9
sys/arch/aarch64/aarch64/cpu_machdep.c: revision 1.15

kern/58149: aarch64: Cannot return from a signal handler if SP was
misaligned when the signal arrived

Apply the kernel diff from the PR
1. sendsig_siginfo() previously assumed that user SP was always aligned to
16 bytes and could call signal handlers with SP misaligned. This is a
wrong assumption because aarch64 demands that SP is aligned *only while*
it's being used to access memory. Now it properly aligns it before
pusing anything on the stack.
2. cpu_mcontext_validate() used to check if _REG_SP was aligned and
considered the ucontext invalid otherwise. This meant if a signal was
sent to a process whose SP was misaligned, the signal handler would fail
to return because the ucontext passed from the kernel was an invalid
one. Now setcontext(2) doesn't complain about misaligned SP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/arch/aarch64/aarch64/sig_machdep.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.13 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.13.4.1
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.13	Thu Jul 28 09:14:12 2022
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c	Thu Apr 18 18:17:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.13.4.1 2024/04/18 18:17:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.13.4.1 2024/04/18 18:17:06 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -156,9 +156,13 @@ dosoftints(void)
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
+	/*
+	 * We intentionally don't verify that _REG_SP is aligned to
+	 * 16-bytes boundaries because it can be legally misaligned as long
+	 * as it's not used for accessing memory.
+	 */
 	if ((mcp->__gregs[_REG_SPSR] & ~SPSR_NZCV)
-	|| (mcp->__gregs[_REG_PC] & 3)
-	|| (mcp->__gregs[_REG_SP] & 15))
+	|| (mcp->__gregs[_REG_PC] & 3))
 		return EINVAL;
 
 	return 0;

Index: src/sys/arch/aarch64/aarch64/sig_machdep.c
diff -u src/sys/arch/aarch64/aarch64/sig_machdep.c:1.8 src/sys/arch/aarch64/aarch64/sig_machdep.c:1.8.4.1
--- src/sys/arch/aarch64/aarch64/sig_machdep.c:1.8	Mon Nov  1 05:07:15 2021
+++ src/sys/arch/aarch64/aarch64/sig_machdep.c	Thu Apr 18 18:17:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.8 2021/11/01 05:07:15 thorpej Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.8.4.1 2024/04/18 18:17:06 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.8 2021/11/01 05:07:15 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.8.4.1 2024/04/18 18:17:06 martin Exp $");
 
 #include 
 #include 
@@ -58,8 +58,14 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 
 	vaddr_t sp;
 
-	sp = onstack_p ? ((vaddr_t)ss->ss_sp + ss->ss_size) & -16 : tf->tf_sp;
+	/*
+	 * The user stack isn't guaranteed to be aligned to 16 bytes. Align
+	 * it before pushing anything onto it.
+	 */
+	sp = onstack_p ? ((vaddr_t)ss->ss_sp + ss->ss_size) : tf->tf_sp;
+	sp &= -16;
 
+	__CTASSERT(sizeof(ucontext_t) % 16 == 0);
 	sp -= sizeof(ucontext_t);
 	const vaddr_t ucp = sp;
 



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 18:14:22 UTC 2024

Modified Files:
src/sys/arch/arm/arm32 [netbsd-10]: pmap.c

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

sys/arch/arm/arm32/pmap.c: revision 1.443

port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.437.4.3 -r1.437.4.4 src/sys/arch/arm/arm32/pmap.c

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



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 18:14:22 UTC 2024

Modified Files:
src/sys/arch/arm/arm32 [netbsd-10]: pmap.c

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

sys/arch/arm/arm32/pmap.c: revision 1.443

port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.437.4.3 -r1.437.4.4 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.437.4.3 src/sys/arch/arm/arm32/pmap.c:1.437.4.4
--- src/sys/arch/arm/arm32/pmap.c:1.437.4.3	Thu Dec 14 17:43:10 2023
+++ src/sys/arch/arm/arm32/pmap.c	Thu Apr 18 18:14:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.437.4.3 2023/12/14 17:43:10 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.437.4.4 2024/04/18 18:14:22 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.437.4.3 2023/12/14 17:43:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.437.4.4 2024/04/18 18:14:22 martin Exp $");
 
 #include 
 #include 
@@ -2330,15 +2330,10 @@ pmap_clearbit(struct vm_page_md *md, pad
 #ifdef PMAP_CACHE_VIPT
 	const bool want_syncicache = PV_IS_EXEC_P(md->pvh_attrs);
 	bool need_syncicache = false;
-#ifdef ARM_MMU_EXTENDED
-	const u_int execbits = (maskbits & PVF_EXEC) ? L2_XS_XN : 0;
-#else
-	const u_int execbits = 0;
+#ifndef ARM_MMU_EXTENDED
 	bool need_vac_me_harder = false;
 #endif
-#else
-	const u_int execbits = 0;
-#endif
+#endif /* PMAP_CACHE_VIPT */
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, "md %#jx pa %#jx maskbits %#jx",
@@ -2421,9 +2416,14 @@ pmap_clearbit(struct vm_page_md *md, pad
 
 		pt_entry_t * const ptep = &l2b->l2b_kva[l2pte_index(va)];
 		const pt_entry_t opte = *ptep;
-		pt_entry_t npte = opte | execbits;
+		pt_entry_t npte = opte;
+
+#if defined(ARM_MMU_EXTENDED)
+		if ((maskbits & PVF_EXEC) != 0 && l2pte_valid_p(opte)) {
+			KASSERT((opte & L2_TYPE_S) != 0);
+			npte |= L2_XS_XN;
+		}
 
-#ifdef ARM_MMU_EXTENDED
 		KASSERT((opte & L2_XS_nG) == (pm == pmap_kernel() ? 0 : L2_XS_nG));
 #endif
 



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:39:08 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: viac7temp.c

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

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/viac7temp.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/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.9 src/sys/arch/x86/x86/viac7temp.c:1.9.4.1
--- src/sys/arch/x86/x86/viac7temp.c:1.9	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/viac7temp.c	Thu Apr 18 16:39:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.9 2021/10/07 12:52:27 msaitoh Exp $ */
+/* $NetBSD: viac7temp.c,v 1.9.4.1 2024/04/18 16:39:08 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.9 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.9.4.1 2024/04/18 16:39:08 martin Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 27315;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



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

2024-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 18 16:39:08 UTC 2024

Modified Files:
src/sys/arch/x86/x86 [netbsd-10]: viac7temp.c

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

sys/arch/x86/x86/viac7temp.c: revision 1.10

viac7temp(4): define module metadata using MODULE() macro and implement
viac7temp_modcmd() to handle module load/unload events.

Fixes PR kern/58148. Look OK by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/viac7temp.c

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



CVS commit: [netbsd-10] src/sys/arch/alpha/pci

2024-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 16 19:10:07 UTC 2024

Modified Files:
src/sys/arch/alpha/pci [netbsd-10]: irongate_pci.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #652):

sys/arch/alpha/pci/irongate_pci.c: revision 1.13

Add a missing barrier in irongate_conf_read0().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/alpha/pci/irongate_pci.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/alpha/pci/irongate_pci.c
diff -u src/sys/arch/alpha/pci/irongate_pci.c:1.12 src/sys/arch/alpha/pci/irongate_pci.c:1.12.10.1
--- src/sys/arch/alpha/pci/irongate_pci.c:1.12	Fri Jun 25 03:45:59 2021
+++ src/sys/arch/alpha/pci/irongate_pci.c	Tue Apr 16 19:10:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $ */
+/* $NetBSD: irongate_pci.c,v 1.12.10.1 2024/04/16 19:10:07 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.12.10.1 2024/04/16 19:10:07 martin Exp $");
 
 #include 
 #include 
@@ -106,6 +106,7 @@ irongate_conf_read0(void *ipv, pcitag_t 
 	REGVAL(PCI_CONF_ADDR) = (CONFADDR_ENABLE | tag | (offset & 0xff));
 	alpha_mb();
 	data = REGVAL(PCI_CONF_DATA);
+	alpha_mb();
 	REGVAL(PCI_CONF_ADDR) = 0;
 	alpha_mb();
 	PCI_CONF_UNLOCK(s);



CVS commit: [netbsd-10] src/sys/arch/alpha/pci

2024-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 16 19:10:07 UTC 2024

Modified Files:
src/sys/arch/alpha/pci [netbsd-10]: irongate_pci.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #652):

sys/arch/alpha/pci/irongate_pci.c: revision 1.13

Add a missing barrier in irongate_conf_read0().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/alpha/pci/irongate_pci.c

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



CVS commit: [netbsd-10] src/sys/arch/evbarm/conf

2024-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 25 15:53:06 UTC 2024

Modified Files:
src/sys/arch/evbarm/conf [netbsd-10]: std.bcm53xx

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

sys/arch/evbarm/conf/std.bcm53xx: revision 1.22

Add ARM_HAS_VBAR


To generate a diff of this commit:
cvs rdiff -u -r1.20.28.1 -r1.20.28.2 src/sys/arch/evbarm/conf/std.bcm53xx

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



CVS commit: [netbsd-10] src/sys/arch/evbarm/conf

2024-02-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 25 15:53:06 UTC 2024

Modified Files:
src/sys/arch/evbarm/conf [netbsd-10]: std.bcm53xx

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

sys/arch/evbarm/conf/std.bcm53xx: revision 1.22

Add ARM_HAS_VBAR


To generate a diff of this commit:
cvs rdiff -u -r1.20.28.1 -r1.20.28.2 src/sys/arch/evbarm/conf/std.bcm53xx

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/std.bcm53xx
diff -u src/sys/arch/evbarm/conf/std.bcm53xx:1.20.28.1 src/sys/arch/evbarm/conf/std.bcm53xx:1.20.28.2
--- src/sys/arch/evbarm/conf/std.bcm53xx:1.20.28.1	Sun Feb 18 16:19:56 2024
+++ src/sys/arch/evbarm/conf/std.bcm53xx	Sun Feb 25 15:53:06 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: std.bcm53xx,v 1.20.28.1 2024/02/18 16:19:56 martin Exp $
+#	$NetBSD: std.bcm53xx,v 1.20.28.2 2024/02/25 15:53:06 martin Exp $
 #
 # standard NetBSD/evbarm for BCM5301X options
 
@@ -9,6 +9,7 @@ include 	"arch/evbarm/conf/std.evbarm"
 include		"arch/evbarm/conf/files.bcm53xx"
 
 options 	ARM_GENERIC_TODR
+options 	ARM_HAS_VBAR
 options 	ARM_INTR_IMPL=""
 options 	COM_TOLERANCE=40
 options 	CORTEX_PMC



CVS commit: [netbsd-10] src/sys/arch/evbarm

2024-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 24 13:10:18 UTC 2024

Modified Files:
src/sys/arch/evbarm/kobo [netbsd-10]: kobo_usb.c
src/sys/arch/evbarm/netwalker [netbsd-10]: netwalker_usb.c

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

sys/arch/evbarm/netwalker/netwalker_usb.c: revision 1.9
sys/arch/evbarm/kobo/kobo_usb.c: revision 1.4

sc_init_md_hook expects two params since interface change in imxusbvar.h rev 1.7
thus adjust kobo_usb_init() and netwalker_usb_init() functions accordingly.

Fixes build for KOBO and NETWALKER(_MD) kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.28.1 src/sys/arch/evbarm/kobo/kobo_usb.c
cvs rdiff -u -r1.8 -r1.8.24.1 src/sys/arch/evbarm/netwalker/netwalker_usb.c

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



CVS commit: [netbsd-10] src/sys/arch/evbarm

2024-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 24 13:10:18 UTC 2024

Modified Files:
src/sys/arch/evbarm/kobo [netbsd-10]: kobo_usb.c
src/sys/arch/evbarm/netwalker [netbsd-10]: netwalker_usb.c

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

sys/arch/evbarm/netwalker/netwalker_usb.c: revision 1.9
sys/arch/evbarm/kobo/kobo_usb.c: revision 1.4

sc_init_md_hook expects two params since interface change in imxusbvar.h rev 1.7
thus adjust kobo_usb_init() and netwalker_usb_init() functions accordingly.

Fixes build for KOBO and NETWALKER(_MD) kernel configs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.28.1 src/sys/arch/evbarm/kobo/kobo_usb.c
cvs rdiff -u -r1.8 -r1.8.24.1 src/sys/arch/evbarm/netwalker/netwalker_usb.c

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

Modified files:

Index: src/sys/arch/evbarm/kobo/kobo_usb.c
diff -u src/sys/arch/evbarm/kobo/kobo_usb.c:1.3 src/sys/arch/evbarm/kobo/kobo_usb.c:1.3.28.1
--- src/sys/arch/evbarm/kobo/kobo_usb.c:1.3	Wed Jul 24 11:20:55 2019
+++ src/sys/arch/evbarm/kobo/kobo_usb.c	Sat Feb 24 13:10:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobo_usb.c,v 1.3 2019/07/24 11:20:55 hkenken Exp $	*/
+/*	$NetBSD: kobo_usb.c,v 1.3.28.1 2024/02/24 13:10:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.3 2019/07/24 11:20:55 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.3.28.1 2024/02/24 13:10:18 martin Exp $");
 
 #include "opt_imx.h"
 
@@ -64,7 +64,7 @@ struct kobo_usbc_softc {
 
 static int	imxusbc_match(device_t, cfdata_t, void *);
 static void	imxusbc_attach(device_t, device_t, void *);
-static void	kobo_usb_init(struct imxehci_softc *);
+static void	kobo_usb_init(struct imxehci_softc *, uintptr_t);
 
 static void	init_otg(struct imxehci_softc *);
 static void	init_h1(struct imxehci_softc *);
@@ -105,7 +105,7 @@ imxusbc_attach(device_t parent, device_t
 }
 
 static void
-kobo_usb_init(struct imxehci_softc *sc)
+kobo_usb_init(struct imxehci_softc *sc, uintptr_t data)
 {
 	switch (sc->sc_unit) {
 	case 0:	/* OTG controller */

Index: src/sys/arch/evbarm/netwalker/netwalker_usb.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.8 src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.8.24.1
--- src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.8	Wed Jan 15 10:25:47 2020
+++ src/sys/arch/evbarm/netwalker/netwalker_usb.c	Sat Feb 24 13:10:18 2024
@@ -25,7 +25,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.8 2020/01/15 10:25:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.8.24.1 2024/02/24 13:10:18 martin Exp $");
 
 #include "locators.h"
 
@@ -61,7 +61,7 @@ struct netwalker_usbc_softc {
 
 static int	imxusbc_match(device_t, cfdata_t, void *);
 static void	imxusbc_attach(device_t, device_t, void *);
-static void	netwalker_usb_init(struct imxehci_softc *);
+static void	netwalker_usb_init(struct imxehci_softc *, uintptr_t);
 
 static void	init_otg(struct imxehci_softc *);
 static void	init_h1(struct imxehci_softc *);
@@ -103,7 +103,7 @@ imxusbc_attach(device_t parent, device_t
 }
 
 static void
-netwalker_usb_init(struct imxehci_softc *sc)
+netwalker_usb_init(struct imxehci_softc *sc, uintptr_t data)
 {
 	switch (sc->sc_unit) {
 	case 0:	/* OTG controller */



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

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

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

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

sys/arch/vax/vsa/vsbus.c: revision 1.69
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.50 -r1.50.22.1 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.68 -r1.68.2.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.50 src/sys/arch/vax/vsa/ncr.c:1.50.22.1
--- src/sys/arch/vax/vsa/ncr.c:1.50	Sun Mar 22 20:27:47 2020
+++ src/sys/arch/vax/vsa/ncr.c	Mon Feb 19 08:58:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.50 2020/03/22 20:27:47 ragge Exp $	*/
+/*	$NetBSD: ncr.c,v 1.50.22.1 2024/02/19 08:58:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.50 2020/03/22 20:27:47 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.50.22.1 2024/02/19 08:58:58 martin Exp $");
 
 #include 
 #include 
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.50
 #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.68 src/sys/arch/vax/vsa/vsbus.c:1.68.2.1
--- src/sys/arch/vax/vsa/vsbus.c:1.68	Mon Dec 12 18:22:32 2022
+++ src/sys/arch/vax/vsa/vsbus.c	Mon Feb 19 08:58:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsbus.c,v 1.68 2022/12/12 18:22:32 jakllsch Exp $ */
+/*	$NetBSD: vsbus.c,v 1.68.2.1 2024/02/19 08:58:58 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.68 2022/12/12 18:22:32 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.68.2.1 2024/02/19 08:58:58 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;
-			*(volatile 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-10] src/sys/arch/vax/vsa

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

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

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

sys/arch/vax/vsa/vsbus.c: revision 1.69
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.50 -r1.50.22.1 src/sys/arch/vax/vsa/ncr.c
cvs rdiff -u -r1.68 -r1.68.2.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-10] src/sys/arch/arm/broadcom

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:25:25 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm53xx_eth.c

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

sys/arch/arm/broadcom/bcm53xx_eth.c: revision 1.44

Test sc->sc_soft_ih (not sc->sc_ih) to see if the soft interrupt got
established correctly.

 From Mori Hiroki.

Fix some error recovery while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.1 -r1.42.4.2 src/sys/arch/arm/broadcom/bcm53xx_eth.c

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



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

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:25:25 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm53xx_eth.c

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

sys/arch/arm/broadcom/bcm53xx_eth.c: revision 1.44

Test sc->sc_soft_ih (not sc->sc_ih) to see if the soft interrupt got
established correctly.

 From Mori Hiroki.

Fix some error recovery while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.42.4.1 -r1.42.4.2 src/sys/arch/arm/broadcom/bcm53xx_eth.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/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42.4.1 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42.4.2
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42.4.1	Sun Feb 18 16:19:57 2024
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Sun Feb 18 16:25:25 2024
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.42.4.1 2024/02/18 16:19:57 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.42.4.2 2024/02/18 16:25:25 martin Exp $");
 
 #include 
 #include 
@@ -344,16 +344,15 @@ bcmeth_ccb_attach(device_t parent, devic
 	(PRI_USER + MAXPRI_USER) / 2, IPL_NET, WQ_MPSAFE|WQ_PERCPU);
 	if (error) {
 		aprint_error(": failed to create workqueue: %d\n", error);
-		goto fail_2;
+		goto fail_1;
 	}
 
 	sc->sc_soft_ih = softint_establish(SOFTINT_MPSAFE | SOFTINT_NET,
 	bcmeth_soft_intr, sc);
 
-	if (sc->sc_ih == NULL) {
-		aprint_error_dev(self, "failed to establish interrupt %d\n",
-		 loc->loc_intrs[0]);
-		goto fail_3;
+	if (sc->sc_soft_ih == NULL) {
+		aprint_error_dev(self, "failed to establish soft interrupt\n");
+		goto fail_2;
 	}
 
 	sc->sc_ih = intr_establish(loc->loc_intrs[0], IPL_VM, IST_LEVEL,
@@ -362,7 +361,7 @@ bcmeth_ccb_attach(device_t parent, devic
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
 		 loc->loc_intrs[0]);
-		goto fail_4;
+		goto fail_3;
 	} else {
 		aprint_normal_dev(self, "interrupting on irq %d\n",
 		 loc->loc_intrs[0]);
@@ -426,8 +425,6 @@ bcmeth_ccb_attach(device_t parent, devic
 
 	return;
 
-fail_4:
-	intr_disestablish(sc->sc_ih);
 fail_3:
 	softint_disestablish(sc->sc_soft_ih);
 fail_2:



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

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:19:57 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm53xx_eth.c bcm53xx_pax.c
src/sys/arch/evbarm/conf [netbsd-10]: std.bcm53xx

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

sys/arch/evbarm/conf/std.bcm53xx: revision 1.21
sys/arch/arm/broadcom/bcm53xx_eth.c: revision 1.43
sys/arch/arm/broadcom/bcm53xx_pax.c: revision 1.23

Define KERNEL_VOFFSET_RUNTIME=1 to fix build of BCM5301X and BCM56340

Fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.22.6.1 -r1.22.6.2 src/sys/arch/arm/broadcom/bcm53xx_pax.c
cvs rdiff -u -r1.20 -r1.20.28.1 src/sys/arch/evbarm/conf/std.bcm53xx

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/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42.4.1
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42	Sat Sep 17 19:41:18 2022
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Sun Feb 18 16:19:57 2024
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.42 2022/09/17 19:41:18 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.42.4.1 2024/02/18 16:19:57 martin Exp $");
 
 #include 
 #include 
@@ -252,9 +252,7 @@ bcmeth_ccb_match(device_t parent, cfdata
 	if (strcmp(cf->cf_name, loc->loc_name))
 		return 0;
 
-#ifdef DIAGNOSTIC
-	const int port = cf->cf_loc[BCMCCBCF_PORT];
-#endif
+	const int port __diagused = cf->cf_loc[BCMCCBCF_PORT];
 	KASSERT(port == BCMCCBCF_PORT_DEFAULT || port == loc->loc_port);
 
 	return 1;

Index: src/sys/arch/arm/broadcom/bcm53xx_pax.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.22.6.1 src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.22.6.2
--- src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.22.6.1	Fri Feb 16 12:07:08 2024
+++ src/sys/arch/arm/broadcom/bcm53xx_pax.c	Sun Feb 18 16:19:57 2024
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.22.6.1 2024/02/16 12:07:08 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.22.6.2 2024/02/18 16:19:57 martin Exp $");
 
 #include 
 #include 
@@ -136,9 +136,7 @@ bcmpax_ccb_match(device_t parent, cfdata
 	if (strcmp(cf->cf_name, loc->loc_name))
 		return 0;
 
-#ifdef DIAGNOSTIC
-	const int port = cf->cf_loc[BCMCCBCF_PORT];
-#endif
+	const int port __diagused = cf->cf_loc[BCMCCBCF_PORT];
 	KASSERT(port == BCMCCBCF_PORT_DEFAULT || port == loc->loc_port);
 
 	return 1;

Index: src/sys/arch/evbarm/conf/std.bcm53xx
diff -u src/sys/arch/evbarm/conf/std.bcm53xx:1.20 src/sys/arch/evbarm/conf/std.bcm53xx:1.20.28.1
--- src/sys/arch/evbarm/conf/std.bcm53xx:1.20	Sat May 18 08:49:23 2019
+++ src/sys/arch/evbarm/conf/std.bcm53xx	Sun Feb 18 16:19:56 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: std.bcm53xx,v 1.20 2019/05/18 08:49:23 skrll Exp $
+#	$NetBSD: std.bcm53xx,v 1.20.28.1 2024/02/18 16:19:56 martin Exp $
 #
 # standard NetBSD/evbarm for BCM5301X options
 
@@ -28,5 +28,10 @@ options 	__HAVE_PCI_CONF_HOOK
 
 makeoptions	BOARDMKFRAG="${THISARM}/conf/mk.bcm53xx"
 makeoptions	BOARDTYPE="bcm53xx"
+
+# Prevent the addition of a command line -DKERNEL_BASE_VOFFSET= as it
+# is done at runtime.
+makeoptions	KERNEL_VOFFSET_RUNTIME=1
+
 makeoptions	KERNEL_BASE_VIRT="0x8010"
 makeoptions	LOADADDRESS="0x0010"



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

2024-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 18 16:19:57 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm53xx_eth.c bcm53xx_pax.c
src/sys/arch/evbarm/conf [netbsd-10]: std.bcm53xx

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

sys/arch/evbarm/conf/std.bcm53xx: revision 1.21
sys/arch/arm/broadcom/bcm53xx_eth.c: revision 1.43
sys/arch/arm/broadcom/bcm53xx_pax.c: revision 1.23

Define KERNEL_VOFFSET_RUNTIME=1 to fix build of BCM5301X and BCM56340

Fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.22.6.1 -r1.22.6.2 src/sys/arch/arm/broadcom/bcm53xx_pax.c
cvs rdiff -u -r1.20 -r1.20.28.1 src/sys/arch/evbarm/conf/std.bcm53xx

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



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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 16:02:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev [netbsd-10]: dino.c elroy.c
src/sys/arch/hppa/hppa [netbsd-10]: mainbus.c
src/sys/arch/hppa/include [netbsd-10]: bus_defs.h bus_funcs.h

Log Message:
Pull up following revision(s) (requested by macallan in ticket #592):

sys/arch/hppa/hppa/mainbus.c: revision 1.13
sys/arch/hppa/dev/elroy.c: revision 1.7
sys/arch/hppa/dev/dino.c: revision 1.17
sys/arch/hppa/include/bus_funcs.h: revision 1.2
sys/arch/hppa/include/bus_defs.h: revision 1.3

add missing bus_space_*_stream() methods instead of quietly aliasing them
to their potentially byte-swapping regular counterparts

ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/hppa/dev/dino.c
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/hppa/dev/elroy.c
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.2 -r1.2.26.1 src/sys/arch/hppa/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.1.66.1 src/sys/arch/hppa/include/bus_funcs.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/dev/dino.c
diff -u src/sys/arch/hppa/dev/dino.c:1.16 src/sys/arch/hppa/dev/dino.c:1.16.4.1
--- src/sys/arch/hppa/dev/dino.c:1.16	Thu Sep 29 06:39:58 2022
+++ src/sys/arch/hppa/dev/dino.c	Sat Feb 17 16:02:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dino.c,v 1.16 2022/09/29 06:39:58 skrll Exp $ */
+/*	$NetBSD: dino.c,v 1.16.4.1 2024/02/17 16:02:22 martin Exp $ */
 
 /*	$OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.16 2022/09/29 06:39:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.16.4.1 2024/02/17 16:02:22 martin Exp $");
 
 /* #include "cardbus.h" */
 
@@ -177,10 +177,16 @@ uint8_t dino_r1(void *, bus_space_handle
 uint16_t dino_r2(void *, bus_space_handle_t, bus_size_t);
 uint32_t dino_r4(void *, bus_space_handle_t, bus_size_t);
 uint64_t dino_r8(void *, bus_space_handle_t, bus_size_t);
+uint16_t dino_rs2(void *, bus_space_handle_t, bus_size_t);
+uint32_t dino_rs4(void *, bus_space_handle_t, bus_size_t);
+uint64_t dino_rs8(void *, bus_space_handle_t, bus_size_t);
 void dino_w1(void *, bus_space_handle_t, bus_size_t, uint8_t);
 void dino_w2(void *, bus_space_handle_t, bus_size_t, uint16_t);
 void dino_w4(void *, bus_space_handle_t, bus_size_t, uint32_t);
 void dino_w8(void *, bus_space_handle_t, bus_size_t, uint64_t);
+void dino_ws2(void *, bus_space_handle_t, bus_size_t, uint16_t);
+void dino_ws4(void *, bus_space_handle_t, bus_size_t, uint32_t);
+void dino_ws8(void *, bus_space_handle_t, bus_size_t, uint64_t);
 void dino_rm_1(void *, bus_space_handle_t, bus_size_t, uint8_t *, bus_size_t);
 void dino_rm_2(void *, bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t);
 void dino_rm_4(void *, bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t);
@@ -413,7 +419,7 @@ dino_intr_map(const struct pci_attach_ar
 	if (line == 0xff)
 		return 1;
 
-	*ihp = line;
+	*ihp = line ;
 
 	return 0;
 }
@@ -695,6 +701,59 @@ dino_r8(void *v, bus_space_handle_t h, b
 	return le64toh(data);
 }
 
+uint16_t
+dino_rs2(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	volatile uint16_t *p;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		p = (volatile uint16_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		p = (volatile uint16_t *)&r->pci_io_data;
+		if (h & 2)
+			p++;
+	}
+	return *p;
+}
+
+uint32_t
+dino_rs4(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	uint32_t data;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		data = *(volatile uint32_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		data = r->pci_io_data;
+	}
+
+	return data;
+}
+
+uint64_t
+dino_rs8(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	uint64_t data;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		data = *(volatile uint64_t *)h;
+	else
+		panic("dino_r8: not implemented");
+
+	return data;
+}
+
 void
 dino_w1(void *v, bus_space_handle_t h, bus_size_t o, uint8_t vv)
 {
@@ -757,6 +816,51 @@ dino_w8(void *v, bus_space_handle_t h, b
 		panic("dino_w8: not implemented");
 }
 
+void
+dino_ws2(void *v, bus_space_handle_t h, bus_size_t o, uint16_t vv)
+{
+	volatile uint16_t *p;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		p = (volatile uint16_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		p = (volatile uint16_t *)&r->pci_io_data;
+		if (h & 2)
+			p++;
+	}
+
+	*p = vv;
+}
+
+void
+dino_ws4(void *v, bus_space_handle_t h, bus_size_t o, uint32_t vv)
+{
+	h += o;
+	if (h & HPPA_IOSPACE)
+		*(volatile uint32_t *)h = vv;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		r->pci_io_da

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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 16:02:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev [netbsd-10]: dino.c elroy.c
src/sys/arch/hppa/hppa [netbsd-10]: mainbus.c
src/sys/arch/hppa/include [netbsd-10]: bus_defs.h bus_funcs.h

Log Message:
Pull up following revision(s) (requested by macallan in ticket #592):

sys/arch/hppa/hppa/mainbus.c: revision 1.13
sys/arch/hppa/dev/elroy.c: revision 1.7
sys/arch/hppa/dev/dino.c: revision 1.17
sys/arch/hppa/include/bus_funcs.h: revision 1.2
sys/arch/hppa/include/bus_defs.h: revision 1.3

add missing bus_space_*_stream() methods instead of quietly aliasing them
to their potentially byte-swapping regular counterparts

ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/hppa/dev/dino.c
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/hppa/dev/elroy.c
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.2 -r1.2.26.1 src/sys/arch/hppa/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.1.66.1 src/sys/arch/hppa/include/bus_funcs.h

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



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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 15:50:20 UTC 2024

Modified Files:
src/sys/arch/vax/vax [netbsd-10]: machdep.c

Log Message:
Pull up following revision(s) (requested by hans in ticket #590):

sys/arch/vax/vax/machdep.c: revision 1.197

Include leds.h to make /dev/leds work.


To generate a diff of this commit:
cvs rdiff -u -r1.196.20.1 -r1.196.20.2 src/sys/arch/vax/vax/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/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.196.20.1 src/sys/arch/vax/vax/machdep.c:1.196.20.2
--- src/sys/arch/vax/vax/machdep.c:1.196.20.1	Sun Jan 14 18:05:57 2024
+++ src/sys/arch/vax/vax/machdep.c	Sat Feb 17 15:50:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.196.20.1 2024/01/14 18:05:57 martin Exp $	 */
+/* $NetBSD: machdep.c,v 1.196.20.2 2024/02/17 15:50:20 martin Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196.20.1 2024/01/14 18:05:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196.20.2 2024/02/17 15:50:20 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -130,6 +130,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #endif
 
+#include "leds.h"
 #include "smg.h"
 #include "ksyms.h"
 



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

2024-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb 17 15:50:20 UTC 2024

Modified Files:
src/sys/arch/vax/vax [netbsd-10]: machdep.c

Log Message:
Pull up following revision(s) (requested by hans in ticket #590):

sys/arch/vax/vax/machdep.c: revision 1.197

Include leds.h to make /dev/leds work.


To generate a diff of this commit:
cvs rdiff -u -r1.196.20.1 -r1.196.20.2 src/sys/arch/vax/vax/machdep.c

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



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 12:08:02 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm2835_bsc.c bcm2835_vcaudio.c
bcm2838_pcie.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.22.1 src/sys/arch/arm/broadcom/bcm2835_bsc.c
cvs rdiff -u -r1.18 -r1.18.16.1 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/broadcom/bcm2838_pcie.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/broadcom/bcm2835_bsc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.15 src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.15.22.1
--- src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.15	Tue Mar 31 12:23:17 2020
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c	Fri Feb 16 12:08:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_bsc.c,v 1.15.22.1 2024/02/16 12:08:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 2019 Jason R. Thorpe
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.15.22.1 2024/02/16 12:08:02 skrll Exp $");
 
 #include 
 #include 
@@ -203,7 +203,7 @@ bsciic_next_state(struct bsciic_softc * 
 	case BSC_EXEC_STATE_SEND_DATA:
 	case BSC_EXEC_STATE_RECV_DATA:
 		return BSC_EXEC_STATE_DONE;
-	
+
 	case BSC_EXEC_STATE_DONE:
 	case BSC_EXEC_STATE_ERROR:
 		return sc->sc_exec_state;

Index: src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.18 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.18.16.1
--- src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.18	Sat Apr 24 23:36:26 2021
+++ src/sys/arch/arm/broadcom/bcm2835_vcaudio.c	Fri Feb 16 12:08:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_vcaudio.c,v 1.18 2021/04/24 23:36:26 thorpej Exp $ */
+/* $NetBSD: bcm2835_vcaudio.c,v 1.18.16.1 2024/02/16 12:08:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.18 2021/04/24 23:36:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.18.16.1 2024/02/16 12:08:02 skrll Exp $");
 
 #include 
 #include 
@@ -88,7 +88,7 @@ enum vcaudio_dest {
  *
  * Setting blocksize to 4 x 1600 means that we send approx 33ms of audio. We
  * prefill by two blocks before starting audio meaning we have 50ms of latency.
- * 
+ *
  * Six messages of 1600 bytes was chosen working back from a desired latency of
  * 50ms.
  */

Index: src/sys/arch/arm/broadcom/bcm2838_pcie.c
diff -u src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.6 src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.6.2.1
--- src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.6	Sat Oct 15 11:07:38 2022
+++ src/sys/arch/arm/broadcom/bcm2838_pcie.c	Fri Feb 16 12:08:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $ */
+/*	$NetBSD: bcm2838_pcie.c,v 1.6.2.1 2024/02/16 12:08:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.6.2.1 2024/02/16 12:08:02 skrll Exp $");
 
 #include 
 #include 
@@ -417,7 +417,7 @@ bcmstb_setwin(struct bcmstb_softc *sc, i
 	STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI(win),
 	PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE,
 	__SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE));
-	
+
 	STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI(win),
 	PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT,
 	__SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT));



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 12:08:02 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom [netbsd-10]: bcm2835_bsc.c bcm2835_vcaudio.c
bcm2838_pcie.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.22.1 src/sys/arch/arm/broadcom/bcm2835_bsc.c
cvs rdiff -u -r1.18 -r1.18.16.1 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/broadcom/bcm2838_pcie.c

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



  1   2   3   4   >