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

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

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

Log Message:
What good are comments, really, if you can't have a little color?  Add
a note above CLKF_INTR() about why NetBSD will likely never switch to
using the "master" stack for the kernel, and thus why the not-enabled
version of CLKF_INTR() will never be enabled.

(Adding the comment here, rather than just deleting the code, has value,
I think, for future retrocomputing archeologists.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/cpu.h

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

Modified files:

Index: src/sys/arch/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.22 src/sys/arch/m68k/include/cpu.h:1.23
--- src/sys/arch/m68k/include/cpu.h:1.22	Sat Jan 20 00:15:31 2024
+++ src/sys/arch/m68k/include/cpu.h	Sat Jan 20 02:23:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.22 2024/01/20 00:15:31 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.23 2024/01/20 02:23:15 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -168,6 +168,13 @@ struct clockframe {
  *
  * XXX Actually, we can't, because we don't use the master stack
  * XXX right now.
+ *
+ * (Actually, it's unlikely that we'll ever use the master stack in NetBSD.
+ * It would complicate the spl*() functions considerably and it just doesn't
+ * seem like a good trade-off for what seems like extremely marginal gains.
+ * So, just blissfully run the kernel on the interrupt stack all the time,
+ * and it's been that way for >30 years and no one has really complained
+ * about it.)
  */
 #define	CLKF_INTR(framep)	(((framep)->cf_sr & PSL_M) == 0)
 #else



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

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

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

Log Message:
What good are comments, really, if you can't have a little color?  Add
a note above CLKF_INTR() about why NetBSD will likely never switch to
using the "master" stack for the kernel, and thus why the not-enabled
version of CLKF_INTR() will never be enabled.

(Adding the comment here, rather than just deleting the code, has value,
I think, for future retrocomputing archeologists.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/cpu.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/virt68k/include

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

Modified Files:
src/sys/arch/virt68k/include: aout_machdep.h cdefs.h db_machdep.h
elf_machdep.h ieeefp.h kcore.h lock.h ptrace.h reg.h

Log Message:
Hygiene.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/aout_machdep.h \
src/sys/arch/virt68k/include/cdefs.h \
src/sys/arch/virt68k/include/db_machdep.h \
src/sys/arch/virt68k/include/elf_machdep.h \
src/sys/arch/virt68k/include/ieeefp.h \
src/sys/arch/virt68k/include/kcore.h src/sys/arch/virt68k/include/lock.h \
src/sys/arch/virt68k/include/ptrace.h src/sys/arch/virt68k/include/reg.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/virt68k/include

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

Modified Files:
src/sys/arch/virt68k/include: aout_machdep.h cdefs.h db_machdep.h
elf_machdep.h ieeefp.h kcore.h lock.h ptrace.h reg.h

Log Message:
Hygiene.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/aout_machdep.h \
src/sys/arch/virt68k/include/cdefs.h \
src/sys/arch/virt68k/include/db_machdep.h \
src/sys/arch/virt68k/include/elf_machdep.h \
src/sys/arch/virt68k/include/ieeefp.h \
src/sys/arch/virt68k/include/kcore.h src/sys/arch/virt68k/include/lock.h \
src/sys/arch/virt68k/include/ptrace.h src/sys/arch/virt68k/include/reg.h

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

Modified files:

Index: src/sys/arch/virt68k/include/aout_machdep.h
diff -u src/sys/arch/virt68k/include/aout_machdep.h:1.1 src/sys/arch/virt68k/include/aout_machdep.h:1.2
--- src/sys/arch/virt68k/include/aout_machdep.h:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/include/aout_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: aout_machdep.h,v 1.1 2024/01/02 07:40:59 thorpej Exp $	*/
-
-#ifndef _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
+/*	$NetBSD: aout_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif  /* _MACHINE_EXEC_H_ */
Index: src/sys/arch/virt68k/include/cdefs.h
diff -u src/sys/arch/virt68k/include/cdefs.h:1.1 src/sys/arch/virt68k/include/cdefs.h:1.2
--- src/sys/arch/virt68k/include/cdefs.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/cdefs.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: cdefs.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
+/*	$NetBSD: cdefs.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/db_machdep.h
diff -u src/sys/arch/virt68k/include/db_machdep.h:1.1 src/sys/arch/virt68k/include/db_machdep.h:1.2
--- src/sys/arch/virt68k/include/db_machdep.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/db_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,6 +1,3 @@
-/*	$NetBSD: db_machdep.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
-
-#define DB_ELF_SYMBOLS
Index: src/sys/arch/virt68k/include/elf_machdep.h
diff -u src/sys/arch/virt68k/include/elf_machdep.h:1.1 src/sys/arch/virt68k/include/elf_machdep.h:1.2
--- src/sys/arch/virt68k/include/elf_machdep.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/elf_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: elf_machdep.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_ELF_MACHDEP_H_
-#define _MACHINE_ELF_MACHDEP_H_
+/*	$NetBSD: elf_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/ieeefp.h
diff -u src/sys/arch/virt68k/include/ieeefp.h:1.1 src/sys/arch/virt68k/include/ieeefp.h:1.2
--- src/sys/arch/virt68k/include/ieeefp.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/ieeefp.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: ieeefp.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: ieeefp.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/kcore.h
diff -u src/sys/arch/virt68k/include/kcore.h:1.1 src/sys/arch/virt68k/include/kcore.h:1.2
--- src/sys/arch/virt68k/include/kcore.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/kcore.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: kcore.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_KCORE_H_
-#define _MACHINE_KCORE_H_
+/*	$NetBSD: kcore.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/lock.h
diff -u src/sys/arch/virt68k/include/lock.h:1.1 src/sys/arch/virt68k/include/lock.h:1.2
--- src/sys/arch/virt68k/include/lock.h:1.1	Tue Jan  2 07:41:01 2024
+++ src/sys/arch/virt68k/include/lock.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: lock.h,v 1.1 2024/01/02 07:41:01 thorpej Exp $	*/
+/*	$NetBSD: lock.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/ptrace.h
diff -u src/sys/arch/virt68k/include/ptrace.h:1.1 src/sys/arch/virt68k/include/ptrace.h:1.2
--- src/sys/arch/virt68k/include/ptrace.h:1.1	Tue Jan  2 07:41:01 2024
+++ src/sys/arch/virt68k/include/ptrace.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: ptrace.h,v 1.1 2024/01/02 07:41:01 thorpej Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/reg.h
diff -u src/sys/arch/virt68k/include/reg.h:1.1 src/sys/arch/virt68

CVS commit: src/sys/dev/usb

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:51:29 UTC 2024

Modified Files:
src/sys/dev/usb: ehcivar.h

Log Message:
ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/ehcivar.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/dev/usb/ehcivar.h
diff -u src/sys/dev/usb/ehcivar.h:1.51 src/sys/dev/usb/ehcivar.h:1.52
--- src/sys/dev/usb/ehcivar.h:1.51	Sun Mar 13 11:29:21 2022
+++ src/sys/dev/usb/ehcivar.h	Sat Jan 20 00:51:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcivar.h,v 1.51 2022/03/13 11:29:21 riastradh Exp $ */
+/*	$NetBSD: ehcivar.h,v 1.52 2024/01/20 00:51:29 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -178,6 +178,7 @@ typedef struct ehci_softc {
 	int sc_flags;			/* misc flags */
 #define EHCIF_DROPPED_INTR_WORKAROUND	0x01
 #define EHCIF_ETTF			0x02 /* Emb. Transaction Translater func. */
+#define EHCIF_32BIT_ACCESS		0x04 /* 32-bit MMIO access req'd */
 
 	uint32_t sc_cmd;		/* shadow of cmd reg during suspend */
 
@@ -235,17 +236,75 @@ typedef struct ehci_softc {
 	int (*sc_vendor_port_status)(struct ehci_softc *, uint32_t, int);
 } ehci_softc_t;
 
-#define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))
-#define EREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (a))
+static inline uint8_t
+ehci_read_1(struct ehci_softc *sc, u_int offset)
+{
+	if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) {
+		uint32_t val;
+
+		val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3);
+		return (val >> ((offset & 3) * NBBY)) & 0xff;
+	} else {
+		return bus_space_read_1(sc->iot, sc->ioh, offset);
+	}
+}
+
+static inline uint16_t
+ehci_read_2(struct ehci_softc *sc, u_int offset)
+{
+	if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) {
+		uint32_t val;
+
+		val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3);
+		return (val >> ((offset & 3) * NBBY)) & 0x;
+	} else {
+		return bus_space_read_2(sc->iot, sc->ioh, offset);
+	}
+}
+
+static inline void
+ehci_write_1(struct ehci_softc *sc, u_int offset, uint8_t data)
+{
+	if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) {
+		const uint32_t mask = 0xffU << ((offset & 3) * NBBY);
+		uint32_t val;
+
+		val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3);
+		val &= ~mask;
+		val |= __SHIFTIN(data, mask);
+		bus_space_write_4(sc->iot, sc->ioh, offset & ~3, val);
+	} else {
+		bus_space_write_1(sc->iot, sc->ioh, offset, data);
+	}
+}
+
+static inline void
+ehci_write_2(struct ehci_softc *sc, u_int offset, uint16_t data)
+{
+	if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) {
+		const uint32_t mask = 0xU << ((offset & 3) * NBBY);
+		uint32_t val;
+
+		val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3);
+		val &= ~mask;
+		val |= __SHIFTIN(data, mask);
+		bus_space_write_4(sc->iot, sc->ioh, offset & ~3, val);
+	} else {
+		bus_space_write_2(sc->iot, sc->ioh, offset, data);
+	}
+}
+
+#define EREAD1(sc, a) ehci_read_1((sc), (a))
+#define EREAD2(sc, a) ehci_read_2((sc), (a))
 #define EREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (a))
-#define EWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (a), (x))
-#define EWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (a), (x))
+#define EWRITE1(sc, a, x) ehci_write_1((sc), (a), (x))
+#define EWRITE2(sc, a, x) ehci_write_2((sc), (a), (x))
 #define EWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (a), (x))
-#define EOREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
-#define EOREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
+#define EOREAD1(sc, a) ehci_read_1((sc), (sc)->sc_offs+(a))
+#define EOREAD2(sc, a) ehci_read_2((sc), (sc)->sc_offs+(a))
 #define EOREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
-#define EOWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
-#define EOWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
+#define EOWRITE1(sc, a, x) ehci_write_1((sc), (sc)->sc_offs+(a), (x))
+#define EOWRITE2(sc, a, x) ehci_write_2((sc), (sc)->sc_offs+(a), (x))
 #define EOWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
 
 int		ehci_init(ehci_softc_t *);



CVS commit: src/sys/dev/usb

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:51:29 UTC 2024

Modified Files:
src/sys/dev/usb: ehcivar.h

Log Message:
ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/ehcivar.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/wsfb

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:24:58 UTC 2024

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
wsfb: add support for optional "devcmap" property

A hardware driver can supply a pointer to a 16x 32-bit array to override
the default rasops device colour map in the "devcmap" property.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.90 src/sys/dev/wsfb/genfb.c:1.91
--- src/sys/dev/wsfb/genfb.c:1.90	Mon Aug  1 23:30:10 2022
+++ src/sys/dev/wsfb/genfb.c	Sat Jan 20 00:24:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.90 2022/08/01 23:30:10 riastradh Exp $ */
+/*	$NetBSD: genfb.c,v 1.91 2024/01/20 00:24:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.90 2022/08/01 23:30:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.91 2024/01/20 00:24:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -85,6 +85,7 @@ struct genfb_private {
 	struct genfb_parameter_callback *sc_backlight;
 	struct genfb_parameter_callback *sc_brightness;
 	struct genfb_mode_callback *sc_modecb;
+	uint32_t *sc_devcmap;
 	int sc_backlight_level, sc_backlight_on;
 	void *sc_shadowfb;
 	bool sc_enable_shadowfb;
@@ -167,7 +168,7 @@ genfb_init(struct genfb_softc *sc)
 {
 	struct genfb_private *scp;
 	prop_dictionary_t dict;
-	uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr;
+	uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, devcmap, fbaddr;
 	uint64_t fboffset;
 	bool console;
 
@@ -225,6 +226,13 @@ genfb_init(struct genfb_softc *sc)
 
 	sc->sc_fbsize = sc->sc_height * sc->sc_stride;
 
+	/* optional device colour map */
+	scp->sc_devcmap = NULL;
+	if (prop_dictionary_get_uint64(dict, "devcmap", &devcmap)) {
+		if (devcmap != 0)
+			scp->sc_devcmap = (uint32_t *)(uintptr_t)devcmap;
+	}
+
 	/* optional colour map callback */
 	scp->sc_cmcb = NULL;
 	if (prop_dictionary_get_uint64(dict, "cmap_callback", &cmap_cb)) {
@@ -721,6 +729,10 @@ genfb_init_screen(void *cookie, struct v
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 	sc->sc_width / ri->ri_font->fontwidth);
 
+	if (scp->sc_devcmap != NULL) {
+		memcpy(ri->ri_devcmap, scp->sc_devcmap, sizeof(ri->ri_devcmap));
+	}
+
 	ri->ri_hw = scr;
 #if GENFB_GLYPHCACHE > 0
 	scp->sc_putchar = ri->ri_ops.putchar;



CVS commit: src/sys/dev/wsfb

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:24:58 UTC 2024

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
wsfb: add support for optional "devcmap" property

A hardware driver can supply a pointer to a 16x 32-bit array to override
the default rasops device colour map in the "devcmap" property.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/wsfb/genfb.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/wscons

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:23:13 UTC 2024

Modified Files:
src/sys/dev/wscons: wsconsio.h

Log Message:
wscons: Add HOLLYWOOD display and YUY2 pixel format types


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/wscons/wsconsio.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/dev/wscons/wsconsio.h
diff -u src/sys/dev/wscons/wsconsio.h:1.126 src/sys/dev/wscons/wsconsio.h:1.127
--- src/sys/dev/wscons/wsconsio.h:1.126	Tue Sep 28 06:14:27 2021
+++ src/sys/dev/wscons/wsconsio.h	Sat Jan 20 00:23:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.126 2021/09/28 06:14:27 nia Exp $ */
+/* $NetBSD: wsconsio.h,v 1.127 2024/01/20 00:23:12 jmcneill Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -366,6 +366,7 @@ struct wsmouse_parameters {
 #define	WSDISPLAY_TYPE_PLATINUM	64	/* onboard fb in PowerMac 7200 */
 #define	WSDISPLAY_TYPE_PLFB	65	/* ARM PrimeCell PL11x */
 #define	WSDISPLAY_TYPE_SSDFB	66	/* ssdfb(4) */
+#define	WSDISPLAY_TYPE_HOLLYWOOD 67	/* Nintendo Wii "Hollywood" SoC */
 
 /* Basic display information.  Not applicable to all display types. */
 struct wsdisplay_fbinfo {
@@ -649,6 +650,7 @@ struct wsdisplayio_edid_info {
 #define WSFB_CI		1	/* colour indexed, see subtype */
 #define WSFB_GREYSCALE	2
 #define WSFB_YUV	3
+#define WSFB_YUY2	4
 
 struct wsdisplayio_fbinfo {
 	uint64_t fbi_fbsize;		/* framebuffer size in bytes */



CVS commit: src/sys/dev/wscons

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:23:13 UTC 2024

Modified Files:
src/sys/dev/wscons: wsconsio.h

Log Message:
wscons: Add HOLLYWOOD display and YUY2 pixel format types


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/wscons/wsconsio.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/sdmmc

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:22:11 UTC 2024

Modified Files:
src/sys/dev/sdmmc: sdhc.c sdhcvar.h

Log Message:
sdmmc: add support for optional delay after register write


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sdmmc/sdhcvar.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/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.117 src/sys/dev/sdmmc/sdhc.c:1.118
--- src/sys/dev/sdmmc/sdhc.c:1.117	Wed Nov  2 10:38:04 2022
+++ src/sys/dev/sdmmc/sdhc.c	Sat Jan 20 00:22:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.117 2022/11/02 10:38:04 jmcneill Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.117 2022/11/02 10:38:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.118 2024/01/20 00:22:11 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -142,6 +142,9 @@ hwrite1(struct sdhc_host *hp, bus_size_t
 		tmp = (val << shift) | (tmp & ~(0xffU << shift));
 		bus_space_write_4(hp->iot, hp->ioh, o, tmp);
 	}
+	if (hp->sc->sc_write_delay != 0) {
+		delay(hp->sc->sc_write_delay);
+	}
 }
 
 static void
@@ -157,6 +160,9 @@ hwrite2(struct sdhc_host *hp, bus_size_t
 		tmp = (val << shift) | (tmp & ~(0xU << shift));
 		bus_space_write_4(hp->iot, hp->ioh, o, tmp);
 	}
+	if (hp->sc->sc_write_delay != 0) {
+		delay(hp->sc->sc_write_delay);
+	}
 }
 
 static void
@@ -164,6 +170,9 @@ hwrite4(struct sdhc_host *hp, bus_size_t
 {
 
 	bus_space_write_4(hp->iot, hp->ioh, o, val);
+	if (hp->sc->sc_write_delay != 0) {
+		delay(hp->sc->sc_write_delay);
+	}
 }
 
 #define HWRITE1(hp, reg, val)		hwrite1(hp, reg, val)

Index: src/sys/dev/sdmmc/sdhcvar.h
diff -u src/sys/dev/sdmmc/sdhcvar.h:1.33 src/sys/dev/sdmmc/sdhcvar.h:1.34
--- src/sys/dev/sdmmc/sdhcvar.h:1.33	Fri Oct 14 07:54:49 2022
+++ src/sys/dev/sdmmc/sdhcvar.h	Sat Jan 20 00:22:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcvar.h,v 1.33 2022/10/14 07:54:49 jmcneill Exp $	*/
+/*	$NetBSD: sdhcvar.h,v 1.34 2024/01/20 00:22:11 jmcneill Exp $	*/
 /*	$OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $	*/
 
 /*
@@ -82,6 +82,8 @@ struct sdhc_softc {
 	int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
 	void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *);
 	int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int);
+
+	u_int			sc_write_delay; /* delay (us) after io write */
 };
 
 /* Host controller functions called by the attachment driver. */



CVS commit: src/sys/dev/sdmmc

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:22:11 UTC 2024

Modified Files:
src/sys/dev/sdmmc: sdhc.c sdhcvar.h

Log Message:
sdmmc: add support for optional delay after register write


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sdmmc/sdhcvar.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-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 20 00:19:12 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr_stubs.s
src/sys/arch/news68k/news68k: genassym.cf

Log Message:
Support the hardware-assisted AST on news68k in the common interrupt
stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/m68k/m68k_intr_stubs.s
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/news68k/news68k/genassym.cf

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/m68k_intr_stubs.s
diff -u src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.4 src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.5
--- src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.4	Fri Jan 19 18:18:54 2024
+++ src/sys/arch/m68k/m68k/m68k_intr_stubs.s	Sat Jan 20 00:19:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr_stubs.s,v 1.4 2024/01/19 18:18:54 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr_stubs.s,v 1.5 2024/01/20 00:19:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -50,11 +50,16 @@
 #endif
 
 /*
- * XXX Some platforms (e.g. news68k) have hardware-assisted ASTs, and
- * XXX thus don't need to branch to rei() after an interrupt.  Figure
- * XXX out a way to handle these platforms.  This works for now; the
- * XXX hardware-assist is just an optimization.
+ * If a platform supports hardware-assisted ASTs, we don't branch to
+ * rei() after the interrupt.  Instead, we simply do an rte.  Such
+ * platforms will have their own vector stub for dealing with ASTs,
+ * which will in turn call rei().
  */
+#ifdef __HAVE_M68K_HW_AST
+#define	INTERRUPT_RETURN	rte
+#else
+#define	INTERRUPT_RETURN	jra	_ASM_LABEL(rei)
+#endif /* __HAVE_M68K_HW_AST */
 
 /*
  * Vector stub for auto-vectored interrupts.  Calls the dispatch
@@ -67,7 +72,7 @@ ENTRY_NOPROFILE(intrstub_autovec)
 	jbsr	_C_LABEL(m68k_intr_autovec)
 	INTERRUPT_RESTOREREG
 	subql	#1,_C_LABEL(intr_depth)
-	jra	_ASM_LABEL(rei)
+	INTERRUPT_RETURN
 
 #ifdef __HAVE_M68K_INTR_VECTORED
 /*
@@ -80,5 +85,5 @@ ENTRY_NOPROFILE(intrstub_vectored)
 	jbsr	_C_LABEL(m68k_intr_vectored)
 	INTERRUPT_RESTOREREG
 	subql	#1,_C_LABEL(intr_depth)
-	jra	_ASM_LABEL(rei)
+	INTERRUPT_RETURN
 #endif /* __HAVE_M68K_INTR_VECTORED */

Index: src/sys/arch/news68k/news68k/genassym.cf
diff -u src/sys/arch/news68k/news68k/genassym.cf:1.36 src/sys/arch/news68k/news68k/genassym.cf:1.37
--- src/sys/arch/news68k/news68k/genassym.cf:1.36	Mon Jan 15 20:21:50 2024
+++ src/sys/arch/news68k/news68k/genassym.cf	Sat Jan 20 00:19:12 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.36 2024/01/15 20:21:50 thorpej Exp $
+#	$NetBSD: genassym.cf,v 1.37 2024/01/20 00:19:12 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -75,6 +75,7 @@ endif
 define	M68K_MMU_MOTOROLA	1
 
 define	__HAVE_M68K_INTR_VECTORED 1
+define	__HAVE_M68K_HW_AST	1
 
 # values for fputype
 define	FPU_NONE		FPU_NONE



CVS commit: src/sys/arch/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/oea/cpu_subr.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

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

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr_stubs.s
src/sys/arch/news68k/news68k: genassym.cf

Log Message:
Support the hardware-assisted AST on news68k in the common interrupt
stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/m68k/m68k_intr_stubs.s
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/news68k/news68k/genassym.cf

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



CVS commit: src/sys/arch/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/oea/cpu_subr.c

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

Modified files:

Index: src/sys/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.108 src/sys/arch/powerpc/oea/cpu_subr.c:1.109
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.108	Sun Mar 21 23:41:52 2021
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Jan 20 00:19:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $");
 
 #include "sysmon_envsys.h"
 
@@ -153,6 +153,19 @@ static const struct fmttab cpu_7450_l3cr
 	{ 0, 0, NULL },
 };
 
+static const struct fmttab cpu_ibm750cl_l2cr_formats[] = {
+	{ L2CR_L2E, 0, " disabled" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
+	{ 0, ~0, " 256KB" },
+	{ L2CR_L2WT, L2CR_L2WT, " WT" },
+	{ L2CR_L2WT, 0, " WB" },
+	{ L2CR_L2PE, L2CR_L2PE, " with ECC" },
+	{ 0, ~0, " L2 cache" },
+	{ 0, 0, NULL }
+};
+
 static const struct fmttab cpu_ibm750_l2cr_formats[] = {
 	{ L2CR_L2E, 0, " disabled" },
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
@@ -1078,10 +1091,13 @@ cpu_config_l2cr(int pvr)
 		break;
 	case MPC750:
 		if ((pvr & 0xff00) == 0x00082200 /* IBM750CX */ ||
-		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */)
+		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */) {
 			cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
-		else
+		} else if ((pvr & 0xf0e0) == 0x00087000 /* IBM750CL */) {
+			cpu_fmttab_print(cpu_ibm750cl_l2cr_formats, l2cr);
+		} else {
 			cpu_fmttab_print(cpu_l2cr_formats, l2cr);
+		}
 		break;
 	case MPC7447A:
 	case MPC7457:



CVS commit: src/sys/arch/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_machdep.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/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_machdep.c

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

Modified files:

Index: src/sys/arch/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.84 src/sys/arch/powerpc/oea/oea_machdep.c:1.85
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.84	Sun Aug  7 09:37:46 2022
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Jan 20 00:18:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -1064,7 +1064,7 @@ mapiodev(paddr_t pa, psize_t len, bool p
 
 	for (; len > 0; len -= PAGE_SIZE) {
 		pmap_kenter_pa(taddr, faddr, VM_PROT_READ | VM_PROT_WRITE,
-		(prefetchable ? PMAP_MD_PREFETCHABLE : PMAP_NOCACHE));
+		PMAP_NOCACHE | (prefetchable ? PMAP_MD_PREFETCHABLE : 0));
 		faddr += PAGE_SIZE;
 		taddr += PAGE_SIZE;
 	}



CVS commit: src/sys/arch

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

Modified Files:
src/sys/arch/amiga/amiga: trap.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/atari/atari: atari_init.c
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/cesfic: trap.c
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/hp300: trap.c
src/sys/arch/hp300/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/luna68k/luna68k: trap.c
src/sys/arch/m68k/include: cpu.h
src/sys/arch/m68k/m68k: m68k_trap.c
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mac68k/mac68k: trap.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/mvme68k/mvme68k: trap.c
src/sys/arch/news68k/include: cpu.h types.h
src/sys/arch/news68k/news68k: trap.c
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: trap.c
src/sys/arch/sun2/sun2: trap.c
src/sys/arch/sun3/sun3: trap.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/virt68k/include: cpu.h
src/sys/arch/virt68k/virt68k: trap.c
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x68k/x68k: trap.c

Log Message:
Largely unify the  headers on the m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amiga/amiga/trap.c
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/cesfic/cesfic/trap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/hp300/hp300/trap.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_trap.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mac68k/mac68k/trap.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/news68k/include/types.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/news68k/news68k/trap.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sun2/sun2/trap.c
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/sun3/sun3/trap.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/trap.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x68k/x68k/trap.c

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

Modified files:

Index: src/sys/arch/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.141 src/sys/arch/amiga/amiga/trap.c:1.142
--- src/sys/arch/amiga/amiga/trap.c:1.141	Wed Dec 27 17:35:34 2023
+++ src/sys/arch/amiga/amiga/trap.c	Sat Jan 20 00:15:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.141 2023/12/27 17:35:34 thorpej Exp $	*/
+/*	$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.141 2023/12/27 17:35:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $");
 
 #include 
 #include 
@@ -137,7 +137,7 @@ extern struct emul emul_sunos;
  * XXX End hack
  */
 
-int	astpending;
+volatile int astpending;
 
 const char *trap_type[] = {
 	"Bus error",

Index: src/sys/arch/amiga/include/cpu.h
diff -u src/sys/arch/amiga/include/cpu.h:1.87 src/sys/arch/amiga/include/cpu.h:1.88
--- src/sys/arch/amiga/include/cpu.h:1.87	Fri Jan 19 18:18:53 2024
+++ src/sys/arch/amiga/include/cpu.h	Sat Jan 20 00:15:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.87 2024/01/19 18:18:53 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.88 2024/01/20 00:15:30 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,49 +51,6 @@
 #include 
 
 #if defined(_KERNEL)
-extern volatile unsigned int intr_depth;
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe.  On the amiga, we use
- * what the locore.s glue puts on the stack before calling C-code.
- */
-struct clockframe {
-	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
-	u_short	cf_

CVS commit: src/sys/arch

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

Modified Files:
src/sys/arch/amiga/amiga: trap.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/atari/atari: atari_init.c
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/cesfic: trap.c
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/hp300: trap.c
src/sys/arch/hp300/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/luna68k/luna68k: trap.c
src/sys/arch/m68k/include: cpu.h
src/sys/arch/m68k/m68k: m68k_trap.c
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mac68k/mac68k: trap.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/mvme68k/mvme68k: trap.c
src/sys/arch/news68k/include: cpu.h types.h
src/sys/arch/news68k/news68k: trap.c
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: trap.c
src/sys/arch/sun2/sun2: trap.c
src/sys/arch/sun3/sun3: trap.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/virt68k/include: cpu.h
src/sys/arch/virt68k/virt68k: trap.c
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x68k/x68k: trap.c

Log Message:
Largely unify the  headers on the m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amiga/amiga/trap.c
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/cesfic/cesfic/trap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/hp300/hp300/trap.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_trap.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mac68k/mac68k/trap.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/news68k/include/types.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/news68k/news68k/trap.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sun2/sun2/trap.c
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/sun3/sun3/trap.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/trap.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x68k/x68k/trap.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:24:38 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_stolen.c

Log Message:
i915_gem_stolen: Fill sg_pgs, with size/PAGE_SIZE entries.

Use sg_alloc_table_from_bus_dmamem to do this.

i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset
both rely on sg_pgs to be a page array, so providing a table with
only one entry doesn't work (except by accident, if the object is
page-sized anyway).  And they rely on the sg_pgs entries to be
initialized, which we weren't doing before, and which
sg_alloc_table_from_bus_dmamem does for us.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.6	Fri Jan 19 22:24:27 2024
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c	Fri Jan 19 22:24:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_stolen.c,v 1.6 2024/01/19 22:24:27 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_stolen.c,v 1.7 2024/01/19 22:24:38 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.6 2024/01/19 22:24:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.7 2024/01/19 22:24:38 riastradh Exp $");
 
 #include 
 #include 
@@ -506,14 +506,13 @@ i915_pages_create_for_stolen(struct drm_
 {
 	struct drm_i915_private *i915 = to_i915(dev);
 	struct sg_table *st;
+	struct scatterlist *sg;
 #ifdef __NetBSD__
 	bus_dma_tag_t dmat = i915->drm.dmat;
 	bus_dma_segment_t *seg = NULL;
 	int nseg = 0, i;
 	bool loaded = false;
 	int ret;
-#else
-	struct scatterlist *sg;
 #endif
 
 	GEM_BUG_ON(range_overflows(offset, size, resource_size(&i915->dsm)));
@@ -527,11 +526,6 @@ i915_pages_create_for_stolen(struct drm_
 	if (st == NULL)
 		return ERR_PTR(-ENOMEM);
 
-	if (sg_alloc_table(st, 1, GFP_KERNEL)) {
-		kfree(st);
-		return ERR_PTR(-ENOMEM);
-	}
-
 #ifdef __NetBSD__
 	KASSERT((size % PAGE_SIZE) == 0);
 	nseg = size / PAGE_SIZE;
@@ -548,6 +542,17 @@ i915_pages_create_for_stolen(struct drm_
 		seg[i].ds_len = PAGE_SIZE;
 	}
 
+	sg = NULL;
+
+	ret = sg_alloc_table_from_bus_dmamem(st, dmat, seg, nseg, GFP_KERNEL);
+	if (ret) {
+		DRM_ERROR("failed to alloc sg table for stolen object: %d\n",
+		ret);
+		ret = -ENOMEM;
+		goto out;
+	}
+	sg = st->sgl;
+
 	/* XXX errno NetBSD->Linux */
 	ret = -bus_dmamap_create(dmat, size, nseg, PAGE_SIZE, 0,
 	BUS_DMA_WAITOK, &st->sgl->sg_dmamap);
@@ -573,11 +578,19 @@ out:	kmem_free(seg, nseg * sizeof(seg[0]
 	if (ret) {
 		if (loaded)
 			bus_dmamap_unload(dmat, st->sgl->sg_dmamap);
-		sg_free_table(st);
+		if (sg && sg->sg_dmamap)
+			bus_dmamap_destroy(dmat, sg->sg_dmamap);
+		if (sg)
+			sg_free_table(st);
 		kfree(st);
 		return ERR_PTR(ret);
 	}
 #else
+	if (sg_alloc_table(st, 1, GFP_KERNEL)) {
+		kfree(st);
+		return ERR_PTR(-ENOMEM);
+	}
+
 	sg = st->sgl;
 	sg->offset = 0;
 	sg->length = size;



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:24:38 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_stolen.c

Log Message:
i915_gem_stolen: Fill sg_pgs, with size/PAGE_SIZE entries.

Use sg_alloc_table_from_bus_dmamem to do this.

i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset
both rely on sg_pgs to be a page array, so providing a table with
only one entry doesn't work (except by accident, if the object is
page-sized anyway).  And they rely on the sg_pgs entries to be
initialized, which we weren't doing before, and which
sg_alloc_table_from_bus_dmamem does for us.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:24:27 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_stolen.c

Log Message:
i915_gem_stolen: Fix memory leak.

Found while trying to address the PR 57833 class of problems.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c:1.5	Sun Dec 19 12:10:42 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c	Fri Jan 19 22:24:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_stolen.c,v 1.5 2021/12/19 12:10:42 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_stolen.c,v 1.6 2024/01/19 22:24:27 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.5 2021/12/19 12:10:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.6 2024/01/19 22:24:27 riastradh Exp $");
 
 #include 
 #include 
@@ -569,7 +569,8 @@ i915_pages_create_for_stolen(struct drm_
 	}
 	loaded = true;
 
-out:	if (ret) {
+out:	kmem_free(seg, nseg * sizeof(seg[0]));
+	if (ret) {
 		if (loaded)
 			bus_dmamap_unload(dmat, st->sgl->sg_dmamap);
 		sg_free_table(st);



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:24:27 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_stolen.c

Log Message:
i915_gem_stolen: Fix memory leak.

Found while trying to address the PR 57833 class of problems.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:23:19 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_region.c

Log Message:
i915_gem_region: Fill sg_pgs, with size/PAGE_SIZE entries.

Use sg_alloc_table_from_bus_dmamem to do this.

i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset
both rely on sg_pgs to be a page array, so using something else like
size >> ilog2(mem->mm.chunk_size) entries doesn't work.  And they
rely on the sg_pgs entries to be initialized, which we weren't doing
before, and which sg_alloc_table_from_bus_dmamem does for us.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:23:19 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_region.c

Log Message:
i915_gem_region: Fill sg_pgs, with size/PAGE_SIZE entries.

Use sg_alloc_table_from_bus_dmamem to do this.

i915_gem_mman.c vm_fault_cpu and i915_gem_object_release_mmap_offset
both rely on sg_pgs to be a page array, so using something else like
size >> ilog2(mem->mm.chunk_size) entries doesn't work.  And they
rely on the sg_pgs entries to be initialized, which we weren't doing
before, and which sg_alloc_table_from_bus_dmamem does for us.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.5	Fri Jan 19 22:22:27 2024
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c	Fri Jan 19 22:23:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_region.c,v 1.5 2024/01/19 22:22:27 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_region.c,v 1.6 2024/01/19 22:23:19 riastradh Exp $	*/
 
 // SPDX-License-Identifier: MIT
 /*
@@ -6,7 +6,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_region.c,v 1.5 2024/01/19 22:22:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_region.c,v 1.6 2024/01/19 22:23:19 riastradh Exp $");
 
 #include "intel_memory_region.h"
 #include "i915_gem_region.h"
@@ -45,10 +45,12 @@ i915_gem_object_get_pages_buddy(struct d
 	if (!st)
 		return -ENOMEM;
 
+#ifndef __NetBSD__
 	if (sg_alloc_table(st, size >> ilog2(mem->mm.chunk_size), GFP_KERNEL)) {
 		kfree(st);
 		return -ENOMEM;
 	}
+#endif
 
 	flags = I915_ALLOC_MIN_PAGE_SIZE;
 	if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
@@ -60,7 +62,6 @@ i915_gem_object_get_pages_buddy(struct d
 
 	GEM_BUG_ON(list_empty(blocks));
 
-	sg = st->sgl;
 #ifdef __NetBSD__
 	__USE(prev_end);
 	bus_dma_tag_t dmat = obj->base.dev->dmat;
@@ -68,6 +69,8 @@ i915_gem_object_get_pages_buddy(struct d
 	int i = 0, nsegs = 0;
 	bool loaded = false;
 
+	sg = NULL;
+
 	list_for_each_entry(block, blocks, link) {
 		if (nsegs >= INT_MAX ||
 		nsegs >= SIZE_MAX/sizeof(segs[0]))
@@ -84,7 +87,15 @@ i915_gem_object_get_pages_buddy(struct d
 
 		segs[i].ds_addr = mem->region.start + offset;
 		segs[i].ds_len = block_size;
+		i++;
 	}
+	KASSERT(i == nsegs);
+
+	ret = sg_alloc_table_from_bus_dmamem(st, dmat, segs, nsegs,
+	GFP_KERNEL);
+	if (ret)
+		goto err;
+	sg = st->sgl;
 
 	/* XXX errno NetBSD->Linux */
 	ret = -bus_dmamap_create(dmat, size, nsegs, size, 0, BUS_DMA_WAITOK,
@@ -107,6 +118,7 @@ i915_gem_object_get_pages_buddy(struct d
 
 	sg_page_sizes = i915_sg_page_sizes(sg);
 #else
+	sg = st->sgl;
 	st->nents = 0;
 	sg_page_sizes = 0;
 	prev_end = (resource_size_t)-1;
@@ -154,6 +166,8 @@ i915_gem_object_get_pages_buddy(struct d
 err:
 	if (loaded)
 		bus_dmamap_unload(dmat, st->sgl->sg_dmamap);
+	if (sg && sg->sg_dmamap)
+		bus_dmamap_destroy(dmat, sg->sg_dmamap);
 	if (segs)
 		kmem_free(segs, nsegs * sizeof(segs[0]));
 	__intel_memory_region_put_pages_buddy(mem, blocks);



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:23:04 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_phys.c

Log Message:
i915_gem_phys: Fill sg_pgs.

This is needed by i915 gem fault, which maps user virtual addresses
to those pages, and by i915 gem object destruction, which does
pmap_page_protect on the pages to remove any of those user virtual
mappings.

This needs pmap_kenter_pa rather than pmap_enter(pmap_kernel(), ...)
in order to preserve the _kernel's_ mapping of the pages after
pmap_page_protect.

But bus_dmamem_map currently uses pmap_enter(pmap_kernel(), ...)
instead which creates a mapping that is removed by pmap_page_protect.

So we use a variant of bus_dmamem_map that uses pmap_kenter_pa
instead.  Perhaps bus_dmamem_map should do this itself, but this
change is less risky to pull up than a change to bus_dmamem_map
itself.

PR kern/57833: kernel panic on xorg exit

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.8 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.8	Sun Dec 19 12:45:43 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c	Fri Jan 19 22:23:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_phys.c,v 1.8 2021/12/19 12:45:43 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_phys.c,v 1.9 2024/01/19 22:23:04 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,91 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_phys.c,v 1.8 2021/12/19 12:45:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_phys.c,v 1.9 2024/01/19 22:23:04 riastradh Exp $");
+
+#ifdef __NetBSD__
+/*
+ * Make sure this block comes before any linux includes, so we don't
+ * get mixed up by the PAGE_MASK complementation.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include  /* kvtopte, pmap_pte_clearbits */
+
+/*
+ * Version of bus_dmamem_map that uses pmap_kenter_pa, not pmap_enter,
+ * so that it isn't affected by pmap_page_protect on the physical
+ * address.  Adapted from sys/arch/x86/x86/bus_dma.c.
+ */
+static int
+bus_dmamem_kmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
+size_t size, void **kvap, int flags)
+{
+	vaddr_t va;
+	bus_addr_t addr;
+	int curseg;
+	const uvm_flag_t kmflags =
+	(flags & BUS_DMA_NOWAIT) != 0 ? UVM_KMF_NOWAIT : 0;
+	u_int pmapflags = PMAP_WIRED | VM_PROT_READ | VM_PROT_WRITE;
+
+	size = round_page(size);
+	if (flags & BUS_DMA_NOCACHE)
+		pmapflags |= PMAP_NOCACHE;
+
+	va = uvm_km_alloc(kernel_map, size, 0, UVM_KMF_VAONLY | kmflags);
+
+	if (va == 0)
+		return ENOMEM;
+
+	*kvap = (void *)va;
+
+	for (curseg = 0; curseg < nsegs; curseg++) {
+		for (addr = segs[curseg].ds_addr;
+		addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
+		addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
+			if (size == 0)
+panic("bus_dmamem_kmap: size botch");
+			pmap_kenter_pa(va, addr,
+			VM_PROT_READ | VM_PROT_WRITE,
+			pmapflags);
+		}
+	}
+	pmap_update(pmap_kernel());
+
+	return 0;
+}
+
+static void
+bus_dmamem_kunmap(bus_dma_tag_t t, void *kva, size_t size)
+{
+	pt_entry_t *pte, opte;
+	vaddr_t va, sva, eva;
+
+	KASSERTMSG(((uintptr_t)kva & PGOFSET) == 0, "kva=%p", kva);
+
+	size = round_page(size);
+	sva = (vaddr_t)kva;
+	eva = sva + size;
+
+	/*
+	 * mark pages cacheable again.
+	 */
+	for (va = sva; va < eva; va += PAGE_SIZE) {
+		pte = kvtopte(va);
+		opte = *pte;
+		if ((opte & PTE_PCD) != 0)
+			pmap_pte_clearbits(pte, PTE_PCD);
+	}
+	pmap_kremove((vaddr_t)kva, size);
+	pmap_update(pmap_kernel());
+	uvm_km_free(kernel_map, (vaddr_t)kva, size, UVM_KMF_VAONLY);
+}
+
+#endif
 
 #include 
 #include 
@@ -65,7 +149,7 @@ static int i915_gem_object_get_pages_phy
 	if (ret)
 		return -ENOMEM;
 	KASSERT(rsegs == 1);
-	ret = -bus_dmamem_map(dmat, &obj->mm.u.phys.seg, 1,
+	ret = -bus_dmamem_kmap(dmat, &obj->mm.u.phys.seg, 1,
 	roundup_pow_of_two(obj->base.size), &vaddr,
 	BUS_DMA_WAITOK|BUS_DMA_COHERENT);
 	if (ret)
@@ -83,7 +167,12 @@ static int i915_gem_object_get_pages_phy
 	if (!st)
 		goto err_pci;
 
+#ifdef __NetBSD__
+	if (sg_alloc_table_from_bus_dmamem(st, dmat, &obj->mm.u.phys.seg, 1,
+		GFP_KERNEL))
+#else
 	if (sg_alloc_table(st, 1, GFP_KERNEL))
+#endif
 		goto err_st;
 
 	sg = st->sgl;
@@ -151,7 +240,7 @@ err_st:
 err_pci:
 #ifdef __NetBSD__
 	if (vaddr) {
-		bus_dmamem_unmap(dmat, vaddr,
+		bus_dmamem_kunmap(dmat, vaddr,
 		roundup_pow_of_two(obj->base.size));
 	}
 	obj->mm.u.phys.kva = NULL;
@@ -225,7 +314,7 @@ i915_gem_object_put_pages_phys(struct dr
 	kfree(pages);
 
 #ifdef __NetBSD__
-	bus_dmamem

CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:23:04 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_phys.c

Log Message:
i915_gem_phys: Fill sg_pgs.

This is needed by i915 gem fault, which maps user virtual addresses
to those pages, and by i915 gem object destruction, which does
pmap_page_protect on the pages to remove any of those user virtual
mappings.

This needs pmap_kenter_pa rather than pmap_enter(pmap_kernel(), ...)
in order to preserve the _kernel's_ mapping of the pages after
pmap_page_protect.

But bus_dmamem_map currently uses pmap_enter(pmap_kernel(), ...)
instead which creates a mapping that is removed by pmap_page_protect.

So we use a variant of bus_dmamem_map that uses pmap_kenter_pa
instead.  Perhaps bus_dmamem_map should do this itself, but this
change is less risky to pull up than a change to bus_dmamem_map
itself.

PR kern/57833: kernel panic on xorg exit

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:54 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_pages.c

Log Message:
i915_gem: Assert page array size.

Let's detect the bug of sg_npgs failing to match
obj->base.size/PAGE_SIZE earlier.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c:1.6	Sun Dec 19 12:00:57 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.c	Fri Jan 19 22:22:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_pages.c,v 1.6 2021/12/19 12:00:57 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_pages.c,v 1.7 2024/01/19 22:22:54 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_pages.c,v 1.6 2021/12/19 12:00:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_pages.c,v 1.7 2024/01/19 22:22:54 riastradh Exp $");
 
 #include "i915_drv.h"
 #include "i915_gem_object.h"
@@ -42,6 +42,18 @@ void __i915_gem_object_set_pages(struct 
 	}
 
 #ifndef __NetBSD__
+	/*
+	 * Paranoia: In NetBSD, a scatterlist is just an array of
+	 * pages, not an array of segments that might be larger than
+	 * pages, so the number of entries must exactly match the size
+	 * of the object (which should also be page-aligned).
+	 *
+	 * Both vm_fault_cpu and i915_gem_object_release_mmap_offset in
+	 * i915_gem_mman.c rely on this page array as such.
+	 */
+	KASSERTMSG(pages->sgl->sg_npgs == obj->base.size >> PAGE_SHIFT,
+	"npgs=%zu size=%zu", pages->sgl->sg_npgs, obj->base.size);
+
 	obj->mm.get_page.sg_pos = pages->sgl;
 	obj->mm.get_page.sg_idx = 0;
 #endif



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:54 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_pages.c

Log Message:
i915_gem: Assert page array size.

Let's detect the bug of sg_npgs failing to match
obj->base.size/PAGE_SIZE earlier.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_pages.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:40 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_mman.c

Log Message:
i915_gem: Avoid walking off end of sg_pgs.

sg_npgs currently fails to match obj->base.size/PAGE_SIZE only due to
bugs in the construction of sg_pgs in various i915 gem object types,
which we should also fix, but let's avoid compounding it here.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.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/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:40 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_mman.c

Log Message:
i915_gem: Avoid walking off end of sg_pgs.

sg_npgs currently fails to match obj->base.size/PAGE_SIZE only due to
bugs in the construction of sg_pgs in various i915 gem object types,
which we should also fix, but let's avoid compounding it here.

Related to PR kern/57833.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c:1.21 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c:1.22
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c:1.21	Sun Dec 19 12:26:55 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c	Fri Jan 19 22:22:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_mman.c,v 1.21 2021/12/19 12:26:55 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_mman.c,v 1.22 2024/01/19 22:22:40 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.21 2021/12/19 12:26:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.22 2024/01/19 22:22:40 riastradh Exp $");
 
 #include 
 #include 
@@ -675,7 +675,7 @@ void i915_gem_object_release_mmap_offset
 
 	if (!i915_gem_object_has_pages(obj))
 		return;
-	for (i = 0; i < obj->base.size >> PAGE_SHIFT; i++) {
+	for (i = 0; i < obj->mm.pages->sgl->sg_npgs; i++) {
 		page = obj->mm.pages->sgl->sg_pgs[i];
 		vm_page = &page->p_vmp;
 		pmap_page_protect(vm_page, VM_PROT_NONE);



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:27 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_region.c

Log Message:
i915_gem_region: Reduce diff from upstream a little.

No functional change intended.

Prompted by upcoming nearby changes related to PR kern/57833.

XXX pullup-10 (to make subsequent pullups easier)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.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/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.4 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c:1.4	Sun Dec 19 12:10:42 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c	Fri Jan 19 22:22:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_region.c,v 1.4 2021/12/19 12:10:42 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_region.c,v 1.5 2024/01/19 22:22:27 riastradh Exp $	*/
 
 // SPDX-License-Identifier: MIT
 /*
@@ -6,7 +6,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_region.c,v 1.4 2021/12/19 12:10:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_region.c,v 1.5 2024/01/19 22:22:27 riastradh Exp $");
 
 #include "intel_memory_region.h"
 #include "i915_gem_region.h"
@@ -63,7 +63,6 @@ i915_gem_object_get_pages_buddy(struct d
 	sg = st->sgl;
 #ifdef __NetBSD__
 	__USE(prev_end);
-	__USE(sg_page_sizes);
 	bus_dma_tag_t dmat = obj->base.dev->dmat;
 	bus_dma_segment_t *segs = NULL;
 	int i = 0, nsegs = 0;
@@ -106,7 +105,7 @@ i915_gem_object_get_pages_buddy(struct d
 	kmem_free(segs, nsegs * sizeof(segs[0]));
 	segs = NULL;
 
-	__i915_gem_object_set_pages(obj, st, i915_sg_page_sizes(sg));
+	sg_page_sizes = i915_sg_page_sizes(sg);
 #else
 	st->nents = 0;
 	sg_page_sizes = 0;
@@ -145,9 +144,9 @@ i915_gem_object_get_pages_buddy(struct d
 	sg_page_sizes |= sg->length;
 	sg_mark_end(sg);
 	i915_sg_trim(st);
+#endif
 
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
-#endif
 
 	return 0;
 



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2024-01-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jan 19 22:22:27 UTC 2024

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_region.c

Log Message:
i915_gem_region: Reduce diff from upstream a little.

No functional change intended.

Prompted by upcoming nearby changes related to PR kern/57833.

XXX pullup-10 (to make subsequent pullups easier)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.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

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 20:55:42 UTC 2024

Modified Files:
src/sys/arch/atari/atari: intr.c
src/sys/arch/atari/include: intr.h
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c
src/sys/arch/mac68k/mac68k: intr.c
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Now that we've agreed on the name "intr_depth", let's agree on the type, too.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/atari/atari/intr.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/atari/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.212 -r1.213 src/sys/arch/x68k/x68k/machdep.c

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

Modified files:

Index: src/sys/arch/atari/atari/intr.c
diff -u src/sys/arch/atari/atari/intr.c:1.32 src/sys/arch/atari/atari/intr.c:1.33
--- src/sys/arch/atari/atari/intr.c:1.32	Fri Jan 19 18:18:53 2024
+++ src/sys/arch/atari/atari/intr.c	Fri Jan 19 20:55:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.32 2024/01/19 18:18:53 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.33 2024/01/19 20:55:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.32 2024/01/19 18:18:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.33 2024/01/19 20:55:42 thorpej Exp $");
 
 #include 
 #include 
@@ -53,7 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3
 typedef LIST_HEAD(, intrhand) ih_list_t;
 static ih_list_t autovec_list[AVEC_MAX - AVEC_MIN + 1];
 static ih_list_t uservec_list[UVEC_MAX - UVEC_MIN + 1];
-int intr_depth;
+volatile unsigned int intr_depth;
 volatile int ssir;
 
 void

Index: src/sys/arch/atari/include/intr.h
diff -u src/sys/arch/atari/include/intr.h:1.24 src/sys/arch/atari/include/intr.h:1.25
--- src/sys/arch/atari/include/intr.h:1.24	Fri Jan 19 18:18:53 2024
+++ src/sys/arch/atari/include/intr.h	Fri Jan 19 20:55:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.24 2024/01/19 18:18:53 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.25 2024/01/19 20:55:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2007 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@ typedef struct {
 int spl0(void);
 
 extern const uint16_t ipl2psl_table[NIPL];
-extern int intr_depth;
+extern volatile unsigned int intr_depth;
 
 typedef int ipl_t;
 

Index: src/sys/arch/m68k/include/intr.h
diff -u src/sys/arch/m68k/include/intr.h:1.7 src/sys/arch/m68k/include/intr.h:1.8
--- src/sys/arch/m68k/include/intr.h:1.7	Fri Jan 19 18:18:54 2024
+++ src/sys/arch/m68k/include/intr.h	Fri Jan 19 20:55:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.7 2024/01/19 18:18:54 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.8 2024/01/19 20:55:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ typedef struct {
 
 #ifndef _LOCORE
 
-extern volatile int intr_depth;		/* interrupt depth */
+extern volatile unsigned int intr_depth;/* interrupt depth */
 extern const uint16_t ipl2psl_table[NIPL];
 
 typedef int ipl_t;		/* logical IPL_* value */

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.12 src/sys/arch/m68k/m68k/m68k_intr.c:1.13
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.12	Fri Jan 19 18:18:54 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Fri Jan 19 20:55:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.12 2024/01/19 18:18:54 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.13 2024/01/19 20:55:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.12 2024/01/19 18:18:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.13 2024/01/19 20:55:42 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,7 +70,7 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
-volatile int intr_depth;	/* updated in assembly glue */
+volatile unsigned int intr_depth;	/* updated in assembly glue */
 
 static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
 #ifdef __HAVE_M68K_INTR_VECTORED

Index: src/sys/arch/mac68k/mac68k/intr.c
diff -u src/sys/arch/mac68k/mac68k/intr.c:1.34 src/sys/arch/mac68k/mac68k/intr.c:1.35
--- src/sys/arch/mac68k/mac68k/intr.c:1.34	Fri Jan 19 18:18:54 2024
+++ src/sys/arch/mac68k/mac68k/intr.c	Fri Jan 19 20:55:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.34 2024/01/19 18:18:54 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.35 2024/01/19 20:55:42 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.34 2024/01/19 18:1

CVS commit: src/sys/arch

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 20:55:42 UTC 2024

Modified Files:
src/sys/arch/atari/atari: intr.c
src/sys/arch/atari/include: intr.h
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c
src/sys/arch/mac68k/mac68k: intr.c
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Now that we've agreed on the name "intr_depth", let's agree on the type, too.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/atari/atari/intr.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/atari/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.212 -r1.213 src/sys/arch/x68k/x68k/machdep.c

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



CVS commit: src/lib/libpthread

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:55:03 UTC 2024

Modified Files:
src/lib/libpthread: pthread_cancelstub.c

Log Message:
Add missing headers


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libpthread/pthread_cancelstub.c

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

Modified files:

Index: src/lib/libpthread/pthread_cancelstub.c
diff -u src/lib/libpthread/pthread_cancelstub.c:1.44 src/lib/libpthread/pthread_cancelstub.c:1.45
--- src/lib/libpthread/pthread_cancelstub.c:1.44	Fri Jul 28 14:19:00 2023
+++ src/lib/libpthread/pthread_cancelstub.c	Fri Jan 19 14:55:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cancelstub.c,v 1.44 2023/07/28 18:19:00 christos Exp $	*/
+/*	$NetBSD: pthread_cancelstub.c,v 1.45 2024/01/19 19:55:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #undef _FORTIFY_SOURCE
 
 #include 
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.44 2023/07/28 18:19:00 christos Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.45 2024/01/19 19:55:03 christos Exp $");
 
 /* Need to use libc-private names for atomic operations. */
 #include "../../common/lib/libc/atomic/atomic_op_namespace.h"
@@ -73,12 +73,14 @@ __RCSID("$NetBSD: pthread_cancelstub.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 



CVS commit: src/lib/libpthread

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:55:03 UTC 2024

Modified Files:
src/lib/libpthread: pthread_cancelstub.c

Log Message:
Add missing headers


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libpthread/pthread_cancelstub.c

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



CVS commit: src/common/lib/libc/atomic

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:33:49 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c

Log Message:
make decls consistent


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c

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

Modified files:

Index: src/common/lib/libc/atomic/atomic_init_cas.c
diff -u src/common/lib/libc/atomic/atomic_init_cas.c:1.4 src/common/lib/libc/atomic/atomic_init_cas.c:1.5
--- src/common/lib/libc/atomic/atomic_init_cas.c:1.4	Tue Aug 20 23:00:56 2013
+++ src/common/lib/libc/atomic/atomic_init_cas.c	Fri Jan 19 14:33:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $	*/
+/*	$NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,11 +32,10 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $");
+__RCSID("$NetBSD: atomic_init_cas.c,v 1.5 2024/01/19 19:33:49 christos Exp $");
+#include "extern.h"
 
-void	__libc_atomic_init(void) __attribute__ ((visibility("hidden")));
-
-void __section(".text.startup")
+void __section(".text.startup") __attribute__ ((__visibility__("hidden")))
 __libc_atomic_init(void)
 {
 

Index: src/common/lib/libc/atomic/atomic_init_testset.c
diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.17 src/common/lib/libc/atomic/atomic_init_testset.c:1.18
--- src/common/lib/libc/atomic/atomic_init_testset.c:1.17	Fri May 15 11:20:40 2020
+++ src/common/lib/libc/atomic/atomic_init_testset.c	Fri Jan 19 14:33:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $	*/
+/*	$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_init_testset.c,v 1.17 2020/05/15 15:20:40 martin Exp $");
+__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $");
 
 #include "atomic_op_namespace.h"
 
@@ -98,8 +98,6 @@ static uint8_t (*_atomic_cas_8_fn)(volat
 _atomic_cas_8_up;
 RAS_DECL(_atomic_cas_8);
 
-void	__libc_atomic_init(void) __attribute__ ((visibility("hidden")));
-
 #ifndef	__HAVE_ASM_ATOMIC_CAS_UP
 static uint32_t
 _atomic_cas_up(volatile uint32_t *ptr, uint32_t old, uint32_t new)
@@ -276,7 +274,7 @@ _atomic_cas_8(volatile uint8_t *ptr, uin
 	return (*_atomic_cas_8_fn)(ptr, old, new);
 }
 
-void __section(".text.startup")
+void __section(".text.startup") __attribute__ ((__visibility__("hidden")))
 __libc_atomic_init(void)
 {
 	int ncpu, mib[2];



CVS commit: src/common/lib/libc/atomic

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:33:49 UTC 2024

Modified Files:
src/common/lib/libc/atomic: atomic_init_cas.c atomic_init_testset.c

Log Message:
make decls consistent


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_init_cas.c
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/atomic/atomic_init_testset.c

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



CVS commit: src/common/lib/libc/hash/sha3

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:32:42 UTC 2024

Modified Files:
src/common/lib/libc/hash/sha3: sha3.c

Log Message:
use size_t


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/hash/sha3/sha3.c

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



CVS commit: src/common/lib/libc/hash/sha3

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:32:42 UTC 2024

Modified Files:
src/common/lib/libc/hash/sha3: sha3.c

Log Message:
use size_t


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/hash/sha3/sha3.c

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

Modified files:

Index: src/common/lib/libc/hash/sha3/sha3.c
diff -u src/common/lib/libc/hash/sha3/sha3.c:1.3 src/common/lib/libc/hash/sha3/sha3.c:1.4
--- src/common/lib/libc/hash/sha3/sha3.c:1.3	Sat Jul 31 10:36:33 2021
+++ src/common/lib/libc/hash/sha3/sha3.c	Fri Jan 19 14:32:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $	*/
+/*	$NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 Taylor R. Campbell
@@ -38,14 +38,14 @@
 
 #if defined(_KERNEL) || defined(_STANDALONE)
 
-__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $");
 #include 
 
 #define	SHA3_ASSERT	KASSERT
 
 #else
 
-__RCSID("$NetBSD: sha3.c,v 1.3 2021/07/31 14:36:33 andvar Exp $");
+__RCSID("$NetBSD: sha3.c,v 1.4 2024/01/19 19:32:42 christos Exp $");
 
 #include "namespace.h"
 
@@ -228,7 +228,7 @@ sha3_final(uint8_t *h, unsigned d, struc
 }
 
 static void
-shake_final(uint8_t *h, unsigned d, struct sha3 *C, unsigned rw)
+shake_final(uint8_t *h, size_t d, struct sha3 *C, unsigned rw)
 {
 	unsigned nw, iw;
 



CVS commit: src/lib/libc/include

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:31:41 UTC 2024

Modified Files:
src/lib/libc/include: extern.h

Log Message:
more extern decls


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/include/extern.h

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

Modified files:

Index: src/lib/libc/include/extern.h
diff -u src/lib/libc/include/extern.h:1.28 src/lib/libc/include/extern.h:1.29
--- src/lib/libc/include/extern.h:1.28	Wed Jan  3 13:41:53 2024
+++ src/lib/libc/include/extern.h	Fri Jan 19 14:31:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.28 2024/01/03 18:41:53 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.29 2024/01/19 19:31:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -35,9 +35,13 @@ typedef struct _locale		*locale_t;
 __BEGIN_DECLS
 extern char *__minbrk;
 extern sigset_t __sigintr;
+extern char **environ;
 int __getcwd(char *, size_t);
 int __getlogin(char *, size_t);
 int __setlogin(const char *);
+int __posix_fadvise50(int, int, __off_t, __off_t, int);
+void  __section(".text.startup") __attribute__((__visibility__("hidden")))
+__libc_atomic_init(void);
 void _resumecontext(void) __dead;
 __dso_hidden int	_strerror_lr(int, char *, size_t, locale_t);
 const char *__strerror(int , char *, size_t);



CVS commit: src/lib/libc/include

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:31:41 UTC 2024

Modified Files:
src/lib/libc/include: extern.h

Log Message:
more extern decls


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/include/extern.h

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



CVS commit: src

2024-01-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 19 19:23:35 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: lex_char.c lex_wide_char.c msg_079.c
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: allow '\e' only in GCC mode


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/lex_char.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/lex_wide_char.c \
src/tests/usr.bin/xlint/lint1/msg_079.c
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/xlint/lint1/lex.c

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



CVS commit: src

2024-01-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan 19 19:23:35 UTC 2024

Modified Files:
src/tests/usr.bin/xlint/lint1: lex_char.c lex_wide_char.c msg_079.c
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: allow '\e' only in GCC mode


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/lex_char.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/lex_wide_char.c \
src/tests/usr.bin/xlint/lint1/msg_079.c
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/lex_char.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char.c:1.7 src/tests/usr.bin/xlint/lint1/lex_char.c:1.8
--- src/tests/usr.bin/xlint/lint1/lex_char.c:1.7	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/lex_char.c	Fri Jan 19 19:23:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char.c,v 1.7 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: lex_char.c,v 1.8 2024/01/19 19:23:34 rillig Exp $	*/
 # 3 "lex_char.c"
 
 /*
@@ -27,9 +27,11 @@ test(void)
 	sink('ä');
 
 	/* GCC extension */
-	/* expect+1: warning: dubious escape \e [79] */
 	sink('\e');
 
+	/* expect+1: warning: dubious escape \y [79] */
+	sink('\y');
+
 	/* since C99 */
 	sink('\x12');
 

Index: src/tests/usr.bin/xlint/lint1/lex_wide_char.c
diff -u src/tests/usr.bin/xlint/lint1/lex_wide_char.c:1.4 src/tests/usr.bin/xlint/lint1/lex_wide_char.c:1.5
--- src/tests/usr.bin/xlint/lint1/lex_wide_char.c:1.4	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/lex_wide_char.c	Fri Jan 19 19:23:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_wide_char.c,v 1.4 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: lex_wide_char.c,v 1.5 2024/01/19 19:23:34 rillig Exp $	*/
 # 3 "lex_wide_char.c"
 
 /*
@@ -26,9 +26,11 @@ test(void)
 	sink(L'ä');
 
 	/* GCC extension */
-	/* expect+1: warning: dubious escape \e [79] */
 	sink(L'\e');
 
+	/* expect+1: warning: dubious escape \y [79] */
+	sink(L'\y');
+
 	/* since C99 */
 	sink(L'\x12');
 
Index: src/tests/usr.bin/xlint/lint1/msg_079.c
diff -u src/tests/usr.bin/xlint/lint1/msg_079.c:1.4 src/tests/usr.bin/xlint/lint1/msg_079.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_079.c:1.4	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_079.c	Fri Jan 19 19:23:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_079.c,v 1.4 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_079.c,v 1.5 2024/01/19 19:23:34 rillig Exp $	*/
 # 3 "msg_079.c"
 
 // Test for message: dubious escape \%c [79]
@@ -10,7 +10,7 @@ int my_printf(const char *, ...);
 void
 print_color(_Bool red, _Bool green, _Bool blue)
 {
-	/* expect+1: warning: dubious escape \e [79] */
-	my_printf("\e[%dm",
+	/* expect+1: warning: dubious escape \y [79] */
+	my_printf("\e[%dm\y",
 	30 + (red ? 1 : 0) + (green ? 2 : 0) + (blue ? 4 : 0));
 }

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.198 src/usr.bin/xlint/lint1/lex.c:1.199
--- src/usr.bin/xlint/lint1/lex.c:1.198	Fri Jan 19 18:23:13 2024
+++ src/usr.bin/xlint/lint1/lex.c	Fri Jan 19 19:23:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.198 2024/01/19 18:23:13 christos Exp $ */
+/* $NetBSD: lex.c,v 1.199 2024/01/19 19:23:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.198 2024/01/19 18:23:13 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.199 2024/01/19 19:23:34 rillig Exp $");
 #endif
 
 #include 
@@ -791,7 +791,11 @@ read_escaped_backslash(int delim)
 		return '\a';
 	case 'b':
 		return '\b';
-	case 'e':	/* Not in the C standard yet, compilers recognize it */
+	case 'e':
+		if (!allow_gcc)
+			break;
+		/* Not in the C standard yet, compilers recognize it */
+		/* LINTED 79 */
 		return '\e';
 	case 'f':
 		return '\f';
@@ -820,15 +824,15 @@ read_escaped_backslash(int delim)
 	case EOF:
 		return -2;
 	default:
-		if (isprint(c)) {
-			/* dubious escape \%c */
-			warning(79, c);
-		} else {
-			/* dubious escape \%o */
-			warning(80, c);
-		}
-		return c;
+		break;
 	}
+	if (isprint(c))
+		/* dubious escape \%c */
+		warning(79, c);
+	else
+		/* dubious escape \%o */
+		warning(80, c);
+	return c;
 }
 
 /*



CVS commit: src/lib/csu/common

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:22:18 UTC 2024

Modified Files:
src/lib/csu/common: crt0-common.c csu-common.h

Log Message:
declare _libc_init() in header.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/common/csu-common.h

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

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.27 src/lib/csu/common/crt0-common.c:1.28
--- src/lib/csu/common/crt0-common.c:1.27	Tue Jun 21 02:52:17 2022
+++ src/lib/csu/common/crt0-common.c	Fri Jan 19 14:22:17 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.27 2022/06/21 06:52:17 skrll Exp $ */
+/* $NetBSD: crt0-common.c,v 1.28 2024/01/19 19:22:17 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.27 2022/06/21 06:52:17 skrll Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.28 2024/01/19 19:22:17 christos Exp $");
 
 #include 
 #include 
@@ -55,7 +55,6 @@ typedef void (*fptr_t)(void);
 extern void	_init(void);
 extern void	_fini(void);
 #endif
-extern void	_libc_init(void);
 
 /*
  * Arrange for _DYNAMIC to be weak and undefined (and therefore to show up

Index: src/lib/csu/common/csu-common.h
diff -u src/lib/csu/common/csu-common.h:1.1 src/lib/csu/common/csu-common.h:1.2
--- src/lib/csu/common/csu-common.h:1.1	Tue Apr 20 17:42:31 2021
+++ src/lib/csu/common/csu-common.h	Fri Jan 19 14:22:17 2024
@@ -36,3 +36,5 @@
 extern char *__progname __common;
 extern char **environ __common;
 extern struct ps_strings *__ps_strings __common;
+
+void_libc_init(void) __attribute__((__constructor__, __used__));



CVS commit: src/lib/csu/common

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:22:18 UTC 2024

Modified Files:
src/lib/csu/common: crt0-common.c csu-common.h

Log Message:
declare _libc_init() in header.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/common/csu-common.h

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



CVS commit: src/libexec/ld.elf_so

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:21:34 UTC 2024

Modified Files:
src/libexec/ld.elf_so: Makefile rtld.c

Log Message:
use header decl of __fork()


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r1.216 -r1.217 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/Makefile
diff -u src/libexec/ld.elf_so/Makefile:1.148 src/libexec/ld.elf_so/Makefile:1.149
--- src/libexec/ld.elf_so/Makefile:1.148	Sat Oct  7 08:15:53 2023
+++ src/libexec/ld.elf_so/Makefile	Fri Jan 19 14:21:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.148 2023/10/07 12:15:53 rin Exp $
+#	$NetBSD: Makefile,v 1.149 2024/01/19 19:21:34 christos Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -111,7 +111,7 @@ BINDIR=		${SHLINKINSTALLDIR}
 CPPFLAGS.tls.c+=	-std=gnu11
 CPPFLAGS+=	-DLIBDIR=\"${LIBDIR}\" -D_PATH_RTLD=\"${BINDIR}/${PROG}\"
 CPPFLAGS+=	-I${.CURDIR} -I. -D_KERNTYPES
-CPPFLAGS+=	-DRTLD_LOADER
+CPPFLAGS+=	-DRTLD_LOADER -D_LIBC_INTERNAL
 CPPFLAGS+=	-DGNU_RELRO
 CPPFLAGS+=	-D_RTLD_SOURCE
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.216 src/libexec/ld.elf_so/rtld.c:1.217
--- src/libexec/ld.elf_so/rtld.c:1.216	Tue Oct  3 05:48:18 2023
+++ src/libexec/ld.elf_so/rtld.c	Fri Jan 19 14:21:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.216 2023/10/03 09:48:18 martin Exp $	 */
+/*	$NetBSD: rtld.c,v 1.217 2024/01/19 19:21:34 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.216 2023/10/03 09:48:18 martin Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.217 2024/01/19 19:21:34 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -1550,8 +1550,6 @@ __dl_cxa_refcount(void *addr, ssize_t de
 	_rtld_exclusive_exit(&mask);
 }
 
-pid_t __fork(void);
-
 __dso_public pid_t
 __locked_fork(int *my_errno)
 {



CVS commit: src/libexec/ld.elf_so

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:21:34 UTC 2024

Modified Files:
src/libexec/ld.elf_so: Makefile rtld.c

Log Message:
use header decl of __fork()


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r1.216 -r1.217 src/libexec/ld.elf_so/rtld.c

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



CVS commit: src/usr.sbin/pwd_mkdb

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:08:49 UTC 2024

Modified Files:
src/usr.sbin/pwd_mkdb: pwd_mkdb.c

Log Message:
simplify, we need to hard code the constant for tools anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/pwd_mkdb/pwd_mkdb.c

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



CVS commit: src/usr.sbin/pwd_mkdb

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:08:49 UTC 2024

Modified Files:
src/usr.sbin/pwd_mkdb: pwd_mkdb.c

Log Message:
simplify, we need to hard code the constant for tools anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/pwd_mkdb/pwd_mkdb.c

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

Modified files:

Index: src/usr.sbin/pwd_mkdb/pwd_mkdb.c
diff -u src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.59 src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.60
--- src/usr.sbin/pwd_mkdb/pwd_mkdb.c:1.59	Sat Nov 27 17:30:26 2021
+++ src/usr.sbin/pwd_mkdb/pwd_mkdb.c	Fri Jan 19 14:08:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwd_mkdb.c,v 1.59 2021/11/27 22:30:26 rillig Exp $	*/
+/*	$NetBSD: pwd_mkdb.c,v 1.60 2024/01/19 19:08:49 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@ __COPYRIGHT("@(#) Copyright (c) 2000, 20
  The NetBSD Foundation, Inc.  All rights reserved.\
   Copyright (c) 1991, 1993, 1994\
  The Regents of the University of California.  All rights reserved.");
-__RCSID("$NetBSD: pwd_mkdb.c,v 1.59 2021/11/27 22:30:26 rillig Exp $");
+__RCSID("$NetBSD: pwd_mkdb.c,v 1.60 2024/01/19 19:08:49 christos Exp $");
 #endif /* not lint */
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -130,12 +130,8 @@ __RCSID("$NetBSD: pwd_mkdb.c,v 1.59 2021
 #define	PERM_INSECURE	(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
 #define	PERM_SECURE	(S_IRUSR | S_IWUSR)
 
-#if HAVE_NBTOOL_CONFIG_H
+// Defined in libc
 static const char __yp_token[] = "__YP!";
-#else
-/* Pull this out of the C library. */
-extern const char __yp_token[];
-#endif
 
 static HASHINFO openinfo = {
 	4096,		/* bsize */



CVS commit: src/sys/kern

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:07:38 UTC 2024

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

Log Message:
add lint comments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/subr_acl_nfs4.c

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

Modified files:

Index: src/sys/kern/subr_acl_nfs4.c
diff -u src/sys/kern/subr_acl_nfs4.c:1.1 src/sys/kern/subr_acl_nfs4.c:1.2
--- src/sys/kern/subr_acl_nfs4.c:1.1	Sat May 16 14:31:50 2020
+++ src/sys/kern/subr_acl_nfs4.c	Fri Jan 19 14:07:38 2024
@@ -37,7 +37,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/kern/subr_acl_nfs4.c 341827 2018-12-11 19:32:16Z mjg $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: subr_acl_nfs4.c,v 1.1 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_acl_nfs4.c,v 1.2 2024/01/19 19:07:38 christos Exp $");
 
 #include 
 #include 
@@ -261,6 +261,7 @@ __acl_nfs4_sync_mode_from_acl(mode_t *_m
  * Populate the ACL with entries inherited from parent_aclp.
  */
 static void		
+/*ARGSUSED*/
 acl_nfs4_inherit_entries(const struct acl *parent_aclp,
 struct acl *child_aclp, mode_t mode, int file_owner_id,
 int is_directory)
@@ -469,6 +470,7 @@ acl_nfs4_trivial_from_mode(struct acl *a
  * and acl_is_trivial_np(3).
  */
 void
+/*ARGSUSED*/
 __acl_nfs4_trivial_from_mode_libc(struct acl *aclp, int mode, int canonical_six)
 {
 



CVS commit: src/sys/kern

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 19:07:38 UTC 2024

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

Log Message:
add lint comments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/subr_acl_nfs4.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/x68k

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 18:49:10 UTC 2024

Modified Files:
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x68k/x68k: locore.s

Log Message:
Switch the x68k port to use the same clockframe layout as the other
m68k ports.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x68k/x68k/locore.s

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

Modified files:

Index: src/sys/arch/x68k/include/cpu.h
diff -u src/sys/arch/x68k/include/cpu.h:1.65 src/sys/arch/x68k/include/cpu.h:1.66
--- src/sys/arch/x68k/include/cpu.h:1.65	Thu Jan 18 14:39:07 2024
+++ src/sys/arch/x68k/include/cpu.h	Fri Jan 19 18:49:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.65 2024/01/18 14:39:07 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.66 2024/01/19 18:49:10 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -59,19 +59,20 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the x68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
  */
 struct clockframe {
-	u_short	sr;		/* sr at time of interrupt */
-	u_long	pc;		/* pc at time of interrupt */
-	u_short	vo;		/* vector offset (4-word frame) */
-};
+	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+	u_short	cf_sr;		/* sr at time of interrupt */
+	u_long	cf_pc;		/* pc at time of interrupt */
+	u_short	cf_vo;		/* vector offset (4-word frame) */
+} __attribute__((__packed__));
 
-#define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
-#define	CLKF_PC(framep)		((framep)->pc)
+#define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
+#define	CLKF_PC(framep)		((framep)->cf_pc)
 #if 0
 /* We would like to do it this way... */
-#define	CLKF_INTR(framep)	(((framep)->sr & PSL_M) == 0)
+#define	CLKF_INTR(framep)	(((framep)->cf_sr & PSL_M) == 0)
 #else
 /* but until we start using PSL_M, we have to do this instead */
 #define	CLKF_INTR(framep)	(0)	/* XXX */

Index: src/sys/arch/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.132 src/sys/arch/x68k/x68k/locore.s:1.133
--- src/sys/arch/x68k/x68k/locore.s:1.132	Fri Jan 19 18:18:56 2024
+++ src/sys/arch/x68k/x68k/locore.s	Fri Jan 19 18:49:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.132 2024/01/19 18:18:56 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.133 2024/01/19 18:49:10 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -672,8 +672,7 @@ ENTRY_NOPROFILE(timertrap)
 	addql	#1,_C_LABEL(intr_depth)
 	INTERRUPT_SAVEREG		| save scratch registers
 	addql	#1,_C_LABEL(intrcnt)+32	| count hardclock interrupts
-	lea	%sp@(16),%a1		| a1 = &clockframe
-	movl	%a1,%sp@-
+	movl	%sp,%sp@-		| push pointer to clockframe
 	jbsr	_C_LABEL(hardclock)	| hardclock(&frame)
 	addql	#4,%sp
 	CPUINFO_INCREMENT(CI_NINTR)	| chalk up another interrupt



CVS commit: src/sys/arch/x68k

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 18:49:10 UTC 2024

Modified Files:
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x68k/x68k: locore.s

Log Message:
Switch the x68k port to use the same clockframe layout as the other
m68k ports.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x68k/x68k/locore.s

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



CVS commit: src/lib/libc/compiler_rt

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:45:01 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
add lint flags for compiler_rt


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/compiler_rt/Makefile.inc

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

Modified files:

Index: src/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.42 src/lib/libc/compiler_rt/Makefile.inc:1.43
--- src/lib/libc/compiler_rt/Makefile.inc:1.42	Thu Nov  9 02:29:26 2023
+++ src/lib/libc/compiler_rt/Makefile.inc	Fri Jan 19 13:45:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.42 2023/11/09 07:29:26 rin Exp $
+# $NetBSD: Makefile.inc,v 1.43 2024/01/19 18:45:01 christos Exp $
 
 COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
@@ -316,4 +316,93 @@ COPTS.${src}+=	-D__SOFT_FP__
 .endif
 .endfor
 
+LINTFLAGS.GCDAProfiling.c += -X 123,132,351 # Ok, this is just sloppy
+LINTFLAGS.InstrProfiling.c += -X 351
+LINTFLAGS.InstrProfilingFile.c += -X 351
+LINTFLAGS.InstrProfilingPlatformLinux.c += -X 190,351
+LINTFLAGS.InstrProfilingValue.c += -X 132,231,275,351
+LINTFLAGS.InstrProfilingWriter.c += -X 132
+LINTFLAGS.absvdi2.c += -X 117,351
+LINTFLAGS.absvsi2.c += -X 117,351
+LINTFLAGS.absvsi3.c += -X 351
+LINTFLAGS.absvti2.c += -X 117,351
+LINTFLAGS.addvdi3.c += -X 351
+LINTFLAGS.addvsi3.c += -X 351
+LINTFLAGS.addvti3.c += -X 351
+LINTFLAGS.ashlti3.c += -X 351
+LINTFLAGS.ashrti3.c += -X 117,351
+LINTFLAGS.clzdi2.c += -X 351
+LINTFLAGS.clzsi2.c += -X 351
+LINTFLAGS.cmpti2.c += -X 351
+LINTFLAGS.crtzi.c += -X 351
+LINTFLAGS.crzdi2.c += -X 351
+LINTFLAGS.ctzdi2.c += -X 351
+LINTFLAGS.ctzsi2.c += -X 351
+LINTFLAGS.ctzti2.c += -X 351
+LINTFLAGS.divmodsi4.c += -X 351
+LINTFLAGS.divsi3.c += -X 117
+LINTFLAGS.divti3.c += -X 117,351
+LINTFLAGS.dlfcn_elf.c += -X 351
+LINTFLAGS.ffsdi2.c += -X 132,351
+LINTFLAGS.ffsti2.c += -X 132,351
+LINTFLAGS.fixdfdi.c += -X 132,309,351
+LINTFLAGS.fixdfsi.c += -X 132
+LINTFLAGS.fixsfdi.c += -X 132,351
+LINTFLAGS.fixunsdfdi.c += -X 132,309,351
+LINTFLAGS.fixunsdfsi.c += -X 132,309,351
+LINTFLAGS.fixunsdfti.c += -X 132,309,351
+LINTFLAGS.fixunssfdi.c += -X 132,309,351
+LINTFLAGS.fixunssfsi.c += -X 132,351
+LINTFLAGS.fixunssfti.c += -X 132,351
+LINTFLAGS.fixunsxfdi.c += -X 351
+LINTFLAGS.fixunsxfsi.c += -X 132,309,351
+LINTFLAGS.fixunsxfti.c += -X 132,351
+LINTFLAGS.fixxfdi.c += -X 351
+LINTFLAGS.fixxfti.c += -X 117,132,351
+LINTFLAGS.floatdidf.c += -X 351
+LINTFLAGS.floatdisf.c += -X 351
+LINTFLAGS.floatdixf.c += -X 351
+LINTFLAGS.floattidf.c += -X 117,122,141,267,351
+LINTFLAGS.floattisf.c += -X 117,351
+LINTFLAGS.floattisf.c += -X 117,351
+LINTFLAGS.floattixf.c += -X 117,122,351
+LINTFLAGS.floatuntidf.c += -X 122,141,267,351
+LINTFLAGS.floatuntisf.c += -X 351
+LINTFLAGS.floatuntixf.c += -X 122,351
+LINTFLAGS.int_util.c += -X 231
+LINTFLAGS.lshrti3.c += -X 351
+LINTFLAGS.modsi3.c += -X 117,351
+LINTFLAGS.modti3.c += -X 117,351
+LINTFLAGS.muldc3.c += -X 117,351
+LINTFLAGS.mulodi4.c += -X 117,351
+LINTFLAGS.mulosi4.c += -X 117,351
+LINTFLAGS.muloti4.c += -X 117,351
+LINTFLAGS.multi3.c += -X 351
+LINTFLAGS.mulvdi3.c += -X 117,351
+LINTFLAGS.mulvsi3.c += -X 117,351
+LINTFLAGS.mulvti3.c += -X 117,351
+LINTFLAGS.negdf2.c += -X 309,351
+LINTFLAGS.negsf2.c += -X 132,351
+LINTFLAGS.negti2.c += -X 351
+LINTFLAGS.negvdi2.c += -X 351
+LINTFLAGS.negvsi2.c += -X 351
+LINTFLAGS.negvti2.c += -X 351
+LINTFLAGS.parityti2.c += -X 351
+LINTFLAGS.popcountdi2.c += -X 351
+LINTFLAGS.popcountsi2.c += -X 351
+LINTFLAGS.popcountti2.c += -X 122,132,351
+LINTFLAGS.powidf2.c += -X 161,351
+LINTFLAGS.powisf2.c += -X 161,351
+LINTFLAGS.powixf2.c += -X 161,351
+LINTFLAGS.subvdi3.c += -X 351
+LINTFLAGS.subvsi3.c += -X 351
+LINTFLAGS.subvti3.c += -X 351
+LINTFLAGS.ucmpti2.c += -X 351
+LINTFLAGS.ucmpti2.c += -X 351
+LINTFLAGS.udivmodti4.c += -X 117,132
+LINTFLAGS.udivsi3.c += -X 117
+LINTFLAGS.udivti3.c += -X 351
+LINTFLAGS.umodsi3.c += -X 351
+LINTFLAGS.umodti3.c += -X 351
+
 .include "${COMPILER_RT_DIR}/abi.mk"



CVS commit: src/lib/libc/compiler_rt

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:45:01 UTC 2024

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc

Log Message:
add lint flags for compiler_rt


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/compiler_rt/Makefile.inc

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



CVS commit: src/lib/libc/stdlib

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:41:38 UTC 2024

Modified Files:
src/lib/libc/stdlib: getopt.c getopt_long.c

Log Message:
add some const


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/stdlib/getopt.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/stdlib/getopt_long.c

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

Modified files:

Index: src/lib/libc/stdlib/getopt.c
diff -u src/lib/libc/stdlib/getopt.c:1.29 src/lib/libc/stdlib/getopt.c:1.30
--- src/lib/libc/stdlib/getopt.c:1.29	Thu Jun  5 18:00:22 2014
+++ src/lib/libc/stdlib/getopt.c	Fri Jan 19 13:41:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $	*/
+/*	$NetBSD: getopt.c,v 1.30 2024/01/19 18:41:38 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $");
+__RCSID("$NetBSD: getopt.c,v 1.30 2024/01/19 18:41:38 christos Exp $");
 
 #include "namespace.h"
 
@@ -63,7 +63,7 @@ int
 getopt(int nargc, char * const nargv[], const char *ostr)
 {
 	static const char *place = EMSG;	/* option letter processing */
-	char *oli;/* option letter list index */
+	const char *oli;			/* option letter list index */
 
 	_DIAGASSERT(nargv != NULL);
 	_DIAGASSERT(ostr != NULL);

Index: src/lib/libc/stdlib/getopt_long.c
diff -u src/lib/libc/stdlib/getopt_long.c:1.27 src/lib/libc/stdlib/getopt_long.c:1.28
--- src/lib/libc/stdlib/getopt_long.c:1.27	Tue Sep  1 15:39:57 2015
+++ src/lib/libc/stdlib/getopt_long.c	Fri Jan 19 13:41:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: getopt_long.c,v 1.27 2015/09/01 19:39:57 kamil Exp $	*/
+/*	$NetBSD: getopt_long.c,v 1.28 2024/01/19 18:41:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: getopt_long.c,v 1.27 2015/09/01 19:39:57 kamil Exp $");
+__RCSID("$NetBSD: getopt_long.c,v 1.28 2024/01/19 18:41:38 christos Exp $");
 
 #include "namespace.h"
 
@@ -167,7 +167,7 @@ permute_args(int panonopt_start, int pan
 static int
 getopt_internal(int nargc, char **nargv, const char *options)
 {
-	char *oli;/* option letter list index */
+	const char *oli;			/* option letter list index */
 	int optchar;
 
 	_DIAGASSERT(nargv != NULL);



CVS commit: src/lib/libc/stdlib

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:41:30 UTC 2024

Modified Files:
src/lib/libc/stdlib: Makefile.inc

Log Message:
Add lint flags for jemalloc


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/lib/libc/stdlib/Makefile.inc

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

Modified files:

Index: src/lib/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.95 src/lib/libc/stdlib/Makefile.inc:1.96
--- src/lib/libc/stdlib/Makefile.inc:1.95	Mon Mar  4 12:30:33 2019
+++ src/lib/libc/stdlib/Makefile.inc	Fri Jan 19 13:41:30 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.95 2019/03/04 17:30:33 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.96 2024/01/19 18:41:30 christos Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -99,3 +99,35 @@ MLINKS+=strtoul.3 strtoull.3
 MLINKS+=strtoul.3 strtoumax.3
 MLINKS+=strtoul.3 strtouq.3
 MLINKS+=tsearch.3 tfind.3 tsearch.3 twalk.3 tsearch.3 tdelete.3
+
+# jemalloc
+LINTFLAGS.arena.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.background_thread.c += -X 86,117,132,161,191,193,207,217,226
+LINTFLAGS.base.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.bin.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.bitmap.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.chk.c += -X 191,193,217,226,239
+LINTFLAGS.ckh.c += -X 86,117,161,191,193,207,217,226,239,284
+LINTFLAGS.ctl.c += -X 86,117,135,161,193,191,207,217,226
+LINTFLAGS.divide.c += -X 226
+LINTFLAGS.extent.c += -X 86,161,117,191,193,207,217,226
+LINTFLAGS.extent_dss.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.extent_mmap.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.jemalloc.c += -X 86,117,161,191,193,207,217,226,236,307
+LINTFLAGS.hooks.c += -X 226
+LINTFLAGS.large.c += -X 86,161,117,191,193,207,217,226
+LINTFLAGS.log.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.malloc_io.c += -X 86,117,161,191,193,207,217,226,284
+LINTFLAGS.mutex.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.mutex_pool.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.nstime.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.pages.c += -X 86,117,161,191,193,207,217,226,298
+LINTFLAGS.prng.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.prof.c += -X 86,117,161,181,191,193,207,217,226,236
+LINTFLAGS.rtree.c += -X 86,117,161,191,193,207,217,226,239
+LINTFLAGS.sz.c += -X 86,226
+LINTFLAGS.stats.c += -X 42,86,117,135,161,191,193,207,217,226,247,351
+LINTFLAGS.tcache.c += -X 86,117,161,191,193,207,217,226,239,309
+LINTFLAGS.ticker.c += -X 86,117,161,191,193,207,217,226
+LINTFLAGS.tsd.c += -X 86,117,161,191,193,207,217,226,346,351
+LINTFLAGS.witness.c += -X 86,117,161,191,193,207,217,226



CVS commit: src/lib/libc/stdlib

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:41:38 UTC 2024

Modified Files:
src/lib/libc/stdlib: getopt.c getopt_long.c

Log Message:
add some const


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/stdlib/getopt.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/stdlib/getopt_long.c

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



CVS commit: src/lib/libc/stdlib

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:41:30 UTC 2024

Modified Files:
src/lib/libc/stdlib: Makefile.inc

Log Message:
Add lint flags for jemalloc


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/lib/libc/stdlib/Makefile.inc

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



CVS commit: src/include

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:40:35 UTC 2024

Modified Files:
src/include: md2.h unistd.h

Log Message:
Add missing decls


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/include/md2.h
cvs rdiff -u -r1.163 -r1.164 src/include/unistd.h

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

Modified files:

Index: src/include/md2.h
diff -u src/include/md2.h:1.8 src/include/md2.h:1.9
--- src/include/md2.h:1.8	Tue Aug  1 03:04:15 2023
+++ src/include/md2.h	Fri Jan 19 13:40:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: md2.h,v 1.8 2023/08/01 07:04:15 mrg Exp $	*/
+/*	$NetBSD: md2.h,v 1.9 2024/01/19 18:40:35 christos Exp $	*/
 
 #ifndef _MD2_H_
 #define _MD2_H_
@@ -25,6 +25,9 @@ char	*MD2End(MD2_CTX *, char[MD2_DIGEST_
 char	*MD2File(const char *, char *);
 char	*MD2FileChunk(const char *, char *, off_t, off_t);
 char	*MD2Data(const unsigned char *, size_t, char[MD2_DIGEST_STRING_LENGTH]);
+#ifdef _LIBC_INTERNAL
+void	MD2Transform(MD2_CTX *);
+#endif
 __END_DECLS
 
 #endif /* _MD2_H_ */

Index: src/include/unistd.h
diff -u src/include/unistd.h:1.163 src/include/unistd.h:1.164
--- src/include/unistd.h:1.163	Tue May 31 09:42:59 2022
+++ src/include/unistd.h	Fri Jan 19 13:40:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.163 2022/05/31 13:42:59 riastradh Exp $	*/
+/*	$NetBSD: unistd.h,v 1.164 2024/01/19 18:40:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -414,5 +414,10 @@ extern	 int optreset;		/* getopt(3) exte
 extern	 char *suboptarg;	/* getsubopt(3) external variable */
 #endif
 
+#ifdef _LIBC_INTERNAL
+pid_t	__fork(void);
+pid_t	__locked_fork(int *) __weak;
+#endif
+
 __END_DECLS
 #endif /* !_UNISTD_H_ */



CVS commit: src/include

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:40:35 UTC 2024

Modified Files:
src/include: md2.h unistd.h

Log Message:
Add missing decls


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/include/md2.h
cvs rdiff -u -r1.163 -r1.164 src/include/unistd.h

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



CVS commit: src/sys/sys

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:39:59 UTC 2024

Modified Files:
src/sys/sys: ptree.h sha2.h sysctl.h

Log Message:
Add missing decls.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/ptree.h
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/sha2.h
cvs rdiff -u -r1.237 -r1.238 src/sys/sys/sysctl.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/sys/ptree.h
diff -u src/sys/sys/ptree.h:1.8 src/sys/sys/ptree.h:1.9
--- src/sys/sys/ptree.h:1.8	Sat Oct  6 18:15:09 2012
+++ src/sys/sys/ptree.h	Fri Jan 19 13:39:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptree.h,v 1.8 2012/10/06 22:15:09 matt Exp $	*/
+/*	$NetBSD: ptree.h,v 1.9 2024/01/19 18:39:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -190,5 +190,6 @@ void *	ptree_find_filtered_node(pt_tree_
 	ptree_find_filtered_node((pt), (key), NULL, NULL)
 void	ptree_remove_node(pt_tree_t *, void *);
 void *	ptree_iterate(pt_tree_t *, const void *, pt_direction_t);
+bool	ptree_check(const pt_tree_t *pt);
 
 #endif /* _SYS_PTREE_H_ */

Index: src/sys/sys/sha2.h
diff -u src/sys/sys/sha2.h:1.3 src/sys/sys/sha2.h:1.4
--- src/sys/sys/sha2.h:1.3	Tue May 26 04:04:12 2009
+++ src/sys/sys/sha2.h	Fri Jan 19 13:39:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sha2.h,v 1.3 2009/05/26 08:04:12 joerg Exp $	*/
+/*	$NetBSD: sha2.h,v 1.4 2024/01/19 18:39:59 christos Exp $	*/
 /*	$KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $	*/
 
 /*
@@ -115,6 +115,13 @@ char *SHA512_FileChunk(const char *, cha
 char *SHA512_File(const char *, char *);
 char *SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
 #endif /* !_KERNEL */
+
+#ifdef _LIBC_INTERNAL
+void SHA224_Transform(SHA224_CTX *, const uint32_t*);
+void SHA256_Transform(SHA256_CTX *, const uint32_t*);
+void SHA384_Transform(SHA384_CTX *, const uint64_t*);
+void SHA512_Transform(SHA512_CTX *, const uint64_t*);
+#endif
 __END_DECLS
 
 #endif /* __SHA2_H__ */

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.237 src/sys/sys/sysctl.h:1.238
--- src/sys/sys/sysctl.h:1.237	Thu Apr  6 23:01:21 2023
+++ src/sys/sys/sysctl.h	Fri Jan 19 13:39:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.237 2023/04/07 03:01:21 simonb Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.238 2024/01/19 18:39:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -1231,6 +1231,9 @@ int	proc_compare(const struct kinfo_proc
 const struct kinfo_proc2 *, const struct kinfo_lwp *);
 void	*asysctl(const int *, size_t, size_t *);
 void	*asysctlbyname(const char *, size_t *);
+#ifdef _LIBC_INTERNAL
+int	__learn_tree(int *, u_int, struct sysctlnode *);
+#endif
 __END_DECLS
 
 #endif	/* !_KERNEL */



CVS commit: src/sys/sys

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:39:59 UTC 2024

Modified Files:
src/sys/sys: ptree.h sha2.h sysctl.h

Log Message:
Add missing decls.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/ptree.h
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/sha2.h
cvs rdiff -u -r1.237 -r1.238 src/sys/sys/sysctl.h

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



CVS commit: src/sys/compat

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:39:15 UTC 2024

Modified Files:
src/sys/compat/common: kern_time_50.c
src/sys/compat/sys: mount.h resource.h statvfs.h

Log Message:
Add missing decls, make rusage_to_rusage50 static inline.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/sys/mount.h
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/resource.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/statvfs.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/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.37 src/sys/compat/common/kern_time_50.c:1.38
--- src/sys/compat/common/kern_time_50.c:1.37	Tue Sep  7 07:43:02 2021
+++ src/sys/compat/common/kern_time_50.c	Fri Jan 19 13:39:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.37 2021/09/07 11:43:02 riastradh Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.38 2024/01/19 18:39:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.37 2021/09/07 11:43:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.38 2024/01/19 18:39:15 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -456,18 +456,6 @@ compat_50_sys_mq_timedreceive(struct lwp
 #endif
 }
 
-void
-rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50)
-{
-	memset(ru50, 0, sizeof(*ru50));
-	(void)memcpy(&ru50->ru_first, &ru->ru_first,
-	(char *)&ru50->ru_last - (char *)&ru50->ru_first +
-	sizeof(ru50->ru_last));
-	ru50->ru_maxrss = ru->ru_maxrss;
-	timeval_to_timeval50(&ru->ru_utime, &ru50->ru_utime);
-	timeval_to_timeval50(&ru->ru_stime, &ru50->ru_stime);
-}
-
 int
 compat_50_sys_getrusage(struct lwp *l,
 const struct compat_50_sys_getrusage_args *uap, register_t *retval)

Index: src/sys/compat/sys/mount.h
diff -u src/sys/compat/sys/mount.h:1.15 src/sys/compat/sys/mount.h:1.16
--- src/sys/compat/sys/mount.h:1.15	Mon Aug 30 04:40:00 2021
+++ src/sys/compat/sys/mount.h	Fri Jan 19 13:39:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount.h,v 1.15 2021/08/30 08:40:00 riastradh Exp $	*/
+/*	$NetBSD: mount.h,v 1.16 2024/01/19 18:39:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -194,6 +194,12 @@ int	__compat___fhstat30(const struct com
 int	__compat___fhstat40(const void *, size_t, struct stat30 *) __dso_hidden;
 struct stat;
 int	__fhstat50(const void *, size_t, struct stat *);
+int	__fhopen40(const void *, size_t, int);
+int	fhopen(const struct compat_30_fhandle *, int);
+int __getfh30(const char *, void*, size_t *);
+int	getfh(const char *path, struct compat_30_fhandle *fhp);
+int	mount(const char *, const char *, int, void *);
+int	__mount50(const char *, const char *, int, void *, size_t);
 #endif /* _NETBSD_SOURCE */
 __END_DECLS
 

Index: src/sys/compat/sys/resource.h
diff -u src/sys/compat/sys/resource.h:1.5 src/sys/compat/sys/resource.h:1.6
--- src/sys/compat/sys/resource.h:1.5	Fri Oct  4 17:07:37 2013
+++ src/sys/compat/sys/resource.h	Fri Jan 19 13:39:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: resource.h,v 1.5 2013/10/04 21:07:37 christos Exp $	*/
+/*	$NetBSD: resource.h,v 1.6 2024/01/19 18:39:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -57,7 +57,17 @@ struct	rusage50 {
 	long	ru_nivcsw;		/* involuntary " */
 };
 
-void rusage_to_rusage50(const struct rusage *, struct rusage50 *);
+static __inline void
+rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50)
+{
+	memset(ru50, 0, sizeof(*ru50));
+	(void)memcpy(&ru50->ru_first, &ru->ru_first,
+	(char *)&ru50->ru_last - (char *)&ru50->ru_first +
+	sizeof(ru50->ru_last));
+	ru50->ru_maxrss = ru->ru_maxrss;
+	timeval_to_timeval50(&ru->ru_utime, &ru50->ru_utime);
+	timeval_to_timeval50(&ru->ru_stime, &ru50->ru_stime);
+}
 
 #ifndef _KERNEL
 __BEGIN_DECLS

Index: src/sys/compat/sys/statvfs.h
diff -u src/sys/compat/sys/statvfs.h:1.4 src/sys/compat/sys/statvfs.h:1.5
--- src/sys/compat/sys/statvfs.h:1.4	Tue Sep  7 07:43:05 2021
+++ src/sys/compat/sys/statvfs.h	Fri Jan 19 13:39:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: statvfs.h,v 1.4 2021/09/07 11:43:05 riastradh Exp $	 */
+/*	$NetBSD: statvfs.h,v 1.5 2024/01/19 18:39:15 christos Exp $	 */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -155,6 +155,10 @@ int	__getvfsstat90(struct statvfs *, siz
 
 int	__getmntinfo90(struct statvfs **, int);
 
+struct compat_30_fhandle;
+int	fhstatvfs(const struct compat_30_fhandle *, struct statvfs90 *);
+int	fhstatvfs1(const struct compat_30_fhandle *, struct statvfs90 *, int);
+
 #endif /* __LIBC12_SOURCE__ */
 
 #endif /* _KERNEL */



CVS commit: src/sys/compat

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:39:15 UTC 2024

Modified Files:
src/sys/compat/common: kern_time_50.c
src/sys/compat/sys: mount.h resource.h statvfs.h

Log Message:
Add missing decls, make rusage_to_rusage50 static inline.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/sys/mount.h
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/resource.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/statvfs.h

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



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

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:23:13 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
add \e


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/xlint/lint1/lex.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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.197 src/usr.bin/xlint/lint1/lex.c:1.198
--- src/usr.bin/xlint/lint1/lex.c:1.197	Sun Jan  7 13:42:37 2024
+++ src/usr.bin/xlint/lint1/lex.c	Fri Jan 19 13:23:13 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.197 2024/01/07 18:42:37 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.198 2024/01/19 18:23:13 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.197 2024/01/07 18:42:37 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.198 2024/01/19 18:23:13 christos Exp $");
 #endif
 
 #include 
@@ -791,6 +791,8 @@ read_escaped_backslash(int delim)
 		return '\a';
 	case 'b':
 		return '\b';
+	case 'e':	/* Not in the C standard yet, compilers recognize it */
+		return '\e';
 	case 'f':
 		return '\f';
 	case 'n':



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

2024-01-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 19 18:23:13 UTC 2024

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
add \e


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/xlint/lint1/lex.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

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 18:18:56 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: locore.s machdep.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/atari/atari: intr.c locore.s
src/sys/arch/atari/include: intr.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/hp300: locore.s
src/sys/arch/hp300/include: cpu.h
src/sys/arch/luna68k/luna68k: locore.s
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s
src/sys/arch/mac68k/mac68k: intr.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/mvme68k/mvme68k: trap.c
src/sys/arch/news68k/include: cpu.h
src/sys/arch/news68k/news68k: locore.s
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: trap.c
src/sys/arch/sun2/sun2: clock.c
src/sys/arch/sun3/sun3: clock.c
src/sys/arch/sun3/sun3x: clock.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/x68k/x68k: locore.s machdep.c

Log Message:
Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/atari/atari/intr.c
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/atari/atari/locore.s
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/atari/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_intr_stubs.s
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sun2/sun2/clock.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sun3/sun3/clock.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sun3/sun3x/clock.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.211 -r1.212 src/sys/arch/x68k/x68k/machdep.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

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 18:18:56 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: locore.s machdep.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/atari/atari: intr.c locore.s
src/sys/arch/atari/include: intr.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/hp300: locore.s
src/sys/arch/hp300/include: cpu.h
src/sys/arch/luna68k/luna68k: locore.s
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s
src/sys/arch/mac68k/mac68k: intr.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/mvme68k/mvme68k: trap.c
src/sys/arch/news68k/include: cpu.h
src/sys/arch/news68k/news68k: locore.s
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: trap.c
src/sys/arch/sun2/sun2: clock.c
src/sys/arch/sun3/sun3: clock.c
src/sys/arch/sun3/sun3x: clock.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/x68k/x68k: locore.s machdep.c

Log Message:
Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/atari/atari/intr.c
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/atari/atari/locore.s
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/atari/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_intr_stubs.s
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sun2/sun2/clock.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sun3/sun3/clock.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sun3/sun3x/clock.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.211 -r1.212 src/sys/arch/x68k/x68k/machdep.c

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

Modified files:

Index: src/sys/arch/amiga/amiga/locore.s
diff -u src/sys/arch/amiga/amiga/locore.s:1.171 src/sys/arch/amiga/amiga/locore.s:1.172
--- src/sys/arch/amiga/amiga/locore.s:1.171	Fri Jan 19 17:08:42 2024
+++ src/sys/arch/amiga/amiga/locore.s	Fri Jan 19 18:18:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.171 2024/01/19 17:08:42 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.172 2024/01/19 18:18:53 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -440,16 +440,16 @@ ENTRY_NOPROFILE(trace)
  * and serial RBF (int5) specially, to improve performance
  */
 ENTRY_NOPROFILE(spurintr)
-	addql	#1,_C_LABEL(interrupt_depth)
+	addql	#1,_C_LABEL(intr_depth)
 	addql	#1,_C_LABEL(intrcnt)+0
 	INTERRUPT_SAVEREG
 	CPUINFO_INCREMENT(CI_NINTR)
 	INTERRUPT_RESTOREREG
-	subql	#1,_C_LABEL(interrupt_depth)
+	subql	#1,_C_LABEL(intr_depth)
 	jra	_ASM_LABEL(rei)
 
 ENTRY_NOPROFILE(lev5intr)
-	addql	#1,_C_LABEL(interrupt_depth)
+	addql	#1,_C_LABEL(intr_depth)
 	INTERRUPT_SAVEREG
 #include "ser.h"
 #if NSER > 0
@@ -461,12 +461,12 @@ ENTRY_NOPROFILE(lev5intr)
 	CPUINFO_INCREMENT(CI_NINTR)
 	INTERRUPT_RESTOREREG
 	addql	#1,_C_LABEL(intrcnt)+20
-	subql	#1,_C_LABEL(interrupt_depth)
+	subql	#1,_C_LABEL(intr_depth)
 	jra	_ASM_LABEL(rei)
 
 #ifdef DRACO
 ENTRY_NOPROFILE(DraCoLev2intr)
-	addql	#1,_C_LABEL(interrupt_depth)
+	addql	#1,_C_LABEL(intr_depth)
 	INTERRUPT_SAVEREG
 
 	CIAAADDR(%a0)
@@ -488,12 +488,12 @@ ENTRY_NOPROFILE(DraCoLev2intr)
 Ldraciaend:
 	CPUINFO_INCREMENT(CI_NINTR)
 	INTERRUPT_RESTOREREG
-	subql	#1,_C_LABEL(interrupt_depth)
+	subql	#1,_C_LABEL(intr_depth)
 	jra	_ASM_LABEL(rei)
 
 /* XXX on the DraCo rev. 4 or later, lev 1 is vectored here. */
 ENTRY_NOPROFILE(DraCoLev1intr)
-	addql	#1,_C_LABEL(interrupt_depth)
+	addql	#1,_C_LABEL(intr_depth)
 	INTERRUPT_SAVEREG
 	movl	_C_LABEL(draco_ioct),%a0
 	btst	#5,%a0@(7)
@@ -521,12 +521,12 @@ Ldrclockretry:
 
 	CPUINFO_INCREMENT(CI_NINTR)
 	INTERRUPT_RESTOREREG
-	subql	#1,_C_LABEL(interrupt_depth)
+	subql	#1,_C_LABEL(intr_depth)
 	jra	_ASM_LABEL(rei)	| XXX

CVS commit: src/sys/arch/amiga

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 17:08:42 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: locore.s
src/sys/arch/amiga/include: cpu.h

Log Message:
Switch the amiga port to use the same clockframe layout as the other
m68k ports.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/amiga/include/cpu.h

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

Modified files:

Index: src/sys/arch/amiga/amiga/locore.s
diff -u src/sys/arch/amiga/amiga/locore.s:1.170 src/sys/arch/amiga/amiga/locore.s:1.171
--- src/sys/arch/amiga/amiga/locore.s:1.170	Wed Jan 17 12:33:49 2024
+++ src/sys/arch/amiga/amiga/locore.s	Fri Jan 19 17:08:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.170 2024/01/17 12:33:49 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.171 2024/01/19 17:08:42 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -479,9 +479,7 @@ ENTRY_NOPROFILE(DraCoLev2intr)
 	btst	#0,%d0			| timerA interrupt?
 	jeq	Ldraciaend
 
-	lea	%sp@(16),%a1		| get pointer to PS
-	movl	%a1,%sp@-		| push pointer to PS, PC
-
+	movl	%sp,%sp@-		| push pointer to clockframe
 	movw	#PSL_HIGHIPL,%sr	| hardclock at high IPL
 	jbsr	_C_LABEL(hardclock)	| call generic clock int routine
 	addql	#4,%sp			| pop params
@@ -504,10 +502,9 @@ ENTRY_NOPROFILE(DraCoLev1intr)
 	jeq	Ldrintrcommon	| so test last.
 	movw	#PSL_HIGHIPL,%sr	| run clock at high ipl
 Ldrclockretry:
-	lea	%sp@(16),%a1	| get pointer to PS
-	movl	%a1,%sp@-	| push pointer to PS, PC
+	movl	%sp,%sp@-		| push pointer to clockframe
 	jbsr	_C_LABEL(hardclock)
-	addql	#4,%sp		| pop params
+	addql	#4,%sp			| pop params
 	addql	#1,_C_LABEL(intrcnt)+32	| add another system clock interrupt
 
 	movl	_C_LABEL(draco_ioct),%a0
@@ -627,8 +624,8 @@ ENTRY_NOPROFILE(fake_lev6intr)
 	btst	#0,%d0			| timerA interrupt?
 	jeq Ltstciab4		| no
 	movl	%d0,%sp@-		| push CIAB interrupt flags
-	lea	%sp@(20),%a1		| get pointer to PS
-	movl	%a1,%sp@-		| push pointer to PS, PC
+	lea	%sp@(4),%a1		| get pointer to clockframe
+	movl	%a1,%sp@-		| push pointer to clockframe
 	jbsr	_C_LABEL(hardclock)	| call generic clock int routine
 	addql	#4,%sp			| pop params
 	addql	#1,_C_LABEL(intrcnt)+32	| add another system clock interrupt

Index: src/sys/arch/amiga/include/cpu.h
diff -u src/sys/arch/amiga/include/cpu.h:1.85 src/sys/arch/amiga/include/cpu.h:1.86
--- src/sys/arch/amiga/include/cpu.h:1.85	Thu Jan 18 14:39:05 2024
+++ src/sys/arch/amiga/include/cpu.h	Fri Jan 19 17:08:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.85 2024/01/18 14:39:05 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.86 2024/01/19 17:08:42 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -55,19 +55,19 @@ extern volatile unsigned int interrupt_d
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the amiga, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
  */
 struct clockframe {
-	u_short	sr;		/* sr at time of interrupt */
-	u_long	pc;		/* pc at time of interrupt */
-	u_short	vo;		/* vector offset (4-word frame) */
-};
+	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+	u_short	cf_sr;		/* sr at time of interrupt */
+	u_long	cf_pc;		/* pc at time of interrupt */
+	u_short	cf_vo;		/* vector offset (4-word frame) */
+} __attribute__((__packed__));
 
-#define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
-#define	CLKF_PC(framep)		((framep)->pc)
+#define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
+#define	CLKF_PC(framep)		((framep)->cf_pc)
 #define	CLKF_INTR(framep)	(interrupt_depth > 1)
 
-
 /*
  * Preempt the current process if in interrupt from user mode,
  * or after the current trap/syscall if in system mode.



CVS commit: src/sys/arch/amiga

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 17:08:42 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: locore.s
src/sys/arch/amiga/include: cpu.h

Log Message:
Switch the amiga port to use the same clockframe layout as the other
m68k ports.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/amiga/include/cpu.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/riscv

2024-01-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 19 09:09:39 UTC 2024

Modified Files:
src/sys/arch/riscv/riscv: autoconf.c

Log Message:
Use fdt_cpu_rootconf


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/autoconf.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/riscv

2024-01-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 19 09:09:39 UTC 2024

Modified Files:
src/sys/arch/riscv/riscv: autoconf.c

Log Message:
Use fdt_cpu_rootconf


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/autoconf.c

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

Modified files:

Index: src/sys/arch/riscv/riscv/autoconf.c
diff -u src/sys/arch/riscv/riscv/autoconf.c:1.5 src/sys/arch/riscv/riscv/autoconf.c:1.6
--- src/sys/arch/riscv/riscv/autoconf.c:1.5	Mon Jul 10 07:04:20 2023
+++ src/sys/arch/riscv/riscv/autoconf.c	Fri Jan 19 09:09:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.5 2023/07/10 07:04:20 rin Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.6 2024/01/19 09:09:39 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: autoconf.c,v 1.5 2023/07/10 07:04:20 rin Exp $");
+__RCSID("$NetBSD: autoconf.c,v 1.6 2024/01/19 09:09:39 skrll Exp $");
 
 #include 
 
@@ -57,10 +57,26 @@ cpu_configure(void)
 	spl0();
 }
 
+/*
+ * Set up the root device from the boot args.
+ *
+ * cpu_bootconf() is called before RAIDframe root detection,
+ * and cpu_rootconf() is called after.
+ */
 void
-cpu_rootconf(void)
+cpu_bootconf(void)
 {
+#ifndef MEMORY_DISK_IS_ROOT
+	fdt_cpu_rootconf();
+#endif
+}
 
+void
+cpu_rootconf(void)
+{
+	cpu_bootconf();
+	aprint_normal("boot device: %s\n",
+	booted_device != NULL ? device_xname(booted_device) : "");
 	rootconf();
 }
 



CVS commit: src/sys

2024-01-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 19 09:09:04 UTC 2024

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_boot.c fdt_boot.h

Log Message:
Make fdt_cpu_rootconf available for other machines/platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_boot.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_boot.h

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



CVS commit: src/sys

2024-01-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 19 09:09:04 UTC 2024

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_boot.c fdt_boot.h

Log Message:
Make fdt_cpu_rootconf available for other machines/platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_boot.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_boot.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/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.106 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.107
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.106	Fri Aug  4 09:06:33 2023
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Fri Jan 19 09:09:04 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.106 2023/08/04 09:06:33 mrg Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.107 2024/01/19 09:09:04 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.106 2023/08/04 09:06:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.107 2024/01/19 09:09:04 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -127,7 +127,6 @@ extern char KERNEL_BASE_phys[];
 
 static void fdt_device_register(device_t, void *);
 static void fdt_device_register_post_config(device_t, void *);
-static void fdt_cpu_rootconf(void);
 static void fdt_reset(void);
 static void fdt_powerdown(void);
 
@@ -467,115 +466,6 @@ delay(u_int us)
 
 	plat->fp_delay(us);
 }
-
-static void
-fdt_detect_root_device(device_t dev)
-{
-	int error, len;
-
-	const int chosen = OF_finddevice("/chosen");
-	if (chosen < 0)
-		return;
-
-	if (of_hasprop(chosen, "netbsd,mbr") &&
-	of_hasprop(chosen, "netbsd,partition")) {
-		struct mbr_sector mbr;
-		uint8_t buf[DEV_BSIZE];
-		uint8_t hash[16];
-		const uint8_t *rhash;
-		struct vnode *vp;
-		MD5_CTX md5ctx;
-		size_t resid;
-		u_int part;
-
-		/*
-		 * The bootloader has passed in a partition index and MD5 hash
-		 * of the MBR sector. Read the MBR of this device, calculate the
-		 * hash, and compare it with the value passed in.
-		 */
-		rhash = fdtbus_get_prop(chosen, "netbsd,mbr", &len);
-		if (rhash == NULL || len != 16)
-			return;
-		of_getprop_uint32(chosen, "netbsd,partition", &part);
-		if (part >= MAXPARTITIONS)
-			return;
-
-		vp = opendisk(dev);
-		if (!vp)
-			return;
-		error = vn_rdwr(UIO_READ, vp, buf, sizeof(buf), 0, UIO_SYSSPACE,
-		IO_NODELOCKED, NOCRED, &resid, NULL);
-		VOP_CLOSE(vp, FREAD, NOCRED);
-		vput(vp);
-
-		if (error != 0)
-			return;
-
-		memcpy(&mbr, buf, sizeof(mbr));
-		MD5Init(&md5ctx);
-		MD5Update(&md5ctx, (void *)&mbr, sizeof(mbr));
-		MD5Final(hash, &md5ctx);
-
-		if (memcmp(rhash, hash, 16) == 0) {
-			booted_device = dev;
-			booted_partition = part;
-		}
-
-		return;
-	}
-
-	if (of_hasprop(chosen, "netbsd,gpt-guid")) {
-		const struct uuid *guid =
-		fdtbus_get_prop(chosen, "netbsd,gpt-guid", &len);
-
-		if (guid == NULL || len != 16)
-			return;
-
-		char guidstr[UUID_STR_LEN];
-		uuid_snprintf(guidstr, sizeof(guidstr), guid);
-
-		device_t dv = dkwedge_find_by_wname(guidstr);
-		if (dv != NULL)
-			booted_device = dv;
-
-		return;
-	}
-
-	if (of_hasprop(chosen, "netbsd,gpt-label")) {
-		const char *label = fdtbus_get_string(chosen, "netbsd,gpt-label");
-		if (label == NULL || *label == '\0')
-			return;
-
-		device_t dv = dkwedge_find_by_wname(label);
-		if (dv != NULL)
-			booted_device = dv;
-
-		return;
-	}
-
-	if (of_hasprop(chosen, "netbsd,booted-mac-address")) {
-		const uint8_t *macaddr =
-		fdtbus_get_prop(chosen, "netbsd,booted-mac-address", &len);
-		struct ifnet *ifp;
-
-		if (macaddr == NULL || len != 6)
-			return;
-
-		int s = pserialize_read_enter();
-		IFNET_READER_FOREACH(ifp) {
-			if (memcmp(macaddr, CLLADDR(ifp->if_sadl), len) == 0) {
-device_t dv = device_find_by_xname(ifp->if_xname);
-if (dv != NULL)
-	booted_device = dv;
-break;
-			}
-		}
-		pserialize_read_exit(s);
-
-		return;
-	}
-}
-
 static void
 fdt_device_register(device_t self, void *aux)
 {
@@ -617,27 +507,6 @@ fdt_device_register_post_config(device_t
 }
 
 static void
-fdt_cpu_rootconf(void)
-{
-	device_t dev;
-	deviter_t di;
-
-	if (booted_device != NULL)
-		return;
-
-	for (dev = deviter_first(&di, 0); dev; dev = deviter_next(&di)) {
-		if (device_class(dev) != DV_DISK)
-			continue;
-
-		fdt_detect_root_device(dev);
-
-		if (booted_device != NULL)
-			break;
-	}
-	deviter_release(&di);
-}
-
-static void
 fdt_reset(void)
 {
 	const struct fdt_platform *plat = fdt_platform_find();

Index: src/sys/dev/fdt/fdt_boot.c
diff -u src/sys/dev/fdt/fdt_boot.c:1.4 src/sys/dev/fdt/fdt_boot.c:1.5
--- src/sys/dev/fdt/fdt_boot.c:1.4	Tue Jul 11 05:57:44 2023
+++ src/sys/dev/fdt/fdt_boot.c	Fri Jan 19 09:09:04 2024
@@ -1,4 +1,