CVS commit: src/sys/dev/dm

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:56:53 UTC 2024

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
Avoid leaving a configured device without resources.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/dm/dm_ioctl.c

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

Modified files:

Index: src/sys/dev/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.56 src/sys/dev/dm/dm_ioctl.c:1.57
--- src/sys/dev/dm/dm_ioctl.c:1.56	Thu Oct 13 06:10:48 2022
+++ src/sys/dev/dm/dm_ioctl.c	Sun Jan 14 07:56:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.56 2022/10/13 06:10:48 andvar Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.57 2024/01/14 07:56:53 mlelstv Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.56 2022/10/13 06:10:48 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.57 2024/01/14 07:56:53 mlelstv Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -209,18 +209,21 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 		dm_dev_unbusy(dmv);
 		return EEXIST;
 	}
+
+	if ((dmv = dm_dev_alloc()) == NULL)
+		return ENOMEM;
+
 	cf = kmem_alloc(sizeof(*cf), KM_SLEEP);
 	cf->cf_name = dm_cd.cd_name;
 	cf->cf_atname = dm_ca.ca_name;
 	cf->cf_unit = atomic_inc_32_nv(_minor_num);
 	cf->cf_fstate = FSTATE_NOTFOUND;
 	if ((devt = config_attach_pseudo(cf)) == NULL) {
+		dm_dev_free(dmv);
 		kmem_free(cf, sizeof(*cf));
 		aprint_error("Unable to attach pseudo device dm/%s\n", name);
 		return (ENOMEM);
 	}
-	if ((dmv = dm_dev_alloc()) == NULL)
-		return ENOMEM;
 
 	if (uuid)
 		strncpy(dmv->uuid, uuid, DM_UUID_LEN);
@@ -247,7 +250,7 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 
 	prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
 
-	disk_init(dmv->diskp, dmv->name, );
+	disk_init(dmv->diskp, device_xname(devt), );
 	disk_attach(dmv->diskp);
 
 	dmv->diskp->dk_info = NULL;



CVS commit: src/sys/dev/dm

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:56:53 UTC 2024

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
Avoid leaving a configured device without resources.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/dm/dm_ioctl.c

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



CVS commit: src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 14 07:55:48 UTC 2024

Modified Files:
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive:
jh7100-common.dtsi

Log Message:
The dr_node should be a property of usb_cdns3 and not usb3 for jh7100.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi

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

Modified files:

Index: src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi
diff -u src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi:1.1 src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi:1.2
--- src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi:1.1	Sun Jan 14 07:39:25 2024
+++ src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi	Sun Jan 14 07:55:48 2024
@@ -606,6 +606,9 @@
 };
 
  {
-	dr_mode = "host";
 	status = "okay";
 };
+
+_cdns3 {
+	dr_mode = "host";
+};



CVS commit: src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 14 07:55:48 UTC 2024

Modified Files:
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive:
jh7100-common.dtsi

Log Message:
The dr_node should be a property of usb_cdns3 and not usb3 for jh7100.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi

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



CVS commit: src/sys/dev/fdt

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:53:38 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_memory.c

Log Message:
Handle multiple memory nodes by type, but still allow an untyped
(non-standard) node named /memory.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.c

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



CVS commit: src/sys/dev/fdt

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:53:38 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_memory.c

Log Message:
Handle multiple memory nodes by type, but still allow an untyped
(non-standard) node named /memory.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.c

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

Modified files:

Index: src/sys/dev/fdt/fdt_memory.c
diff -u src/sys/dev/fdt/fdt_memory.c:1.9 src/sys/dev/fdt/fdt_memory.c:1.10
--- src/sys/dev/fdt/fdt_memory.c:1.9	Fri Jan 12 18:06:18 2024
+++ src/sys/dev/fdt/fdt_memory.c	Sun Jan 14 07:53:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $");
 
 #include 
 #include 
@@ -77,26 +77,43 @@ fdt_memory_range_free(struct fdt_memory_
 void
 fdt_memory_get(uint64_t *pstart, uint64_t *pend)
 {
-	const int memory = OF_finddevice("/memory");
+	const void *fdt_data = fdtbus_get_data();
 	uint64_t cur_addr, cur_size;
-	int index, nadd;
+	int index, nadd = 0, off, memory;
 
-	for (index = 0, nadd = 0;
-	 fdtbus_get_reg64(memory, index, _addr, _size) == 0;
-	 index++) {
-		if (cur_size == 0)
-			continue;
-		fdt_memory_add_range(cur_addr, cur_size);
+	off = fdt_node_offset_by_prop_value(fdt_data, -1,
+	"device_type", "memory", sizeof("memory"));
 
-		if (nadd++ == 0) {
-			*pstart = cur_addr;
-			*pend = cur_addr + cur_size;
-			continue;
+	/*
+	 * Device Tree Specification 3.2 says that memory
+	 * nodes are named "memory" and have device_type
+	 * "memory", but if the device_type is missing, try
+	 * to find the (then single) node by name.
+	 */
+	if (off == -FDT_ERR_NOTFOUND)
+		off = fdt_path_offset(fdt_data, "/memory");
+
+	while (off != -FDT_ERR_NOTFOUND) {
+		memory = fdtbus_offset2phandle(off);
+		for (index = 0;
+		 fdtbus_get_reg64(memory, index, _addr, _size) == 0;
+		 index++) {
+			if (cur_size == 0)
+continue;
+			fdt_memory_add_range(cur_addr, cur_size);
+
+			if (nadd++ == 0) {
+*pstart = cur_addr;
+*pend = cur_addr + cur_size;
+continue;
+			}
+			if (cur_addr < *pstart)
+*pstart = cur_addr;
+			if (cur_addr + cur_size > *pend)
+*pend = cur_addr + cur_size;
 		}
-		if (cur_addr < *pstart)
-			*pstart = cur_addr;
-		if (cur_addr + cur_size > *pend)
-			*pend = cur_addr + cur_size;
+		off = fdt_node_offset_by_prop_value(fdt_data, off,
+		"device_type", "memory", sizeof("memory"));
 	}
 	if (nadd == 0)
 		panic("Cannot determine memory size");



CVS commit: src

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 14 07:39:27 UTC 2024

Modified Files:
src/distrib/sets/lists/dtb: ad.riscv32 ad.riscv64
src/sys/dtb/riscv: Makefile
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts: Makefile
Added Files:
src/sys/dtb/riscv/starfive: Makefile
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive: Makefile
jh7100-beaglev-starlight-a1.dts jh7100-beaglev-starlight.dts
jh7100-common.dtsi jh7100-starfive-visionfive-v1.dts jh7100.dtsi
jh7110-pinfunc.h jh7110-starfive-visionfive-2-v1.2a.dts
jh7110-starfive-visionfive-2-v1.3b.dts
jh7110-starfive-visionfive-2.dtsi jh7110.dtsi
src/sys/external/gpl2/dts/dist/include/dt-bindings/clock:
starfive,jh7110-crg.h starfive-jh7100-audio.h starfive-jh7100.h
src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl:
pinctrl-starfive-jh7100.h starfive,jh7110-pinctrl.h
src/sys/external/gpl2/dts/dist/include/dt-bindings/power:
starfive,jh7110-pmu.h
src/sys/external/gpl2/dts/dist/include/dt-bindings/reset:
starfive,jh7110-crg.h starfive-jh7100-audio.h starfive-jh7100.h
starfive-jh7110.h

Log Message:
Import RISC-V starfive DTS from https://github.com/starfive-tech/linux.git;

The files are taken from the visionfive branch with latest DTS related commit

commit 9b5f280fa413ee76fac20cd575075fc53468d527
Author: Emil Renner Berthing 
Date:   Sun Oct 31 17:15:58 2021 +0100

riscv: dts: Add full JH7100, Starlight and VisionFive support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/dtb/ad.riscv32 \
src/distrib/sets/lists/dtb/ad.riscv64
cvs rdiff -u -r1.1 -r1.2 src/sys/dtb/riscv/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/dtb/riscv/starfive/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/Makefile
cvs rdiff -u -r0 -r1.1 \
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/Makefile \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-beaglev-starlight-a1.dts
 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-beaglev-starlight.dts
 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-common.dtsi \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100-starfive-visionfive-v1.dts
 \
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7100.dtsi \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7110-pinfunc.h \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
 \

src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
 \
src/sys/external/gpl2/dts/dist/arch/riscv/boot/dts/starfive/jh7110.dtsi
cvs rdiff -u -r0 -r1.1 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/clock/starfive,jh7110-crg.h \

src/sys/external/gpl2/dts/dist/include/dt-bindings/clock/starfive-jh7100-audio.h
 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/clock/starfive-jh7100.h
cvs rdiff -u -r0 -r1.1 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/pinctrl-starfive-jh7100.h
 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/starfive,jh7110-pinctrl.h
cvs rdiff -u -r0 -r1.1 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/power/starfive,jh7110-pmu.h
cvs rdiff -u -r0 -r1.1 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/reset/starfive,jh7110-crg.h \

src/sys/external/gpl2/dts/dist/include/dt-bindings/reset/starfive-jh7100-audio.h
 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/reset/starfive-jh7100.h \
src/sys/external/gpl2/dts/dist/include/dt-bindings/reset/starfive-jh7110.h

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



CVS commit: src/sys/arch/riscv/sifive

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 14 07:13:15 UTC 2024

Modified Files:
src/sys/arch/riscv/sifive: fu540_ccache.c

Log Message:
risc-v: the SiFive FU[57]40 cache controller is present in the JH71x0 SoCs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/sifive/fu540_ccache.c

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



CVS commit: src/sys/arch/riscv/sifive

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 14 07:13:15 UTC 2024

Modified Files:
src/sys/arch/riscv/sifive: fu540_ccache.c

Log Message:
risc-v: the SiFive FU[57]40 cache controller is present in the JH71x0 SoCs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/sifive/fu540_ccache.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/riscv/sifive/fu540_ccache.c
diff -u src/sys/arch/riscv/sifive/fu540_ccache.c:1.1 src/sys/arch/riscv/sifive/fu540_ccache.c:1.2
--- src/sys/arch/riscv/sifive/fu540_ccache.c:1.1	Sat Jan 13 17:01:58 2024
+++ src/sys/arch/riscv/sifive/fu540_ccache.c	Sun Jan 14 07:13:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fu540_ccache.c,v 1.1 2024/01/13 17:01:58 skrll Exp $	*/
+/*	$NetBSD: fu540_ccache.c,v 1.2 2024/01/14 07:13:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fu540_ccache.c,v 1.1 2024/01/13 17:01:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fu540_ccache.c,v 1.2 2024/01/14 07:13:15 skrll Exp $");
 
 #include 
 
@@ -75,6 +75,9 @@ __KERNEL_RCSID(0, "$NetBSD: fu540_ccache
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "sifive,fu540-c000-ccache" },
 	{ .compat = "sifive,fu740-c000-ccache" },
+	{ .compat = "starfive,jh7100-ccache" },
+	{ .compat = "starfive,jh7110-ccache" },
+	{ .compat = "starfive,ccache0" },
 	DEVICE_COMPAT_EOL
 };
 



CVS commit: src/usr.sbin/crash

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:40:21 UTC 2024

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

Log Message:
crash.8: add xref to savecore(8)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/crash.8

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

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.8 src/usr.sbin/crash/crash.8:1.9
--- src/usr.sbin/crash/crash.8:1.8	Sat Mar 23 02:07:32 2019
+++ src/usr.sbin/crash/crash.8	Sun Jan 14 00:40:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.8 2019/03/23 02:07:32 mrg Exp $
+.\"	$NetBSD: crash.8,v 1.9 2024/01/14 00:40:21 gutteridge Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 22, 2019
+.Dd January 14, 2024
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -94,7 +94,8 @@ like the following:
 .Xr ps 1 ,
 .Xr vmstat 1 ,
 .Xr ddb 4 ,
-.Xr pstat 8
+.Xr pstat 8 ,
+.Xr savecore 8
 .Sh HISTORY
 The
 .Nm



CVS commit: src/usr.sbin/crash

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:40:21 UTC 2024

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

Log Message:
crash.8: add xref to savecore(8)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/crash.8

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



CVS commit: src/sys/conf

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:39:11 UTC 2024

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Makefile.kern.inc: fix grammar in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/conf/Makefile.kern.inc

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



CVS commit: src/sys/conf

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:39:11 UTC 2024

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Makefile.kern.inc: fix grammar in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.299 src/sys/conf/Makefile.kern.inc:1.300
--- src/sys/conf/Makefile.kern.inc:1.299	Fri Jul 28 02:41:31 2023
+++ src/sys/conf/Makefile.kern.inc	Sun Jan 14 00:39:10 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.299 2023/07/28 02:41:31 rin Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.300 2024/01/14 00:39:10 gutteridge Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -249,7 +249,7 @@ SYSTEM_LD_TAIL?=	@${_MKSHECHO}
 OBJCOPY_STRIPFLAGS?=	-g
 
 # Strip some architecture-defined symbols from kernel image, while
-# keep them in netbsd.gdb.
+# keeping them in netbsd.gdb.
 .if defined(ARCH_STRIP_SYMBOLS)
 .if empty(DEBUG:M-g*)
 SYSTEM_LD_TAIL+=	&& ${OBJCOPY} -w ${ARCH_STRIP_SYMBOLS} $@



CVS commit: src/sys/arch/luna68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:17:47 UTC 2024

Modified Files:
src/sys/arch/luna68k/conf: files.luna68k
src/sys/arch/luna68k/luna68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/luna68k/include: vectors.h
Removed Files:
src/sys/arch/luna68k/luna68k: vectors.s

Log Message:
Switch luna68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.4 -r0 src/sys/arch/luna68k/luna68k/vectors.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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.32 src/sys/arch/luna68k/conf/files.luna68k:1.33
--- src/sys/arch/luna68k/conf/files.luna68k:1.32	Tue Jan  9 04:16:24 2024
+++ src/sys/arch/luna68k/conf/files.luna68k	Sun Jan 14 00:17:46 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.32 2024/01/09 04:16:24 thorpej Exp $
+#	$NetBSD: files.luna68k,v 1.33 2024/01/14 00:17:46 thorpej Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -23,6 +23,7 @@ file arch/m68k/m68k/mmu_subr.s
 file arch/m68k/m68k/pmap_motorola.c
 file arch/m68k/m68k/procfs_machdep.c	procfs
 file arch/m68k/m68k/sys_machdep.c
+file arch/m68k/m68k/vectors.c
 file arch/m68k/m68k/vm_machdep.c
 file dev/cons.c
 

Index: src/sys/arch/luna68k/luna68k/isr.c
diff -u src/sys/arch/luna68k/luna68k/isr.c:1.26 src/sys/arch/luna68k/luna68k/isr.c:1.27
--- src/sys/arch/luna68k/luna68k/isr.c:1.26	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/luna68k/luna68k/isr.c	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $");
 
 /*
  * Link and dispatch interrupts.
@@ -134,51 +134,6 @@ isrlink_autovec(int (*func)(void *), voi
 }
 
 /*
- * Establish a vectored interrupt handler.
- * Called by bus interrupt establish functions.
- */
-void
-isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec)
-{
-	struct isr_vectored *isr;
-
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
-		panic("isrlink_vectored: bad ipl %d", ipl);
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrlink_vectored: bad vec 0x%x", vec);
-
-	isr = _vectored[vec - ISRVECTORED];
-
-	if ((vectab[vec] != badtrap) || (isr->isr_func != NULL))
-		panic("isrlink_vectored: vec 0x%x not available", vec);
-
-	/* Fill in the new entry. */
-	isr->isr_func = func;
-	isr->isr_arg = arg;
-	isr->isr_ipl = ipl;
-
-	/* Hook into the vector table. */
-	vectab[vec] = intrhand_vectored;
-}
-
-/*
- * Unhook a vectored interrupt.
- */
-void
-isrunlink_vectored(int vec)
-{
-
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrunlink_vectored: bad vec 0x%x", vec);
-
-	if (vectab[vec] != intrhand_vectored)
-		panic("isrunlink_vectored: not vectored interrupt");
-
-	vectab[vec] = badtrap;
-	memset(_vectored[vec - ISRVECTORED], 0, sizeof(struct isr_vectored));
-}
-
-/*
  * This is the dispatcher called by the low-level
  * assembly language autovectored interrupt routine.
  */
@@ -222,42 +177,6 @@ isrdispatch_autovec(int evec)
 	idepth--;
 }
 
-/*
- * This is the dispatcher called by the low-level
- * assembly language vectored interrupt routine.
- */
-void
-isrdispatch_vectored(int pc, int evec, void *frame)
-{
-	struct isr_vectored *isr;
-	int ipl, vec;
-
-	idepth++;
-	vec = (evec & 0xfff) >> 2;
-	ipl = (getsr() >> 8) & 7;
-
-	intrcnt[ipl]++;
-	curcpu()->ci_data.cpu_nintr++;
-
-	if ((vec < ISRVECTORED) || (vec >= (ISRVECTORED + NISRVECTORED)))
-		panic("isrdispatch_vectored: bad vec 0x%x", vec);
-	isr = _vectored[vec - ISRVECTORED];
-
-	if (isr->isr_func == NULL) {
-		printf("isrdispatch_vectored: no handler for vec 0x%x\n", vec);
-		vectab[vec] = badtrap;
-		idepth--;
-		return;
-	}
-
-	/*
-	 * Handler gets exception frame if argument is NULL.
-	 */
-	if ((*isr->isr_func)(isr->isr_arg ? isr->isr_arg : frame) == 0)
-		printf("isrdispatch_vectored: vec 0x%x not claimed\n", vec);
-	idepth--;
-}
-
 bool
 cpu_intr_p(void)
 {

Index: src/sys/arch/luna68k/luna68k/isr.h
diff -u src/sys/arch/luna68k/luna68k/isr.h:1.4 src/sys/arch/luna68k/luna68k/isr.h:1.5
--- src/sys/arch/luna68k/luna68k/isr.h:1.4	Sat Mar 14 14:46:01 2009
+++ src/sys/arch/luna68k/luna68k/isr.h	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	

CVS commit: src/sys/arch/luna68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:17:47 UTC 2024

Modified Files:
src/sys/arch/luna68k/conf: files.luna68k
src/sys/arch/luna68k/luna68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/luna68k/include: vectors.h
Removed Files:
src/sys/arch/luna68k/luna68k: vectors.s

Log Message:
Switch luna68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.4 -r0 src/sys/arch/luna68k/luna68k/vectors.s

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



CVS commit: src/sys/arch/sun68k/sun68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:58 UTC 2024

Modified Files:
src/sys/arch/sun68k/sun68k: isr.c

Log Message:
Use NAUTOVECTORS and NUSERVECTORS constants from 


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sun68k/sun68k/isr.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/sun68k/sun68k/isr.c
diff -u src/sys/arch/sun68k/sun68k/isr.c:1.29 src/sys/arch/sun68k/sun68k/isr.c:1.30
--- src/sys/arch/sun68k/sun68k/isr.c:1.29	Sat Jan 13 18:51:38 2024
+++ src/sys/arch/sun68k/sun68k/isr.c	Sun Jan 14 00:00:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.30 2024/01/14 00:00:58 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.30 2024/01/14 00:00:58 thorpej Exp $");
 
 #include 
 #include 
@@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.29
 
 extern int intrcnt[];	/* statistics */
 
-#define NUM_LEVELS 8
-
 struct isr {
 	struct isr *isr_next;
 	isr_func_t isr_intr;
@@ -78,12 +76,11 @@ void isr_vectored(struct clockframe);
 void 
 isr_add_custom(int level, void *handler)
 {
-
 	vec_set_entry(VECI_INTRAV0 + level, handler);
 }
 
 
-static struct isr *isr_autovec_list[NUM_LEVELS];
+static struct isr *isr_autovec_list[NAUTOVECTORS];
 
 /*
  * This is called by the assembly routines
@@ -136,7 +133,7 @@ isr_add_autovect(isr_func_t handler, voi
 {
 	struct isr *new_isr;
 
-	if ((level < 0) || (level >= NUM_LEVELS))
+	if ((level < 0) || (level >= NAUTOVECTORS))
 		panic("isr_add: bad level=%d", level);
 	new_isr = kmem_alloc(sizeof(struct isr), KM_SLEEP);
 	new_isr->isr_intr = handler;
@@ -150,7 +147,7 @@ struct vector_handler {
 	isr_func_t func;
 	void *arg;
 };
-static struct vector_handler isr_vector_handlers[192];
+static struct vector_handler isr_vector_handlers[NUSERVECTORS];
 
 /*
  * This is called by the assembly glue



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

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
Provide NAUTOVECTORS and NUSERVECTORS constants.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/include/vectors.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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.3 src/sys/arch/m68k/include/vectors.h:1.4
--- src/sys/arch/m68k/include/vectors.h:1.3	Sat Jan 13 20:10:36 2024
+++ src/sys/arch/m68k/include/vectors.h	Sun Jan 14 00:00:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.4 2024/01/14 00:00:15 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -115,6 +115,8 @@
 #define	VECI_USRVEC_START	64	/* User defined vectors (192) */
 
 #define	NVECTORS		256
+#define	NAUTOVECTORS		8
+#define	NUSERVECTORS		(NVECTORS - VECI_USRVEC_START)
 
 #define	VECI_INTRAV(ipl)	((ipl) + VECI_SPURIOUS_INTR)
 #define	VECI_TRAP(x)		((x) + VECI_TRAP0)



CVS commit: src/sys/arch/sun68k/sun68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:58 UTC 2024

Modified Files:
src/sys/arch/sun68k/sun68k: isr.c

Log Message:
Use NAUTOVECTORS and NUSERVECTORS constants from 


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sun68k/sun68k/isr.c

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



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

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
Provide NAUTOVECTORS and NUSERVECTORS constants.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/include/vectors.h

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



CVS commit: src/sys/arch/news68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 23:59:47 UTC 2024

Modified Files:
src/sys/arch/news68k/conf: files.news68k
src/sys/arch/news68k/include: cpu.h
src/sys/arch/news68k/news68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/news68k/include: vectors.h
Removed Files:
src/sys/arch/news68k/news68k: vectors.s

Log Message:
Switch news68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/news68k/conf/files.news68k
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/news68k/include/vectors.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/news68k/news68k/isr.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/news68k/news68k/isr.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.9 -r0 src/sys/arch/news68k/news68k/vectors.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/news68k/conf/files.news68k
diff -u src/sys/arch/news68k/conf/files.news68k:1.37 src/sys/arch/news68k/conf/files.news68k:1.38
--- src/sys/arch/news68k/conf/files.news68k:1.37	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/news68k/conf/files.news68k	Sat Jan 13 23:59:47 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.news68k,v 1.37 2024/01/09 04:16:26 thorpej Exp $
+#	$NetBSD: files.news68k,v 1.38 2024/01/13 23:59:47 thorpej Exp $
 
 #	NEWS68K-specific configuration info
 
@@ -29,6 +29,7 @@ file	arch/m68k/m68k/mmu_subr.s
 file	arch/m68k/m68k/pmap_motorola.c
 file	arch/m68k/m68k/procfs_machdep.c		procfs
 file	arch/m68k/m68k/sys_machdep.c
+file	arch/m68k/m68k/vectors.c
 file	arch/m68k/m68k/vm_machdep.c
 file	dev/cons.c
 

Index: src/sys/arch/news68k/include/cpu.h
diff -u src/sys/arch/news68k/include/cpu.h:1.48 src/sys/arch/news68k/include/cpu.h:1.49
--- src/sys/arch/news68k/include/cpu.h:1.48	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/news68k/include/cpu.h	Sat Jan 13 23:59:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.48 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.49 2024/01/13 23:59:47 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -149,15 +149,10 @@ extern u_int intiobase_phys, intiotop_ph
 extern u_int extiobase_phys, extiotop_phys;
 extern u_int intrcnt[];
 
-extern void (*vectab[])(void);
 extern void *romcallvec;
 
 struct frame;
 
-/* locore.s functions */
-void badtrap(void);
-void intrhand_vectored(void);
-
 void doboot(int)
 	__attribute__((__noreturn__));
 void nmihand(struct frame *);

Index: src/sys/arch/news68k/news68k/isr.c
diff -u src/sys/arch/news68k/news68k/isr.c:1.23 src/sys/arch/news68k/news68k/isr.c:1.24
--- src/sys/arch/news68k/news68k/isr.c:1.23	Sat Nov 21 17:55:38 2020
+++ src/sys/arch/news68k/news68k/isr.c	Sat Jan 13 23:59:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.24 2024/01/13 23:59:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.24 2024/01/13 23:59:47 thorpej Exp $");
 
 #include 
 #include 
@@ -49,14 +49,16 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23
 
 #include 
 
+#include 
+
 #include 
 
-isr_autovec_list_t isr_autovec[NISRAUTOVEC];
-struct	isr_vectored isr_vectored[NISRVECTORED];
+isr_autovec_list_t isr_autovec[NAUTOVECTORS];
+struct	isr_vectored isr_vectored[NUSERVECTORS];
 int idepth;
 
-void set_vector_entry(int, void *);
-void *get_vector_entry(int);
+extern char badtrap[];
+extern char intrhand_vectored[];
 
 void
 isrinit(void)
@@ -64,7 +66,7 @@ isrinit(void)
 	int i;
 
 	/* Initialize the autovector lists. */
-	for (i = 0; i < NISRAUTOVEC; ++i) {
+	for (i = 0; i < NAUTOVECTORS; ++i) {
 		LIST_INIT(_autovec[i]);
 	}
 }
@@ -79,7 +81,7 @@ isrlink_autovec(int (*func)(void *), voi
 	struct isr_autovec *newisr, *curisr;
 	isr_autovec_list_t *list;
 
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
+	if ((ipl < 0) || (ipl >= NAUTOVECTORS))
 		panic("isrlink_autovec: bad ipl %d", ipl);
 
 	newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
@@ -144,14 +146,14 @@ isrlink_vectored(int (*func)(void *), vo
 {
 	struct isr_vectored *isr;
 
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
+	if (ipl < 0 || ipl >= NAUTOVECTORS)
 		panic("isrlink_vectored: bad ipl %d", ipl);
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
+	if (vec < VECI_USRVEC_START || vec >= NVECTORS)
 		panic("isrlink_vectored: bad vec 0x%x", vec);
 
-	isr = _vectored[vec - ISRVECTORED];
+	isr = _vectored[vec - VECI_USRVEC_START];
 
-	if ((vectab[vec] != badtrap) || (isr->isr_func != NULL))
+	if (vec_get_entry(vec) != badtrap || isr->isr_func != NULL)
 		panic("isrlink_vectored: vec 0x%x not available", vec);
 
 	/* Fill in the new entry. */
@@ -160,7 +162,7 @@ isrlink_vectored(int (*func)(void 

CVS commit: src/sys/arch/news68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 23:59:47 UTC 2024

Modified Files:
src/sys/arch/news68k/conf: files.news68k
src/sys/arch/news68k/include: cpu.h
src/sys/arch/news68k/news68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/news68k/include: vectors.h
Removed Files:
src/sys/arch/news68k/news68k: vectors.s

Log Message:
Switch news68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/news68k/conf/files.news68k
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/news68k/include/vectors.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/news68k/news68k/isr.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/news68k/news68k/isr.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.9 -r0 src/sys/arch/news68k/news68k/vectors.s

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



CVS commit: src/sys/arch/next68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 21:40:54 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/next68k/include: vectors.h
Removed Files:
src/sys/arch/next68k/next68k: vectors.s

Log Message:
Switch next68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/include/vectors.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.13 -r0 src/sys/arch/next68k/next68k/vectors.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/next68k/conf/files.next68k
diff -u src/sys/arch/next68k/conf/files.next68k:1.43 src/sys/arch/next68k/conf/files.next68k:1.44
--- src/sys/arch/next68k/conf/files.next68k:1.43	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/next68k/conf/files.next68k	Sat Jan 13 21:40:53 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.next68k,v 1.43 2024/01/09 04:16:26 thorpej Exp $
+# $NetBSD: files.next68k,v 1.44 2024/01/13 21:40:53 thorpej Exp $
 
 # next68k-specific configuration info
 
@@ -40,6 +40,7 @@ file	arch/m68k/m68k/mmu_subr.s
 file	arch/m68k/m68k/pmap_motorola.c
 file	arch/m68k/m68k/procfs_machdep.c		procfs
 file	arch/m68k/m68k/sys_machdep.c
+file	arch/m68k/m68k/vectors.c
 file	arch/m68k/m68k/vm_machdep.c
 
 # include "arch/m68k/fpe/files.fpe"

Index: src/sys/arch/next68k/include/cpu.h
diff -u src/sys/arch/next68k/include/cpu.h:1.53 src/sys/arch/next68k/include/cpu.h:1.54
--- src/sys/arch/next68k/include/cpu.h:1.53	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/next68k/include/cpu.h	Sat Jan 13 21:40:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.53 2024/01/09 04:16:26 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.54 2024/01/13 21:40:54 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -112,8 +112,6 @@ extern volatile unsigned int interrupt_d
 
 extern	int	astpending;	/* need to trap before returning to user mode */
 
-extern	void (*vectab[])(void);
-
 /* locore.s functions */
 void	doboot(void) __attribute__((__noreturn__));
 int	nmihand(void *);

Index: src/sys/arch/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.33 src/sys/arch/next68k/next68k/isr.c:1.34
--- src/sys/arch/next68k/next68k/isr.c:1.33	Fri Feb  3 23:19:03 2023
+++ src/sys/arch/next68k/next68k/isr.c	Sat Jan 13 21:40:54 2024
@@ -1,11 +1,4 @@
-/*	$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $ */
-
-/*
- * This file was taken from mvme68k/mvme68k/isr.c
- * should probably be re-synced when needed.
- * Darrin B. Jewell   Tue Nov 10 05:07:16 1998
- * original cvs id: NetBSD: isr.c,v 1.12 1998/07/05 06:49:07 jonathan Exp
- */
+/*	$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $");
 
 #include 
 #include 
@@ -59,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33
 
 volatile unsigned int interrupt_depth;
 isr_autovec_list_t isr_autovec[NISRAUTOVEC];
-struct	isr_vectored isr_vectored[NISRVECTORED];
 static const char irqgroupname[] = "hard irqs";
 struct	evcnt next68k_irq_evcnt[] = {
 	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, irqgroupname, "spur"),
@@ -77,7 +69,6 @@ int ssir;
 extern	u_int intrcnt[];	/* from locore.s. XXXSCW: will go away soon */
 extern	void (*vectab[])(void);
 extern	void badtrap(void);
-extern	void intrhand_vectored(void);
 
 #if 0
 static	int spurintr(void *);
@@ -95,10 +86,6 @@ isrinit(void)
 	/* Initialise the interrupt event counts */
 	for (i = 0; i < (sizeof(next68k_irq_evcnt) / sizeof(struct evcnt)); i++)
 		evcnt_attach_static(_irq_evcnt[i]);
-
-	/* Arrange to trap Spurious and NMI auto-vectored Interrupts */
-/* 	isrlink_autovec(spurintr, NULL, 0, 0, NULL); */
-/* 	isrlink_autovec(nmihand, NULL, 7, 0, NULL); */
 }
 
 /*
@@ -172,40 +159,6 @@ isrlink_autovec(int (*func)(void *), voi
 }
 
 /*
- * Establish a vectored interrupt handler.
- * Called by bus interrupt establish functions.
- */
-void
-isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec,
-struct evcnt *evcnt)
-{
-	struct isr_vectored *isr;
-
-#ifdef DIAGNOSTIC
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
-		panic("isrlink_vectored: bad ipl %d", ipl);
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrlink_vectored: bad vec 0x%x", vec);
-#endif
-
-	isr = _vectored[vec - ISRVECTORED];
-
-#ifdef 

CVS commit: src/sys/arch/next68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 21:40:54 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/next68k/include: vectors.h
Removed Files:
src/sys/arch/next68k/next68k: vectors.s

Log Message:
Switch next68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/include/vectors.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.13 -r0 src/sys/arch/next68k/next68k/vectors.s

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



CVS commit: src/sys/arch/mvme68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:18:47 UTC 2024

Modified Files:
src/sys/arch/mvme68k/conf: files.mvme68k
src/sys/arch/mvme68k/mvme68k: locore.s machdep.c
Added Files:
src/sys/arch/mvme68k/include: vectors.h
Removed Files:
src/sys/arch/mvme68k/mvme68k: vectors.s

Log Message:
Switch mvme68k to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mvme68k/conf/files.mvme68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mvme68k/include/vectors.h
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/mvme68k/mvme68k/machdep.c
cvs rdiff -u -r1.11 -r0 src/sys/arch/mvme68k/mvme68k/vectors.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/mvme68k/conf/files.mvme68k
diff -u src/sys/arch/mvme68k/conf/files.mvme68k:1.66 src/sys/arch/mvme68k/conf/files.mvme68k:1.67
--- src/sys/arch/mvme68k/conf/files.mvme68k:1.66	Tue Jan  9 04:16:25 2024
+++ src/sys/arch/mvme68k/conf/files.mvme68k	Sat Jan 13 20:18:46 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mvme68k,v 1.66 2024/01/09 04:16:25 thorpej Exp $
+#	$NetBSD: files.mvme68k,v 1.67 2024/01/13 20:18:46 thorpej Exp $
 
 # config file for mvme68k
 
@@ -103,6 +103,7 @@ file arch/m68k/m68k/mmu_subr.s
 file arch/m68k/m68k/pmap_motorola.c
 file arch/m68k/m68k/procfs_machdep.c		procfs
 file arch/m68k/m68k/sys_machdep.c
+file arch/m68k/m68k/vectors.c
 file arch/m68k/m68k/vm_machdep.c
 file dev/cons.c
 file dev/cninit.c

Index: src/sys/arch/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.125 src/sys/arch/mvme68k/mvme68k/locore.s:1.126
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.125	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/mvme68k/mvme68k/locore.s	Sat Jan 13 20:18:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.125 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.126 2024/01/13 20:18:47 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -62,12 +62,6 @@
 	.space	PAGE_SIZE
 ASLOCAL(tmpstk)
 
-ASLOCAL(bug_vbr)
-	.long	0
-
-#include 
-
-
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
@@ -201,8 +195,6 @@ ASLOCAL(Lbrdid2mach)
 	.word		CPU_68030
 	.word		MMU_68030
 	.word		FPU_68882
-	.long		_C_LABEL(busaddrerr2030)
-	.long		_C_LABEL(busaddrerr2030)
 	.long		Linit147
 #endif
 #ifdef MVME162
@@ -210,8 +202,6 @@ ASLOCAL(Lbrdid2mach)
 	.word		CPU_68040
 	.word		MMU_68040
 	.word		FPU_68040
-	.long		_C_LABEL(buserr40)
-	.long		_C_LABEL(addrerr4060)
 	.long		Linit1x2
 #endif
 #ifdef MVME167
@@ -219,8 +209,6 @@ ASLOCAL(Lbrdid2mach)
 	.word		CPU_68040
 	.word		MMU_68040
 	.word		FPU_68040
-	.long		_C_LABEL(buserr40)
-	.long		_C_LABEL(addrerr4060)
 	.long		Linit1x7
 #endif
 #ifdef MVME172
@@ -228,8 +216,6 @@ ASLOCAL(Lbrdid2mach)
 	.word		CPU_68060
 	.word		MMU_68040
 	.word		FPU_68060
-	.long		_C_LABEL(buserr60)
-	.long		_C_LABEL(addrerr4060)
 	.long		Linit1x2
 #endif
 #ifdef MVME177
@@ -237,8 +223,6 @@ ASLOCAL(Lbrdid2mach)
 	.word		CPU_68060
 	.word		MMU_68040
 	.word		FPU_68060
-	.long		_C_LABEL(buserr60)
-	.long		_C_LABEL(addrerr4060)
 	.long		Linit1x7
 #endif
 	.word	0
@@ -254,19 +238,17 @@ Lgotmatch:
 	extl	%d1
 	RELOC(cputype,%a1)
 	movel	%d1,%a1@
+
 	movew	%a0@+,%d1		| Copy the MMU type
 	extl	%d1
 	RELOC(mmutype,%a1)
 	movel	%d1,%a1@
+
 	movew	%a0@+,%d1		| Copy the FPU type
 	extl	%d1
 	RELOC(fputype,%a1)
 	movel	%d1,%a1@
-	movel	%a0@+,%a2		| Fetch the bus error vector
-	RELOC(vectab,%a1)
-	movl	%a2,%a1@(8)
-	movel	%a0@+,%a2		| Fetch the address error vector
-	movl	%a2,%a1@(12)
+
 	movel	%a0@,%a0		| Finally, the board-specific init code
 	jmp	%a0@
 
@@ -622,11 +604,8 @@ Lmotommu2:
  */
 Lenab1:
 /* Point the CPU VBR at our vector table */
-	movc	%vbr,%d0		| Preserve Bug's VBR address
-	movl	%d0,_ASM_LABEL(bug_vbr)
-	movl	#_C_LABEL(vectab),%d0	| get our VBR address
-	movc	%d0,%vbr
-	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
+	lea	_ASM_LABEL(tmpstk),%sp	| re-load temporary stack
+	jbsr	_C_LABEL(vec_init)	| initialize vector table
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */
@@ -1121,7 +1100,7 @@ ENTRY_NOPROFILE(doboot)
 	movw	#PSL_HIGHIPL,%sr
 	movl	_C_LABEL(boothowto),%d1	| load howto
 	movl	%sp@(4),%d2		| arg
-	movl	_ASM_LABEL(bug_vbr),%d3	| Fetch Bug's original VBR value
+	movl	_C_LABEL(saved_vbr),%d3	| Fetch Bug's original VBR value
 	movl	_C_LABEL(machineid),%d4	| What type of board is this?
 	movl	#CACHE_OFF,%d0
 #if defined(M68040) || defined(M68060)

Index: src/sys/arch/mvme68k/mvme68k/machdep.c
diff -u src/sys/arch/mvme68k/mvme68k/machdep.c:1.161 src/sys/arch/mvme68k/mvme68k/machdep.c:1.162
--- src/sys/arch/mvme68k/mvme68k/machdep.c:1.161	Wed Dec 20 00:40:44 2023
+++ src/sys/arch/mvme68k/mvme68k/machdep.c	Sat Jan 13 20:18:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.161 

CVS commit: src/sys/arch/mvme68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:18:47 UTC 2024

Modified Files:
src/sys/arch/mvme68k/conf: files.mvme68k
src/sys/arch/mvme68k/mvme68k: locore.s machdep.c
Added Files:
src/sys/arch/mvme68k/include: vectors.h
Removed Files:
src/sys/arch/mvme68k/mvme68k: vectors.s

Log Message:
Switch mvme68k to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mvme68k/conf/files.mvme68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/mvme68k/include/vectors.h
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/mvme68k/mvme68k/machdep.c
cvs rdiff -u -r1.11 -r0 src/sys/arch/mvme68k/mvme68k/vectors.s

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



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:10:36 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Expose saved_vbr directly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/vectors.c

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

Modified files:

Index: src/sys/arch/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.2 src/sys/arch/m68k/include/vectors.h:1.3
--- src/sys/arch/m68k/include/vectors.h:1.2	Sat Jan 13 18:42:11 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 20:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -125,6 +125,7 @@
 #ifdef _KERNEL
 
 extern void *vectab[NVECTORS];
+extern void **saved_vbr;
 
 void	vec_init(void);
 void	vec_reset(void);

Index: src/sys/arch/m68k/m68k/vectors.c
diff -u src/sys/arch/m68k/m68k/vectors.c:1.2 src/sys/arch/m68k/m68k/vectors.c:1.3
--- src/sys/arch/m68k/m68k/vectors.c:1.2	Sat Jan 13 18:42:11 2024
+++ src/sys/arch/m68k/m68k/vectors.c	Sat Jan 13 20:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.c,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
+/*	$NetBSD: vectors.c,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -516,7 +516,7 @@ void *vectab[NVECTORS] = {
 	[VECI_USRVEC_START+191]	=	badtrap,
 };
 
-static void **saved_vbr;
+void **saved_vbr;
 
 /*
  * vec_init --



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:10:36 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Expose saved_vbr directly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/vectors.c

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



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

2024-01-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 13 19:31:40 UTC 2024

Modified Files:
src/sys/arch/sun3/conf: GENERIC

Log Message:
Disable more several pseudo-devices to shrink binary size.

My 3/60 fails to boot from a SCSI disk without this change.
 https://mail-index.netbsd.org/port-sun3/2024/01/13/msg000207.html

Should be pulled up to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/sun3/conf/GENERIC

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



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

2024-01-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 13 19:31:40 UTC 2024

Modified Files:
src/sys/arch/sun3/conf: GENERIC

Log Message:
Disable more several pseudo-devices to shrink binary size.

My 3/60 fails to boot from a SCSI disk without this change.
 https://mail-index.netbsd.org/port-sun3/2024/01/13/msg000207.html

Should be pulled up to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/sun3/conf/GENERIC

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

Modified files:

Index: src/sys/arch/sun3/conf/GENERIC
diff -u src/sys/arch/sun3/conf/GENERIC:1.191 src/sys/arch/sun3/conf/GENERIC:1.192
--- src/sys/arch/sun3/conf/GENERIC:1.191	Sat Jan 13 05:31:29 2024
+++ src/sys/arch/sun3/conf/GENERIC	Sat Jan 13 19:31:39 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.191 2024/01/13 05:31:29 simonb Exp $
+# $NetBSD: GENERIC,v 1.192 2024/01/13 19:31:39 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -25,7 +25,7 @@ include 	"arch/sun3/conf/std.sun3"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.191 $"
+#ident		"GENERIC-$Revision: 1.192 $"
 
 makeoptions	COPTS="-Os -fno-unwind-tables -fno-omit-frame-pointer"
 	# Bootloader has size limit (~2MB). -fno-omit-frame-pointer is
@@ -258,7 +258,7 @@ pseudo-device	loop			# network loopback
 pseudo-device	bpfilter		# packet filter
 #pseudo-device	carp			# Common Address Redundancy Protocol
 pseudo-device	sl			# CSLIP
-pseudo-device	ppp			# PPP
+#pseudo-device	ppp			# PPP
 #pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
 #pseudo-device	tun			# network tunneling over tty
 #pseudo-device	tap			# virtual Ethernet
@@ -267,13 +267,13 @@ pseudo-device	ppp			# PPP
 #pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
 #pseudo-device	faith			# IPv[46] tcp relay translation i/f
 #pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
-pseudo-device	vlan			# IEEE 802.1q encapsulation
+#pseudo-device	vlan			# IEEE 802.1q encapsulation
 #pseudo-device	bridge			# simple inter-network bridging
 #pseudo-device	vether			# Virtual Ethernet for bridge
 #pseudo-device	agr			# IEEE 802.3ad link aggregation
 
 pseudo-device	pty			# pseudo-terminals
-pseudo-device	vnd			# paging to files
+#pseudo-device	vnd			# paging to files
 #options 	VND_COMPRESSION		# compressed vnd(4)
 #pseudo-device	ccd			# concatenated disks
 #pseudo-device	cgd			# cryptographic disk devices
@@ -290,7 +290,7 @@ pseudo-device	vnd			# paging to files
 #pseudo-device	fss			# file system snapshot device
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
-pseudo-device 	swwdog			# software watchdog timer -- swwdog(4)
+#pseudo-device 	swwdog			# software watchdog timer -- swwdog(4)
 
 # Veriexec
 # include "dev/veriexec.config"



CVS commit: src/sys/arch/hp300

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 19:20:26 UTC 2024

Modified Files:
src/sys/arch/hp300/conf: files.hp300
src/sys/arch/hp300/hp300: locore.s
src/sys/arch/hp300/include: cpu.h
Added Files:
src/sys/arch/hp300/include: vectors.h
Removed Files:
src/sys/arch/hp300/hp300: vectors.s

Log Message:
Switch hp300 over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/hp300/conf/files.hp300
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.19 -r0 src/sys/arch/hp300/hp300/vectors.s
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/hp300/include/vectors.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/hp300/conf/files.hp300
diff -u src/sys/arch/hp300/conf/files.hp300:1.93 src/sys/arch/hp300/conf/files.hp300:1.94
--- src/sys/arch/hp300/conf/files.hp300:1.93	Tue Jan  9 04:16:24 2024
+++ src/sys/arch/hp300/conf/files.hp300	Sat Jan 13 19:20:26 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hp300,v 1.93 2024/01/09 04:16:24 thorpej Exp $
+#	$NetBSD: files.hp300,v 1.94 2024/01/13 19:20:26 thorpej Exp $
 #
 # hp300-specific configuration info
 
@@ -224,6 +224,7 @@ file	arch/m68k/m68k/mmu_subr.s
 file	arch/m68k/m68k/pmap_motorola.c
 file	arch/m68k/m68k/procfs_machdep.c		procfs
 file	arch/m68k/m68k/sys_machdep.c
+file	arch/m68k/m68k/vectors.c
 file	arch/m68k/m68k/vm_machdep.c
 
 file	dev/cons.c

Index: src/sys/arch/hp300/hp300/locore.s
diff -u src/sys/arch/hp300/hp300/locore.s:1.179 src/sys/arch/hp300/hp300/locore.s:1.180
--- src/sys/arch/hp300/hp300/locore.s:1.179	Tue Jan  9 07:28:25 2024
+++ src/sys/arch/hp300/hp300/locore.s	Sat Jan 13 19:20:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.179 2024/01/09 07:28:25 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.180 2024/01/13 19:20:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -128,8 +128,6 @@ GLOBAL(kernel_text)
 	.space	PAGE_SIZE
 ASLOCAL(tmpstk)
 
-#include 
-
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
@@ -370,36 +368,6 @@ Lis320:
 	 */
 
 Lstart1:
-	/*
-	 * Now that we know what CPU we have, initialize the address error
-	 * and bus error handlers in the vector table:
-	 *
-	 *	vectab+8	bus error
-	 *	vectab+12	address error
-	 */
-	RELOC(cputype, %a0)
-	movl	#_C_LABEL(vectab),%a2
-	addl	%a5,%a2
-#if defined(M68040)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jne	1f			| no, skip
-	movl	#_C_LABEL(buserr40),%a2@(8)
-	movl	#_C_LABEL(addrerr4060),%a2@(12)
-	jra	Lstart2
-1:
-#endif
-#if defined(M68020) || defined(M68030)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jeq	1f			| yes, skip
-	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
-	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
-	jra	Lstart2
-1:
-#endif
-	/* Config botch; no hope. */
-	DOREBOOT
-
-Lstart2:
 	movl	#0,%a1@(MMUCMD)		| clear out MMU again
 /* initialize source/destination control registers for movs */
 	moveq	#FC_USERD,%d0		| user space
@@ -493,13 +461,6 @@ Lcodecopy:
 	 */
 
 Lhighcode:
-	/*
-	 * Set up the vector table, and race to get the MMU
-	 * enabled.
-	 */
-	movl	#_C_LABEL(vectab),%d0	| set Vector Base Register
-	movc	%d0,%vbr
-
 	RELOC(mmutype, %a0)
 	tstl	%a0@			| HP MMU?
 	jeq	Lhpmmu3			| yes, skip
@@ -542,7 +503,8 @@ Lehighcode:
  * Should be running mapped from this point on
  */
 Lenab1:
-	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
+	lea	_ASM_LABEL(tmpstk),%sp	| re-load the temporary stack
+	jbsr	_C_LABEL(vec_init)	| initialize the vector table
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */

Index: src/sys/arch/hp300/include/cpu.h
diff -u src/sys/arch/hp300/include/cpu.h:1.74 src/sys/arch/hp300/include/cpu.h:1.75
--- src/sys/arch/hp300/include/cpu.h:1.74	Tue Jan  9 04:16:24 2024
+++ src/sys/arch/hp300/include/cpu.h	Sat Jan 13 19:20:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.74 2024/01/09 04:16:24 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.75 2024/01/13 19:20:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -116,7 +116,6 @@ extern int astpending;		/* need to trap 
  */
 
 extern	uint8_t *intiobase, *intiolimit, *extiobase;
-extern	void (*vectab[])(void);
 
 /* locore.s functions */
 void	doboot(void) __attribute__((__noreturn__));

Added files:

Index: src/sys/arch/hp300/include/vectors.h
diff -u /dev/null src/sys/arch/hp300/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 19:20:26 2024
+++ src/sys/arch/hp300/include/vectors.h	Sat Jan 13 19:20:26 2024
@@ -0,0 +1,50 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 19:20:26 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are 

CVS commit: src/sys/arch/hp300

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 19:20:26 UTC 2024

Modified Files:
src/sys/arch/hp300/conf: files.hp300
src/sys/arch/hp300/hp300: locore.s
src/sys/arch/hp300/include: cpu.h
Added Files:
src/sys/arch/hp300/include: vectors.h
Removed Files:
src/sys/arch/hp300/hp300: vectors.s

Log Message:
Switch hp300 over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/hp300/conf/files.hp300
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.19 -r0 src/sys/arch/hp300/hp300/vectors.s
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/hp300/include/vectors.h

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



CVS commit: src/sys/arch

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:51:39 UTC 2024

Modified Files:
src/sys/arch/sun2/sun2: locore2.c promlib.c
src/sys/arch/sun3/sun3: locore2.c sunmon.c
src/sys/arch/sun3/sun3x: locore2.c
src/sys/arch/sun68k/conf: files.sun68k
src/sys/arch/sun68k/sun68k: isr.c
Added Files:
src/sys/arch/sun2/include: vectors.h
src/sys/arch/sun3/include: vectors.h
src/sys/arch/sun68k/include: vectors.h
Removed Files:
src/sys/arch/sun68k/sun68k: vector.c vector.h

Log Message:
Switch the sun68k platforms over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun2/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun2/sun2/locore2.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sun2/sun2/promlib.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun3/include/vectors.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sun3/sun3/locore2.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sun3/sun3/sunmon.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sun3/sun3x/locore2.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sun68k/conf/files.sun68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun68k/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun68k/sun68k/isr.c
cvs rdiff -u -r1.7 -r0 src/sys/arch/sun68k/sun68k/vector.c
cvs rdiff -u -r1.4 -r0 src/sys/arch/sun68k/sun68k/vector.h

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



CVS commit: src/sys/arch

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:51:39 UTC 2024

Modified Files:
src/sys/arch/sun2/sun2: locore2.c promlib.c
src/sys/arch/sun3/sun3: locore2.c sunmon.c
src/sys/arch/sun3/sun3x: locore2.c
src/sys/arch/sun68k/conf: files.sun68k
src/sys/arch/sun68k/sun68k: isr.c
Added Files:
src/sys/arch/sun2/include: vectors.h
src/sys/arch/sun3/include: vectors.h
src/sys/arch/sun68k/include: vectors.h
Removed Files:
src/sys/arch/sun68k/sun68k: vector.c vector.h

Log Message:
Switch the sun68k platforms over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun2/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun2/sun2/locore2.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sun2/sun2/promlib.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun3/include/vectors.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sun3/sun3/locore2.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sun3/sun3/sunmon.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sun3/sun3x/locore2.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sun68k/conf/files.sun68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun68k/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun68k/sun68k/isr.c
cvs rdiff -u -r1.7 -r0 src/sys/arch/sun68k/sun68k/vector.c
cvs rdiff -u -r1.4 -r0 src/sys/arch/sun68k/sun68k/vector.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/sun2/sun2/locore2.c
diff -u src/sys/arch/sun2/sun2/locore2.c:1.28 src/sys/arch/sun2/sun2/locore2.c:1.29
--- src/sys/arch/sun2/sun2/locore2.c:1.28	Sat Jul 11 13:07:01 2020
+++ src/sys/arch/sun2/sun2/locore2.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore2.c,v 1.28 2020/07/11 13:07:01 nia Exp $	*/
+/*	$NetBSD: locore2.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.28 2020/07/11 13:07:01 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -54,10 +54,10 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-#include 
 
 #include "ksyms.h"
 
@@ -285,7 +285,7 @@ _bootstrap(void)
 	 * Point interrupts/exceptions to our vector table.
 	 * (Until now, we use the one setup by the PROM.)
 	 */
-	setvbr((void **)vector_table);
+	vec_init();
 	/* Interrupts are enabled later, after autoconfig. */
 
 	/*

Index: src/sys/arch/sun2/sun2/promlib.c
diff -u src/sys/arch/sun2/sun2/promlib.c:1.19 src/sys/arch/sun2/sun2/promlib.c:1.20
--- src/sys/arch/sun2/sun2/promlib.c:1.19	Thu Sep 10 02:03:44 2020
+++ src/sys/arch/sun2/sun2/promlib.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: promlib.c,v 1.19 2020/09/10 02:03:44 rin Exp $	*/
+/*	$NetBSD: promlib.c,v 1.20 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.19 2020/09/10 02:03:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.20 2024/01/13 18:51:38 thorpej Exp $");
 
 #include 
 #include 
@@ -41,10 +41,10 @@ __KERNEL_RCSID(0, "$NetBSD: promlib.c,v 
 
 #define _SUN2_PROMLIB_PRIVATE
 #include 
+#include 
 
 #include 
 #include 
-#include 
 #include 
 
 /*
@@ -131,7 +131,7 @@ _mode_kernel(struct kernel_state *state,
 	 */
 	if (full) {
 		set_clk_mode(1, 0);
-		setvbr(vector_table);
+		setvbr(vectab);
 		set_clk_mode(0, 1);
 		splx(state->saved_spl);
 	}

Index: src/sys/arch/sun3/sun3/locore2.c
diff -u src/sys/arch/sun3/sun3/locore2.c:1.103 src/sys/arch/sun3/sun3/locore2.c:1.104
--- src/sys/arch/sun3/sun3/locore2.c:1.103	Sat Jul 11 13:07:01 2020
+++ src/sys/arch/sun3/sun3/locore2.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore2.c,v 1.103 2020/07/11 13:07:01 nia Exp $	*/
+/*	$NetBSD: locore2.c,v 1.104 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.103 2020/07/11 13:07:01 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.104 2024/01/13 18:51:38 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -54,12 +54,12 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include "ksyms.h"
 
@@ -344,7 +344,7 @@ _bootstrap(void)
 	 * it will not cause "spurrious level 7" complaints.
 	 * Done after _vm_init so the PROM can debug that.
 	 */
-	setvbr((void **)vector_table);
+	vec_init();
 	/* Interrupts are enabled later, after autoconfig. */
 
 	/*

Index: src/sys/arch/sun3/sun3/sunmon.c
diff -u src/sys/arch/sun3/sun3/sunmon.c:1.23 src/sys/arch/sun3/sun3/sunmon.c:1.24
--- 

CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:42:11 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Provide some vector table override hooks and interfaces needed by the
sun68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/vectors.c

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

Modified files:

Index: src/sys/arch/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.1 src/sys/arch/m68k/include/vectors.h:1.2
--- src/sys/arch/m68k/include/vectors.h:1.1	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 18:42:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -71,7 +71,8 @@
 #define	VECI_rsvd21		21	/* unassigned, reserved */
 #define	VECI_rsvd22		22	/* unassigned, reserved */
 #define	VECI_rsvd23		23	/* unassigned, reserved */
-#define	VECI_SPURIOUS_INTR	24	/* Spurious Interrupt */
+#define	VECI_INTRAV0		24	/* Spurious Interrupt */
+#define	VECI_SPURIOUS_INTR	VECI_INTRAV0
 #define	VECI_INTRAV1		25	/* Level 1 Interrupt Autovector */
 #define	VECI_INTRAV2		26	/* Level 2 Interrupt Autovector */
 #define	VECI_INTRAV3		27	/* Level 3 Interrupt Autovector */
@@ -118,8 +119,8 @@
 #define	VECI_INTRAV(ipl)	((ipl) + VECI_SPURIOUS_INTR)
 #define	VECI_TRAP(x)		((x) + VECI_TRAP0)
 
-#define	VECI_TO_VEC(x)		((x) << 2)
-#define	VEC_TO_VECI(x)		((unsigned int)(x) >> 2)
+#define	VECI_TO_VECO(x)		((x) << 2)
+#define	VECO_TO_VECI(x)		((unsigned int)(x) >> 2)
 
 #ifdef _KERNEL
 
@@ -127,6 +128,8 @@ extern void *vectab[NVECTORS];
 
 void	vec_init(void);
 void	vec_reset(void);
+void	*vec_get_entry(int);
+void	vec_set_entry(int, void *);
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/m68k/m68k/vectors.c
diff -u src/sys/arch/m68k/m68k/vectors.c:1.1 src/sys/arch/m68k/m68k/vectors.c:1.2
--- src/sys/arch/m68k/m68k/vectors.c:1.1	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/m68k/vectors.c	Sat Jan 13 18:42:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.c,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+/*	$NetBSD: vectors.c,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -29,6 +29,11 @@
  * POSSIBILITY OF SUCH DAMAGE.  
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_compat_sunos.h"
+#endif 
+
 #include 
 
 #include 
@@ -48,12 +53,12 @@ extern char badtrap[];
 extern char coperr[];
 extern char fmterr[];
 extern char trap0[];
-#ifdef COMPAT_13
+#if defined(COMPAT_13) || defined(COMPAT_SUNOS)
 extern char trap1[];
 #define	TRAP1_HANDLER		trap1
 #else
 #define	TRAP1_HANDLER		illinst
-#endif /* COMPAT_13 */
+#endif /* COMPAT_13 || COMPAT_SUNOS */
 extern char trap2[];
 #ifdef COMPAT_16
 extern char trap3[];
@@ -75,15 +80,39 @@ extern char MACHINE_AV5_HANDLER[];
 extern char MACHINE_AV6_HANDLER[];
 extern char MACHINE_AV7_HANDLER[];
 
-#ifndef __mc68010__
+#ifdef MACHINE_BUSERR_HANDLER
+extern char MACHINE_BUSERR_HANDLER[];
+#endif
+
+#ifdef MACHINE_ADDRERR_HANDLER
+extern char MACHINE_ADDRERR_HANDLER[];
+#endif
+
+#ifdef __mc68010__
+
+#define	BUSERR_HANDLER		MACHINE_BUSERR_HANDLER
+#define	ADDRERR_HANDLER		MACHINE_ADDRERR_HANDLER
+
+#else
 
 #if defined(M68020) || defined(M68030)
-extern char busaddrerr2030[];
+#ifdef MACHINE_BUSERR_HANDLER
+#define	BUSERR_HANDLER2030	MACHINE_BUSERR_HANDLER
+#else
+extern char buserr2030[];
+#define	BUSERR_HANDLER2030	buserr2030
+#endif
+#ifdef MACHINE_ADDRERR_HANDLER
+#define	ADDRERR_HANDLER2030	MACHINE_ADDRERR_HANDLER
+#else
+extern char addrerr2030[];
+#define	ADDRERR_HANDLER2030	addrerr2030
+#endif
 #if defined(M68040) || defined(M68060)
 #define	NEED_FIXUP_2030
 #else
-#define	BUSERR_HANDLER		busaddrerr2030
-#define	ADDRERR_HANDLER		busaddrerr2030
+#define	BUSERR_HANDLER		BUSERR_HANDLER2030
+#define	ADDRERR_HANDLER		ADDRERR_HANDLER2030
 #endif
 #endif /* M68020 || M68030 */
 
@@ -168,6 +197,14 @@ extern char FP_CALL_TOP[], I_CALL_TOP[];
 
 #endif /* __mc68010__ */
 
+#ifndef MACHINE_RESET_SP
+#define	MACHINE_RESET_SP	NULL
+#endif
+
+#ifndef MACHINE_RESET_PC
+#define	MACHINE_RESET_PC	NULL
+#endif
+
 #ifndef BUSERR_HANDLER
 #define	BUSERR_HANDLER		badtrap
 #endif
@@ -221,6 +258,8 @@ extern char FP_CALL_TOP[], I_CALL_TOP[];
 #endif
 
 void *vectab[NVECTORS] = {
+	[VECI_RIISP]		=	MACHINE_RESET_SP,
+	[VECI_RIPC]		=	MACHINE_RESET_PC,
 	[VECI_BUSERR]		=	BUSERR_HANDLER,
 	[VECI_ADDRERR]		=	ADDRERR_HANDLER,
 	[VECI_ILLINST]		=	illinst,
@@ -243,7 +282,7 @@ void *vectab[NVECTORS] = {
 	[VECI_rsvd21]		=	badtrap,
 	[VECI_rsvd22]		=	badtrap,
 	[VECI_rsvd23]		=	badtrap,
-	[VECI_SPURIOUS_INTR]	=	MACHINE_AV0_HANDLER,
+	[VECI_INTRAV0]		=	MACHINE_AV0_HANDLER,
 	

CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:42:11 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Provide some vector table override hooks and interfaces needed by the
sun68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/vectors.c

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



CVS commit: src/sys/arch/m68k/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:40:12 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
Add buserr2030 and addrerr2030 aliases to busaddrerr2030.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/busaddrerr.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/m68k/m68k/busaddrerr.s
diff -u src/sys/arch/m68k/m68k/busaddrerr.s:1.2 src/sys/arch/m68k/m68k/busaddrerr.s:1.3
--- src/sys/arch/m68k/m68k/busaddrerr.s:1.2	Sat Apr 29 03:17:30 2023
+++ src/sys/arch/m68k/m68k/busaddrerr.s	Sat Jan 13 18:40:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: busaddrerr.s,v 1.2 2023/04/29 03:17:30 isaki Exp $	*/
+/*	$NetBSD: busaddrerr.s,v 1.3 2024/01/13 18:40:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -159,6 +159,8 @@ Lberr40:
  */
 #if defined(M68020) || defined(M68030)
 ENTRY_NOPROFILE(busaddrerr2030)
+GLOBAL(buserr2030)
+GLOBAL(addrerr2030)
 	clrl	%sp@-			| stack adjust count
 	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
 	movl	%usp,%a0		| save the user SP



CVS commit: src/sys/arch/m68k/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:40:12 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
Add buserr2030 and addrerr2030 aliases to busaddrerr2030.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/busaddrerr.s

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 18:22:13 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Assert not polling in abort path.

XXX Not sure if this is safe.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.249 src/sys/dev/usb/usbdi.c:1.250
--- src/sys/dev/usb/usbdi.c:1.249	Sat Jan 13 12:42:10 2024
+++ src/sys/dev/usb/usbdi.c	Sat Jan 13 18:22:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -417,11 +417,9 @@ usbd_transfer(struct usbd_xfer *xfer)
 		 * XXX For synchronous transfers this is fine.  What to
 		 * do for asynchronous transfers?  The callback is
 		 * never run, not even with status USBD_CANCELLED.
-		 *
-		 * XXX Does it make sense to abort while polling?
 		 */
-		if (pipe->up_dev->ud_bus->ub_usepolling == 0)
-			usbd_unlock_pipe(pipe);
+		KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0);
+		usbd_unlock_pipe(pipe);
 		USBHIST_LOG(usbdebug, "<- done xfer %#jx, aborting",
 		(uintptr_t)xfer, 0, 0, 0);
 		SDT_PROBE2(usb, device, xfer, done,  xfer, USBD_CANCELLED);
@@ -1036,6 +1034,7 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
 
 	ASSERT_SLEEPABLE();
 	KASSERT(mutex_owned(pipe->up_dev->ud_bus->ub_lock));
+	KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0);
 
 	/*
 	 * Allow only one thread at a time to abort the pipe, so we



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 18:22:13 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Assert not polling in abort path.

XXX Not sure if this is safe.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/dev/usb/usbdi.c

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



CVS commit: src/sys/arch/virt68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:58 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: files.virt68k
src/sys/arch/virt68k/virt68k: locore.s machdep.c
Added Files:
src/sys/arch/virt68k/include: vectors.h
Removed Files:
src/sys/arch/virt68k/virt68k: vectors.s

Log Message:
Switch to common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/include/vectors.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/virt68k/machdep.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/virt68k/virt68k/vectors.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/virt68k/conf/files.virt68k
diff -u src/sys/arch/virt68k/conf/files.virt68k:1.3 src/sys/arch/virt68k/conf/files.virt68k:1.4
--- src/sys/arch/virt68k/conf/files.virt68k:1.3	Tue Jan  9 04:16:27 2024
+++ src/sys/arch/virt68k/conf/files.virt68k	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.virt68k,v 1.3 2024/01/09 04:16:27 thorpej Exp $
+#	$NetBSD: files.virt68k,v 1.4 2024/01/13 17:10:58 thorpej Exp $
 
 # config file for virt68k
 
@@ -51,6 +51,7 @@ file arch/m68k/m68k/mmu_subr.s
 file arch/m68k/m68k/pmap_motorola.c
 file arch/m68k/m68k/procfs_machdep.c		procfs
 file arch/m68k/m68k/sys_machdep.c
+file arch/m68k/m68k/vectors.c
 file arch/m68k/m68k/vm_machdep.c
 file dev/cons.c
 

Index: src/sys/arch/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.8 src/sys/arch/virt68k/virt68k/locore.s:1.9
--- src/sys/arch/virt68k/virt68k/locore.s:1.8	Fri Jan 12 23:36:30 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.8 2024/01/12 23:36:30 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.9 2024/01/13 17:10:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -72,8 +72,6 @@
 	.space	PAGE_SIZE
 ASLOCAL(tmpstk)
 
-#include 
-
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
@@ -128,36 +126,6 @@ ASENTRY_NOPROFILE(start)
 	movc	%d0,%cacr		| clear and disable on-chip cache(s)
 	/* XXX XXX XXX */
 
-	/*
-	 * bootinfo_start() will have determined what kind of CPU
-	 * we have, so it's time to fix up the vector table:
-	 *
-	 *	vectab+8	bus error
-	 *	vectab+12	address error
-	 */
-	RELOC(cputype, %a0)
-	movl#_C_LABEL(vectab),%a2
-	addl	%a5,%a2
-#if defined(M68040)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jne	1f			| no, skip
-	movl	#_C_LABEL(buserr40),%a2@(8)
-	movl	#_C_LABEL(addrerr4060),%a2@(12)
-	jra	Lstart1
-1:
-#endif /* M68040 */
-#if defined(M68030)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jeq	1f			| yes, skip
-	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
-	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
-	jra	Lstart1
-1:
-#endif /* M68030 */
-
-	/* Config botch.  No hope.  SOLDIER ON! */
-
-Lstart1:
 /* initialize source/destination control registers for movs */
 	moveq	#FC_USERD,%d0		| user space
 	movc	%d0,%sfc		|   as source
@@ -239,10 +207,8 @@ Lmotommu2:
  * Should be running mapped from this point on
  */
 Lenab1:
-/* Point the CPU VBR at our vector table */
-	movl	#_C_LABEL(vectab),%d0	| get our VBR address
-	movc	%d0,%vbr
-	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
+	lea	_ASM_LABEL(tmpstk),%sp	| re-load the temporary stack
+	jbsr	_C_LABEL(vec_init)	| initialize the vector table
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.7 src/sys/arch/virt68k/virt68k/machdep.c:1.8
--- src/sys/arch/virt68k/virt68k/machdep.c:1.7	Tue Jan  9 14:24:08 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.8 2024/01/13 17:10:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.8 2024/01/13 17:10:58 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -802,41 +802,7 @@ dumpsys(void)
 void
 initcpu(void)
 {
-#if defined(M68060)
-	extern void *vectab[256];
-#if defined(M060SP)
-	extern uint8_t I_CALL_TOP[];
-	extern uint8_t FP_CALL_TOP[];
-#else
-	extern uint8_t illinst;
-#endif
-	extern uint8_t fpfault;
-#endif
-
-#if defined(M68060)
-	if (cputype == CPU_68060) {
-#if defined(M060SP)
-		/* integer support */
-		vectab[61] = _CALL_TOP[128 + 0x00];
-
-		/* floating point support */
-		vectab[11] = _CALL_TOP[128 + 0x30];
-		vectab[55] = _CALL_TOP[128 + 0x38];
-		vectab[60] = _CALL_TOP[128 + 0x40];
-
-		vectab[54] = _CALL_TOP[128 + 0x00];
-		vectab[52] = _CALL_TOP[128 + 0x08];
-		vectab[53] = 

CVS commit: src/sys/arch/virt68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:58 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: files.virt68k
src/sys/arch/virt68k/virt68k: locore.s machdep.c
Added Files:
src/sys/arch/virt68k/include: vectors.h
Removed Files:
src/sys/arch/virt68k/virt68k: vectors.s

Log Message:
Switch to common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/include/vectors.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/virt68k/machdep.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/virt68k/virt68k/vectors.s

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



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:03 UTC 2024

Added Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Add a common vector table implementation for m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/vectors.c

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



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:03 UTC 2024

Added Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Add a common vector table implementation for m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/vectors.c

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

Added files:

Index: src/sys/arch/m68k/include/vectors.h
diff -u /dev/null src/sys/arch/m68k/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 17:10:03 2024
@@ -0,0 +1,133 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _M68K_VECTORS_H_
+#define	_M68K_VECTORS_H_
+
+/*
+ * Vector numbers (*4 for byte offset into table).
+ *
+ * VECI_RIISP and VECI_RIPC are fetched using Supervisor Program
+ * space.  The rest, Supervisor Data space.
+ *
+ * VECI_PMMU_ILLOP and VECI_PMMU_ACCESS are defined for the 68020, but
+ * not used on the 68030.
+ *
+ * VECI_CPV and VECI_PMMU_CONF are defined for the 68020 and 68030, but
+ * not used on the 68040 or 68060.
+ *
+ * VECI_UNIMP_FP_DATA, VECI_UNIMP_EA and VECI_UNIMP_II are defined for
+ * the 68060 and reserved on all other processors.
+ */
+#define	VECI_RIISP		0	/* Reset Initial Interrupt SP */
+#define	VECI_RIPC		1	/* Reset Initial PC */
+#define	VECI_BUSERR		2	/* Bus Error */
+#define	VECI_ADDRERR		3	/* Address Error */
+#define	VECI_ILLINST		4	/* Illegal Instruction */
+#define	VECI_ZERODIV		5	/* Zero Divide */
+#define	VECI_CHK		6	/* CHK, CHK2 instruction */
+#define	VECI_TRAPcc		7	/* cpTRAPcc, TRAPcc, TRAPV */
+#define	VECI_PRIV		8	/* Privilege Violation */
+#define	VECI_TRACE		9	/* Trace */
+#define	VECI_LINE1010		10	/* Line 1010 Emulator */
+#define	VECI_LINE		11	/* Line  Emulator */
+#define	VECI_rsvd12		12	/* unassigned, reserved */
+#define	VECI_CPV		13	/* Coprocessor Prototol Violation */
+#define	VECI_FORMATERR		14	/* Format Error */
+#define	VECI_UNINT_INTR		15	/* Uninitialized Interrupt */
+#define	VECI_rsvd16		16	/* unassigned, reserved */
+#define	VECI_rsvd17		17	/* unassigned, reserved */
+#define	VECI_rsvd18		18	/* unassigned, reserved */
+#define	VECI_rsvd19		19	/* unassigned, reserved */
+#define	VECI_rsvd20		20	/* unassigned, reserved */
+#define	VECI_rsvd21		21	/* unassigned, reserved */
+#define	VECI_rsvd22		22	/* unassigned, reserved */
+#define	VECI_rsvd23		23	/* unassigned, reserved */
+#define	VECI_SPURIOUS_INTR	24	/* Spurious Interrupt */
+#define	VECI_INTRAV1		25	/* Level 1 Interrupt Autovector */
+#define	VECI_INTRAV2		26	/* Level 2 Interrupt Autovector */
+#define	VECI_INTRAV3		27	/* Level 3 Interrupt Autovector */
+#define	VECI_INTRAV4		28	/* Level 4 Interrupt Autovector */
+#define	VECI_INTRAV5		29	/* Level 5 Interrupt Autovector */
+#define	VECI_INTRAV6		30	/* Level 6 Interrupt Autovector */
+#define	VECI_INTRAV7		31	/* Level 7 Interrupt Autovector */
+#define	VECI_TRAP0		32	/* Trap #0 instruction */
+#define	VECI_TRAP1		33	/* Trap #1 instruction */
+#define	VECI_TRAP2		34	/* Trap #2 instruction */
+#define	VECI_TRAP3		35	/* Trap #3 instruction */
+#define	VECI_TRAP4		36	/* Trap #4 instruction */
+#define	VECI_TRAP5		37	/* Trap #5 instruction */
+#define	VECI_TRAP6		38	/* Trap #6 instruction */
+#define	VECI_TRAP7		39	/* Trap 

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

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:07:26 UTC 2024

Modified Files:
src/sys/arch/m68k/include: frame.h

Log Message:
G/C some unused definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/frame.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/m68k/include/frame.h
diff -u src/sys/arch/m68k/include/frame.h:1.34 src/sys/arch/m68k/include/frame.h:1.35
--- src/sys/arch/m68k/include/frame.h:1.34	Fri Jan 12 23:46:52 2024
+++ src/sys/arch/m68k/include/frame.h	Sat Jan 13 17:07:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.34 2024/01/12 23:46:52 thorpej Exp $	*/
+/*	$NetBSD: frame.h,v 1.35 2024/01/13 17:07:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -70,10 +70,6 @@
 #define	FMTASIZE	sizeof(struct fmtA)
 #define	FMTBSIZE	sizeof(struct fmtB)
 
-#define	V_BUSERR	0x008
-#define	V_ADDRERR	0x00C
-#define	V_TRAP1		0x084
-
 /* 68010 SSW bits */
 #define SSW1_RR		0x8000
 #define SSW1_IF		0x2000



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

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:07:26 UTC 2024

Modified Files:
src/sys/arch/m68k/include: frame.h

Log Message:
G/C some unused definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/frame.h

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



CVS commit: src/sys/arch/riscv

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 17:01:58 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64
src/sys/arch/riscv/sifive: files.sifive
Added Files:
src/sys/arch/riscv/sifive: fu540_ccache.c

Log Message:
risc-v: add a SiFive FU[57]40/ L2 Cache controller driver


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/conf/GENERIC64
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/sifive/files.sifive
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/sifive/fu540_ccache.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/riscv/conf/GENERIC64
diff -u src/sys/arch/riscv/conf/GENERIC64:1.1 src/sys/arch/riscv/conf/GENERIC64:1.2
--- src/sys/arch/riscv/conf/GENERIC64:1.1	Sun May  7 12:41:48 2023
+++ src/sys/arch/riscv/conf/GENERIC64	Sat Jan 13 17:01:58 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC64,v 1.1 2023/05/07 12:41:48 skrll Exp $
+# $NetBSD: GENERIC64,v 1.2 2024/01/13 17:01:58 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -46,5 +46,8 @@ options 	DEBUG		# expensive debugging ch
 #options 	COMPAT_NETBSD32
 #options 	EXEC_ELF32
 
+# Cache controller
+ccache* 	at fdt?			# SiFive FU[57]40 L2 Cache
+
 # Pull in optional local configuration - always at end
 cinclude 	"arch/riscv/conf/GENERIC64.local"

Index: src/sys/arch/riscv/sifive/files.sifive
diff -u src/sys/arch/riscv/sifive/files.sifive:1.2 src/sys/arch/riscv/sifive/files.sifive:1.3
--- src/sys/arch/riscv/sifive/files.sifive:1.2	Sat Dec  3 09:40:56 2022
+++ src/sys/arch/riscv/sifive/files.sifive	Sat Jan 13 17:01:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sifive,v 1.2 2022/12/03 09:40:56 skrll Exp $
+#	$NetBSD: files.sifive,v 1.3 2024/01/13 17:01:58 skrll Exp $
 #
 # Configuration info for SiFive SoCs
 #
@@ -8,3 +8,8 @@
 device	prci
 attach	prci at fdt with fu540_prci
 file	arch/riscv/sifive/fu540_prci.c		fu540_prci
+
+# FU540 Level 2 Cache controller
+device	ccache: fdt
+attach	ccache at fdt with fu540_ccache
+file	arch/riscv/sifive/fu540_ccache.c	fu540_ccache

Added files:

Index: src/sys/arch/riscv/sifive/fu540_ccache.c
diff -u /dev/null src/sys/arch/riscv/sifive/fu540_ccache.c:1.1
--- /dev/null	Sat Jan 13 17:01:58 2024
+++ src/sys/arch/riscv/sifive/fu540_ccache.c	Sat Jan 13 17:01:58 2024
@@ -0,0 +1,226 @@
+/*	$NetBSD: fu540_ccache.c,v 1.1 2024/01/13 17:01:58 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLinIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: fu540_ccache.c,v 1.1 2024/01/13 17:01:58 skrll Exp $");
+
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+#define CCACHE_CONFIG			0x
+#define  CCACHE_CONFIG_BANKS_MASK		__BITS( 7,  0)
+#define  CCACHE_CONFIG_WAYS_MASK		__BITS(15,  8)
+#define  CCACHE_CONFIG_LGSETS_MASK		__BITS(23, 16)
+#define  CCACHE_CONFIG_LGBLOCKBYTES_MASK	__BITS(31, 24)
+#define CCACHE_WAYENABLE		0x0008
+
+#define CCACHE_ECCINJECTERROR		0x0040
+
+#define CCACHE_DIRECCFIX_LOW		0x0100
+#define CCACHE_DIRECCFIX_HIGH		0x0104
+#define CCACHE_DIRECCFIX_COUNT 		0x0108
+
+#define CCACHE_DIRECCFAIL_LOW		0x0120
+#define CCACHE_DIRECCFAIL_HIGH	 	0x0124
+#define CCACHE_DIRECCFAIL_COUNT 	0x0128
+
+#define CCACHE_DATECCFIX_LOW		0x0140
+#define CCACHE_DATECCFIX_HIGH		0x0144
+#define CCACHE_DATECCFIX_COUNT		0x0148
+
+#define CCACHE_DATECCFAIL_LOW		0x0160
+#define CCACHE_DATECCFAIL_HIGH		0x0164
+#define CCACHE_DATECCFAIL_COUNT		0x0168
+
+#define CCACHE_FLUSH64			0x0200
+#define CCACHE_FLUSH32			0x0250
+
+#define 

CVS commit: src/sys/arch/riscv

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 17:01:58 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC64
src/sys/arch/riscv/sifive: files.sifive
Added Files:
src/sys/arch/riscv/sifive: fu540_ccache.c

Log Message:
risc-v: add a SiFive FU[57]40/ L2 Cache controller driver


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/conf/GENERIC64
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/sifive/files.sifive
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/sifive/fu540_ccache.c

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



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

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 16:43:08 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC.common

Log Message:
Attach generic system controllers


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/conf/GENERIC.common

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/riscv/conf/GENERIC.common
diff -u src/sys/arch/riscv/conf/GENERIC.common:1.8 src/sys/arch/riscv/conf/GENERIC.common:1.9
--- src/sys/arch/riscv/conf/GENERIC.common:1.8	Sat Jan 13 16:36:32 2024
+++ src/sys/arch/riscv/conf/GENERIC.common	Sat Jan 13 16:43:08 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.8 2024/01/13 16:36:32 skrll Exp $
+#	$NetBSD: GENERIC.common,v 1.9 2024/01/13 16:43:08 skrll Exp $
 #
 #	GENERIC common RISC-V kernel config items shared between 32 and 64
 #	kernels
@@ -132,6 +132,9 @@ intc* 		at cpu? pass 1
 # Fixed Clocks
 fclock* 	at fdt? pass 1
 
+# System Controller
+syscon* 	at fdt? pass 1		# Generic System Controller
+
 # Core-level Interrupt Control block
 #clint0		at fdt? pass 2
 



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

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 16:43:08 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC.common

Log Message:
Attach generic system controllers


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/conf/GENERIC.common

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



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

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 16:36:32 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC.common

Log Message:
Group pass 1 attachments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/conf/GENERIC.common

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



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

2024-01-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 13 16:36:32 UTC 2024

Modified Files:
src/sys/arch/riscv/conf: GENERIC.common

Log Message:
Group pass 1 attachments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/conf/GENERIC.common

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/riscv/conf/GENERIC.common
diff -u src/sys/arch/riscv/conf/GENERIC.common:1.7 src/sys/arch/riscv/conf/GENERIC.common:1.8
--- src/sys/arch/riscv/conf/GENERIC.common:1.7	Sun Sep  3 08:48:19 2023
+++ src/sys/arch/riscv/conf/GENERIC.common	Sat Jan 13 16:36:32 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.7 2023/09/03 08:48:19 skrll Exp $
+#	$NetBSD: GENERIC.common,v 1.8 2024/01/13 16:36:32 skrll Exp $
 #
 #	GENERIC common RISC-V kernel config items shared between 32 and 64
 #	kernels
@@ -129,15 +129,15 @@ cpu* 		at fdt? pass 0
 
 intc* 		at cpu? pass 1
 
+# Fixed Clocks
+fclock* 	at fdt? pass 1
+
 # Core-level Interrupt Control block
 #clint0		at fdt? pass 2
 
 # Platform-Level Interrupt Controller
 plic* 		at fdt? pass 2
 
-# Clocks
-fclock* 	at fdt? pass 1
-
 # UART
 com* 		at fdt?			# UART
 



CVS commit: src/sys/dev/usb

2024-01-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat Jan 13 15:26:36 UTC 2024

Modified Files:
src/sys/dev/usb: ums.c

Log Message:
Add workaround for Microsoft Sculpt Wireless keyboard/mouse.

>From M. Boerschig in PR 57845.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/ums.c

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

Modified files:

Index: src/sys/dev/usb/ums.c
diff -u src/sys/dev/usb/ums.c:1.104 src/sys/dev/usb/ums.c:1.105
--- src/sys/dev/usb/ums.c:1.104	Thu Jul 20 20:00:34 2023
+++ src/sys/dev/usb/ums.c	Sat Jan 13 15:26:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $	*/
+/*	$NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -224,6 +224,7 @@ ums_attach(device_t parent, device_t sel
 			fixpos = 24;
 			break;
 		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80:
+		case USB_PRODUCT_MICROSOFT_24GHZ_XCVR90:
 			fixpos = 40;
 			woffset = sc->sc_ms.hidms_loc_z.size;
 			break;



CVS commit: src/sys/dev/usb

2024-01-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat Jan 13 15:26:36 UTC 2024

Modified Files:
src/sys/dev/usb: ums.c

Log Message:
Add workaround for Microsoft Sculpt Wireless keyboard/mouse.

>From M. Boerschig in PR 57845.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/ums.c

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat Jan 13 15:22:41 UTC 2024

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.804 -r1.805 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat Jan 13 14:42:14 UTC 2024

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add Microsoft Sculpt Wireless keyboard/mouse.

>From M. Boerschig in PR 57845.


To generate a diff of this commit:
cvs rdiff -u -r1.812 -r1.813 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat Jan 13 14:42:14 UTC 2024

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add Microsoft Sculpt Wireless keyboard/mouse.

>From M. Boerschig in PR 57845.


To generate a diff of this commit:
cvs rdiff -u -r1.812 -r1.813 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.812 src/sys/dev/usb/usbdevs:1.813
--- src/sys/dev/usb/usbdevs:1.812	Sat Jan  6 00:24:07 2024
+++ src/sys/dev/usb/usbdevs	Sat Jan 13 14:42:14 2024
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.812 2024/01/06 00:24:07 maya Exp $
+$NetBSD: usbdevs,v 1.813 2024/01/13 14:42:14 hgutch Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2368,6 +2368,7 @@ product MICROSOFT 24GHZ_XCVR10		0x071d	2
 product MICROSOFT 24GHZ_XCVR20		0x071f	2.4GHz Transceiver V2.0
 product MICROSOFT 24GHZ_XCVR70		0x0745	2.4GHz Transceiver V7.0
 product MICROSOFT 24GHZ_XCVR80		0x07b2	2.4GHz Transceiver V8.0
+product MICROSOFT 24GHZ_XCVR90		0x07a5	2.4GHz Transceiver V9.0
 product MICROSOFT CM6000		0x077d	Comfort Mouse 6000
 
 



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 12:42:10 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Avoid taking locks in usbd_transfer while polling.

PR kern/57783

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.248 src/sys/dev/usb/usbdi.c:1.249
--- src/sys/dev/usb/usbdi.c:1.248	Sat Jan 13 12:27:54 2024
+++ src/sys/dev/usb/usbdi.c	Sat Jan 13 12:42:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -410,14 +410,18 @@ usbd_transfer(struct usbd_xfer *xfer)
 		}
 	}
 
-	usbd_lock_pipe(pipe);
+	if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+		usbd_lock_pipe(pipe);
 	if (pipe->up_aborting) {
 		/*
 		 * XXX For synchronous transfers this is fine.  What to
 		 * do for asynchronous transfers?  The callback is
 		 * never run, not even with status USBD_CANCELLED.
+		 *
+		 * XXX Does it make sense to abort while polling?
 		 */
-		usbd_unlock_pipe(pipe);
+		if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+			usbd_unlock_pipe(pipe);
 		USBHIST_LOG(usbdebug, "<- done xfer %#jx, aborting",
 		(uintptr_t)xfer, 0, 0, 0);
 		SDT_PROBE2(usb, device, xfer, done,  xfer, USBD_CANCELLED);
@@ -443,7 +447,8 @@ usbd_transfer(struct usbd_xfer *xfer)
 	} while (0);
 	SDT_PROBE3(usb, device, pipe, transfer__done,  pipe, xfer, err);
 
-	usbd_unlock_pipe(pipe);
+	if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+		usbd_unlock_pipe(pipe);
 
 	if (err != USBD_IN_PROGRESS && err) {
 		/*
@@ -453,7 +458,8 @@ usbd_transfer(struct usbd_xfer *xfer)
 		 */
 		USBHIST_LOG(usbdebug, "xfer failed: %jd, reinserting",
 		err, 0, 0, 0);
-		usbd_lock_pipe(pipe);
+		if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+			usbd_lock_pipe(pipe);
 		SDT_PROBE1(usb, device, xfer, preabort,  xfer);
 #ifdef DIAGNOSTIC
 		xfer->ux_state = XFER_BUSY;
@@ -461,7 +467,8 @@ usbd_transfer(struct usbd_xfer *xfer)
 		SIMPLEQ_REMOVE_HEAD(>up_queue, ux_next);
 		if (pipe->up_serialise)
 			usbd_start_next(pipe);
-		usbd_unlock_pipe(pipe);
+		if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+			usbd_unlock_pipe(pipe);
 	}
 
 	if (!(flags & USBD_SYNCHRONOUS)) {
@@ -480,7 +487,8 @@ usbd_transfer(struct usbd_xfer *xfer)
 	}
 
 	/* Sync transfer, wait for completion. */
-	usbd_lock_pipe(pipe);
+	if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+		usbd_lock_pipe(pipe);
 	while (!xfer->ux_done) {
 		if (pipe->up_dev->ud_bus->ub_usepolling)
 			panic("usbd_transfer: not done");
@@ -503,7 +511,8 @@ usbd_transfer(struct usbd_xfer *xfer)
 	}
 	err = xfer->ux_status;
 	SDT_PROBE2(usb, device, xfer, done,  xfer, err);
-	usbd_unlock_pipe(pipe);
+	if (pipe->up_dev->ud_bus->ub_usepolling == 0)
+		usbd_unlock_pipe(pipe);
 	return err;
 }
 



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 12:42:10 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Avoid taking locks in usbd_transfer while polling.

PR kern/57783

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/dev/usb/usbdi.c

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 12:27:54 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/dev/usb/usbdi.c

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



CVS commit: src/sys/dev/usb

2024-01-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jan 13 12:27:54 UTC 2024

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.247 src/sys/dev/usb/usbdi.c:1.248
--- src/sys/dev/usb/usbdi.c:1.247	Tue Sep 13 10:32:58 2022
+++ src/sys/dev/usb/usbdi.c	Sat Jan 13 12:27:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.247 2022/09/13 10:32:58 riastradh Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.247 2022/09/13 10:32:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1362,14 +1362,34 @@ usbd_dopoll(struct usbd_interface *iface
 void
 usbd_set_polling(struct usbd_device *dev, int on)
 {
-	if (on)
-		dev->ud_bus->ub_usepolling++;
-	else
-		dev->ud_bus->ub_usepolling--;
 
-	/* Kick the host controller when switching modes */
 	mutex_enter(dev->ud_bus->ub_lock);
-	dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	if (on) {
+		/*
+		 * Enabling polling.  If we're enabling for the first
+		 * time, call the softint routine on transition while
+		 * we hold the lock and polling is still disabled, and
+		 * then enable polling -- once polling is enabled, we
+		 * must not hold the lock when we call the softint
+		 * routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling < __type_max(char));
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+		dev->ud_bus->ub_usepolling++;
+	} else {
+		/*
+		 * Disabling polling.  If we're disabling polling for
+		 * the last time, disable polling first and then call
+		 * the softint routine while we hold the lock -- until
+		 * polling is disabled, we must not hold the lock when
+		 * we call the softint routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling > 0);
+		dev->ud_bus->ub_usepolling--;
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	}
 	mutex_exit(dev->ud_bus->ub_lock);
 }
 



CVS commit: src/usr.bin/xlint/lint1

2024-01-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 13 11:24:57 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cgram.y init.c

Log Message:
lint: clean up grammar for initializers


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.482 src/usr.bin/xlint/lint1/cgram.y:1.483
--- src/usr.bin/xlint/lint1/cgram.y:1.482	Sat Jan 13 01:23:39 2024
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Jan 13 11:24:57 2024
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.482 2024/01/13 01:23:39 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.483 2024/01/13 11:24:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.482 2024/01/13 01:23:39 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.483 2024/01/13 11:24:57 rillig Exp $");
 #endif
 
 #include 
@@ -295,7 +295,6 @@ is_either(const char *s, const char *a, 
 %type		generic_assoc_list
 %type		generic_association
 %type		postfix_expression
-/* No type for comma_opt. */
 %type		gcc_statement_expr_list
 %type		gcc_statement_expr_item
 %type			point_or_arrow
@@ -373,7 +372,6 @@ is_either(const char *s, const char *a, 
 /* No type for braced_initializer. */
 /* No type for initializer. */
 /* No type for initializer_list. */
-/* No type for initializer_list_item. */
 /* No type for designation. */
 /* No type for designator_list. */
 /* No type for designator. */
@@ -591,11 +589,6 @@ postfix_expression:
 	}
 ;
 
-comma_opt:			/* helper for 'postfix_expression' */
-	/* empty */
-|	T_COMMA
-;
-
 /*
  * The inner part of a GCC statement-expression of the form ({ ... }).
  *
@@ -1636,7 +1629,8 @@ braced_initializer:
 		c23ism(353);
 	}
 	/* K ---, C90 ---, C99 6.7.8, C11 6.7.9, C23 6.7.10 */
-|	init_lbrace initializer_list comma_opt init_rbrace
+|	init_lbrace initializer_list init_rbrace
+|	init_lbrace initializer_list T_COMMA init_rbrace
 ;
 
 initializer:			/* C99 6.7.8 "Initialization" */
@@ -1646,23 +1640,21 @@ initializer:			/* C99 6.7.8 "Initializat
 |	init_lbrace init_rbrace {
 		/* XXX: Empty braces are not covered by C99 6.7.8. */
 	}
-|	init_lbrace initializer_list comma_opt init_rbrace
+|	init_lbrace initializer_list init_rbrace
+|	init_lbrace initializer_list T_COMMA init_rbrace
 	/* XXX: What is this error handling for? */
 |	error
 ;
 
 initializer_list:		/* C99 6.7.8 "Initialization" */
-	initializer_list_item
-|	initializer_list T_COMMA initializer_list_item
-;
-
-initializer_list_item:		/* helper */
-	designation initializer
-|	initializer
+	initializer
+|	designation initializer
+|	initializer_list T_COMMA initializer
+|	initializer_list T_COMMA designation initializer
 ;
 
 designation:			/* C99 6.7.8 "Initialization" */
-	/* empty */ {
+	{
 		begin_designation();
 	} designator_list T_ASSIGN
 |	identifier T_COLON {

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.255 src/usr.bin/xlint/lint1/init.c:1.256
--- src/usr.bin/xlint/lint1/init.c:1.255	Thu Jan 11 23:26:39 2024
+++ src/usr.bin/xlint/lint1/init.c	Sat Jan 13 11:24:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.255 2024/01/11 23:26:39 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.256 2024/01/13 11:24:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: init.c,v 1.255 2024/01/11 23:26:39 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.256 2024/01/13 11:24:57 rillig Exp $");
 #endif
 
 #include 
@@ -992,10 +992,9 @@ begin_designation(void)
 	if (in->in_err)
 		return;
 
-	brace_level *bl = in->in_brace_level;
-	lint_assert(bl != NULL);
-	bl->bl_designation.dn_len = 0;
-	designation_debug(>bl_designation);
+	designation *dn = >in_brace_level->bl_designation;
+	dn->dn_len = 0;
+	designation_debug(dn);
 }
 
 void



CVS commit: src/usr.bin/xlint/lint1

2024-01-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Jan 13 11:24:57 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: cgram.y init.c

Log Message:
lint: clean up grammar for initializers


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/sys/uvm

2024-01-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 13 09:44:42 UTC 2024

Modified Files:
src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h

Log Message:
uvm: change type of uvm_physseg.start_hint from u_int to u_long

Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs.
PR kern/57683.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.h

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



CVS commit: src/sys/uvm

2024-01-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jan 13 09:44:42 UTC 2024

Modified Files:
src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h

Log Message:
uvm: change type of uvm_physseg.start_hint from u_int to u_long

Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs.
PR kern/57683.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.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/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.90 src/sys/uvm/uvm_pglist.c:1.91
--- src/sys/uvm/uvm_pglist.c:1.90	Tue Dec 21 08:27:49 2021
+++ src/sys/uvm/uvm_pglist.c	Sat Jan 13 09:44:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $");
 
 #include 
 #include 
@@ -112,8 +112,9 @@ static int
 uvm_pglistalloc_c_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high,
 paddr_t alignment, paddr_t boundary, struct pglist *rlist)
 {
-	signed int candidate, limit, candidateidx, end, idx, skip;
-	int pagemask;
+	long candidate, limit, candidateidx, end, idx;
+	int skip;
+	long pagemask;
 	bool second_pass;
 #ifdef DEBUG
 	paddr_t idxpa, lastidxpa;
@@ -138,9 +139,9 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 	 * succeeded.
 	 */
 	alignment = atop(alignment);
-	candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi) +
+	candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi) +
 		uvm_physseg_get_start_hint(psi)), alignment);
-	limit = uimin(high, uvm_physseg_get_avail_end(psi));
+	limit = ulmin(high, uvm_physseg_get_avail_end(psi));
 	pagemask = ~((boundary >> PAGE_SHIFT) - 1);
 	skip = 0;
 	second_pass = false;
@@ -162,8 +163,8 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 			 * is were we started.
 			 */
 			second_pass = true;
-			candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi)), alignment);
-			limit = uimin(limit, uvm_physseg_get_avail_start(psi) +
+			candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi)), alignment);
+			limit = ulmin(limit, uvm_physseg_get_avail_start(psi) +
 			uvm_physseg_get_start_hint(psi));
 			skip = 0;
 			continue;
@@ -200,7 +201,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 		 * Found a suitable starting page.  See if the range is free.
 		 */
 #ifdef PGALLOC_VERBOSE
-		printf("%s: psi=%d candidate=%#x end=%#x skip=%#x, align=%#"PRIxPADDR,
+		printf("%s: psi=%d candidate=%#lx end=%#lx skip=%#x, align=%#"PRIxPADDR,
 		__func__, psi, candidateidx, end, skip, alignment);
 #endif
 		/*
@@ -283,7 +284,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, 
 	uvm_physseg_get_avail_start(psi));
 	KASSERTMSG(uvm_physseg_get_start_hint(psi) <=
 	uvm_physseg_get_avail_end(psi) - uvm_physseg_get_avail_start(psi),
-	"%x %u (%#x) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
+	"%lx %lu (%#lx) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")",
 	candidate + num,
 	uvm_physseg_get_start_hint(psi), uvm_physseg_get_start_hint(psi),
 	uvm_physseg_get_avail_end(psi), uvm_physseg_get_avail_start(psi),
@@ -523,7 +524,8 @@ static int
 uvm_pglistalloc_s_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high,
 struct pglist *rlist)
 {
-	int todo, limit, candidate;
+	int todo;
+	long limit, candidate;
 	struct vm_page *pg;
 	bool second_pass;
 #ifdef PGALLOC_VERBOSE
@@ -546,9 +548,9 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, 
 		return -1;
 
 	todo = num;
-	candidate = uimax(low, uvm_physseg_get_avail_start(psi) +
+	candidate = ulmax(low, uvm_physseg_get_avail_start(psi) +
 	uvm_physseg_get_start_hint(psi));
-	limit = uimin(high, uvm_physseg_get_avail_end(psi));
+	limit = ulmin(high, uvm_physseg_get_avail_end(psi));
 	pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi));
 	second_pass = false;
 
@@ -560,8 +562,8 @@ again:
 break;
 			}
 			second_pass = true;
-			candidate = uimax(low, uvm_physseg_get_avail_start(psi));
-			limit = uimin(limit, uvm_physseg_get_avail_start(psi) +
+			candidate = ulmax(low, uvm_physseg_get_avail_start(psi));
+			limit = ulmin(limit, uvm_physseg_get_avail_start(psi) +
 			uvm_physseg_get_start_hint(psi));
 			pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi));
 			goto again;
@@ -571,10 +573,10 @@ again:
 			paddr_t cidx = 0;
 			const uvm_physseg_t bank = uvm_physseg_find(candidate, );
 			KDASSERTMSG(bank == psi,
-			"uvm_physseg_find(%#x) (%"PRIxPHYSSEG ") != psi %"PRIxPHYSSEG,
+			"uvm_physseg_find(%#lx)