CVS commit: src/sys/arch/sparc64/sparc64

2022-05-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon May 16 21:28:06 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c

Log Message:
try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable.  in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE).  this
code not commited.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/cache.h
diff -u src/sys/arch/sparc64/sparc64/cache.h:1.30 src/sys/arch/sparc64/sparc64/cache.h:1.31
--- src/sys/arch/sparc64/sparc64/cache.h:1.30	Sat Dec 11 19:24:21 2021
+++ src/sys/arch/sparc64/sparc64/cache.h	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.h,v 1.30 2021/12/11 19:24:21 mrg Exp $ */
+/*	$NetBSD: cache.h,v 1.31 2022/05/16 21:28:05 mrg Exp $ */
 
 /*
  * Copyright (c) 2011 Matthew R. Green
@@ -93,6 +93,7 @@ extern	int	icache_size;
 void 	dcache_flush_page_us(paddr_t);	/* flush page from D$ */
 void 	dcache_flush_page_usiii(paddr_t); /* flush page from D$ */
 void 	sp_blast_dcache(int, int);	/* Clear entire D$ */
+void 	sp_blast_dcache_disabled(int, int); /* Above with D$ disable. */
 void 	blast_icache_us(void);		/* Clear entire I$ */
 void 	blast_icache_usiii(void);	/* Clear entire I$ */
 

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.427 src/sys/arch/sparc64/sparc64/locore.s:1.428
--- src/sys/arch/sparc64/sparc64/locore.s:1.427	Sat Apr  3 17:01:24 2021
+++ src/sys/arch/sparc64/sparc64/locore.s	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.427 2021/04/03 17:01:24 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.428 2022/05/16 21:28:05 mrg Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6193,8 +6193,10 @@ ENTRY(sp_tlb_flush_all_usiii)
 
 /*
  * sp_blast_dcache(int dcache_size, int dcache_line_size)
+ * sp_blast_dcache_disabled(int dcache_size, int dcache_line_size)
  *
- * Clear out all of D$ regardless of contents
+ * Clear out all of D$ regardless of contents.  The latter one also
+ * disables the D$ while doing so.
  */
 	.align 8
 ENTRY(sp_blast_dcache)
@@ -6227,6 +6229,46 @@ ENTRY(sp_blast_dcache)
 	 wrpr	%o3, %pstate
 #endif
 
+	.align 8
+ENTRY(sp_blast_dcache_disabled)
+/*
+ * We turn off interrupts for the duration to prevent RED exceptions.
+ */
+#ifdef PROF
+	save	%sp, -CC64FSZ, %sp
+#endif
+
+	rdpr	%pstate, %o3
+	sub	%o0, %o1, %o0
+	andn	%o3, PSTATE_IE, %o4			! Turn off PSTATE_IE bit
+	wrpr	%o4, 0, %pstate
+
+	ldxa[%g0] ASI_MCCR, %o5
+	andn	%o5, MCCR_DCACHE_EN, %o4		! Turn off the D$
+	stxa	%o4, [%g0] ASI_MCCR
+	flush 	%g0
+
+1:
+	stxa	%g0, [%o0] ASI_DCACHE_TAG
+	membar	#Sync
+	brnz,pt	%o0, 1b
+	 sub	%o0, %o1, %o0
+
+	sethi	%hi(KERNBASE), %o2
+	flush	%o2
+	membar	#Sync
+
+	stxa	%o5, [%g0] ASI_MCCR			! Restore the D$
+	flush 	%g0
+#ifdef PROF
+	wrpr	%o3, %pstate
+	ret
+	 restore
+#else
+	retl
+	 wrpr	%o3, %pstate
+#endif
+
 #ifdef MULTIPROCESSOR
 /*
  * void sparc64_ipi_blast_dcache(int dcache_size, int dcache_line_size)

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.193 src/sys/arch/sparc64/sparc64/trap.c:1.194
--- src/sys/arch/sparc64/sparc64/trap.c:1.193	Tue Feb  2 08:18:42 2021
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $ */
+/*	$NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -561,6 +561,11 @@ trap(struct trapframe64 *tf, unsigned in
 		} else if (type == T_ECCERR) {
 			ecc_corrected_error(type, pc);
 			return;
+		} else if (type == T_FAST_ECC_ERROR) {
+			/* Disable D$, clear error, enable D$, continue. */
+			membar_Sync();
+			sp_blast_dcache_disabled(dcache_size, dcache_line_size);
+			return;
 		}
 		goto dopanic;
 	}



CVS commit: src/sys/arch/sparc64/sparc64

2022-05-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon May 16 21:28:06 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c

Log Message:
try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable.  in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE).  this
code not commited.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/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/arch/sparc64/dev

2022-05-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon May 16 17:13:28 UTC 2022

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v/vdsk: add handling of SCSI_REPORT_LUNS


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

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

Modified files:

Index: src/sys/arch/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.9 src/sys/arch/sparc64/dev/vdsk.c:1.10
--- src/sys/arch/sparc64/dev/vdsk.c:1.9	Sat Dec  4 13:23:03 2021
+++ src/sys/arch/sparc64/dev/vdsk.c	Mon May 16 17:13:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.9 2021/12/04 13:23:03 andvar Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.10 2022/05/16 17:13:28 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -218,6 +218,7 @@ void	vdsk_scsi_inq(struct vdsk_softc *sc
 void	vdsk_scsi_inquiry(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *);
+void	vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_done(struct scsipi_xfer *, int);
 
 int
@@ -1048,6 +1049,10 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 			vdsk_scsi_capacity16(sc, xs);
 			return;
 
+		case SCSI_REPORT_LUNS:
+			vdsk_scsi_report_luns(sc, xs);
+			return;
+			
 		case SCSI_TEST_UNIT_READY:
 		case START_STOP:
 		case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
@@ -1333,6 +1338,12 @@ vdsk_scsi_capacity16(struct vdsk_softc *
 }
 
 void
+vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *xs)
+{
+	vdsk_scsi_done(xs, XS_NOERROR);
+}
+
+void
 vdsk_scsi_done(struct scsipi_xfer *xs, int error)
 {
 



CVS commit: src/sys/arch/sparc64/dev

2022-05-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon May 16 17:13:28 UTC 2022

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v/vdsk: add handling of SCSI_REPORT_LUNS


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/vdsk.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/arm/arm

2022-05-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 16 07:07:17 UTC 2022

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
port-arm/50635: arm11_setup() cpuctrlmask value causes CPU_CONTROL_VECRELOC bit 
to toggle

Fix slightly differently to as suggested in the PR.  Annotate arm10_setup
while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/arm/arm/cpufunc.c

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

Modified files:

Index: src/sys/arch/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.183 src/sys/arch/arm/arm/cpufunc.c:1.184
--- src/sys/arch/arm/arm/cpufunc.c:1.183	Sat Nov 27 08:51:01 2021
+++ src/sys/arch/arm/arm/cpufunc.c	Mon May 16 07:07:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.183 2021/11/27 08:51:01 skrll Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.184 2022/05/16 07:07:17 skrll Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.183 2021/11/27 08:51:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.184 2022/05/16 07:07:17 skrll Exp $");
 
 #include "opt_arm_start.h"
 #include "opt_compat_netbsd.h"
@@ -2713,7 +2713,7 @@ arm10_setup(char *args)
 	| CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE
 	| CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_ROM_ENABLE
 	| CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE
-	| CPU_CONTROL_BPRD_ENABLE
+	| CPU_CONTROL_BPRD_ENABLE | CPU_CONTROL_VECRELOC
 	| CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK;
 #endif
 
@@ -2776,7 +2776,8 @@ arm11_setup(char *args)
 	int cpuctrlmask = cpuctrl
 	| CPU_CONTROL_ROM_ENABLE | CPU_CONTROL_BPRD_ENABLE
 	| CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE
-	| CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK;
+	| CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK
+	| CPU_CONTROL_VECRELOC;
 
 #ifndef ARM32_DISABLE_ALIGNMENT_FAULTS
 	cpuctrl |= CPU_CONTROL_AFLT_ENABLE;



CVS commit: src/sys/arch/arm/arm

2022-05-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 16 07:07:17 UTC 2022

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
port-arm/50635: arm11_setup() cpuctrlmask value causes CPU_CONTROL_VECRELOC bit 
to toggle

Fix slightly differently to as suggested in the PR.  Annotate arm10_setup
while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/arm/arm/cpufunc.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/arm/sunxi

2022-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 15 16:58:28 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi: sun8i_crypto.c

Log Message:
sun8icrypto(4): Switch off polling when ready for interrupts.

When I introduced logic to do polling and then interrupts, I
accidentally made it switch polling from on to...still on, which had
the effect of breaking the logic after sun8i_crypto_attach because
only sun8i_crypto_attach actually did polling.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/sunxi/sun8i_crypto.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.30 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.31
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.30	Sat Mar 19 11:37:05 2022
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Sun May 15 16:58:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.30 2022/03/19 11:37:05 riastradh Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.31 2022/05/15 16:58:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.30 2022/03/19 11:37:05 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.31 2022/05/15 16:58:28 riastradh Exp $");
 
 #include 
 #include 
@@ -494,7 +494,7 @@ sun8i_crypto_attach(device_t parent, dev
 	 * be from us because we've kept ICR set to 0 to mask all
 	 * interrupts, but in case the interrupt vector is shared.
 	 */
-	atomic_store_relaxed(>sc_polling, true);
+	atomic_store_relaxed(>sc_polling, false);
 
 	/* Attach the sysctl.  */
 	sun8i_crypto_sysctl_attach(sc);



CVS commit: src/sys/arch/arm/sunxi

2022-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 15 16:58:28 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi: sun8i_crypto.c

Log Message:
sun8icrypto(4): Switch off polling when ready for interrupts.

When I introduced logic to do polling and then interrupts, I
accidentally made it switch polling from on to...still on, which had
the effect of breaking the logic after sun8i_crypto_attach because
only sun8i_crypto_attach actually did polling.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/sunxi/sun8i_crypto.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/x86/x86

2022-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 15 12:45:33 UTC 2022

Modified Files:
src/sys/arch/x86/x86: nmi.c

Log Message:
x86: Use atomic_store_release/atomic_load_consume for nmi_handlers.

Simplifies things a bit.  No functional change intended.


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

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

Modified files:

Index: src/sys/arch/x86/x86/nmi.c
diff -u src/sys/arch/x86/x86/nmi.c:1.5 src/sys/arch/x86/x86/nmi.c:1.6
--- src/sys/arch/x86/x86/nmi.c:1.5	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x86/x86/nmi.c	Sun May 15 12:45:33 2022
@@ -1,4 +1,4 @@
-/*	$Id: nmi.c,v 1.5 2017/06/01 02:45:08 chs Exp $	*/
+/*	$Id: nmi.c,v 1.6 2022/05/15 12:45:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c)2009,2011 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nmi.c,v 1.5 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nmi.c,v 1.6 2022/05/15 12:45:33 riastradh Exp $");
 
 /*
  * nmi dispatcher.
@@ -82,8 +82,7 @@ nmi_establish(int (*func)(const struct t
 
 	mutex_enter(_list_lock);
 	n->n_next = nmi_handlers;
-	membar_producer(); /* n->n_next should be visible before nmi_handlers */
-	nmi_handlers = n; /* atomic store */
+	atomic_store_release(_handlers, n);
 	mutex_exit(_list_lock);
 
 	return n;
@@ -121,7 +120,7 @@ nmi_disestablish(nmi_handler_t *handle)
 		panic("%s: invalid handle %p", __func__, handle);
 	}
 #endif /* defined(DIAGNOSTIC) */
-	*pp = n->n_next; /* atomic store */
+	atomic_store_relaxed(pp, n->n_next);
 	mutex_exit(_list_lock); /* mutex_exit implies a store fence */
 
 	/*
@@ -154,9 +153,9 @@ nmi_dispatch(const struct trapframe *tf)
 	 * we are in a dangerous context. (NMI)
 	 */
 
-	for (n = nmi_handlers; /* atomic load */
-	n != NULL;
-	membar_consumer(), n = n->n_next) { /* atomic load */
+	for (n = atomic_load_consume(_handlers);
+	 n != NULL;
+	 n = atomic_load_relaxed(>n_next)) {
 		handled |= (*n->n_func)(tf, n->n_arg);
 	}
 	return handled;



CVS commit: src/sys/arch/x86/x86

2022-05-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 15 12:45:33 UTC 2022

Modified Files:
src/sys/arch/x86/x86: nmi.c

Log Message:
x86: Use atomic_store_release/atomic_load_consume for nmi_handlers.

Simplifies things a bit.  No functional change intended.


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

2022-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 15 08:28:29 UTC 2022

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

Log Message:
Sprinkle some  consistency


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/hppa/conf/GENERIC

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

Modified files:

Index: src/sys/arch/hppa/conf/GENERIC
diff -u src/sys/arch/hppa/conf/GENERIC:1.38 src/sys/arch/hppa/conf/GENERIC:1.39
--- src/sys/arch/hppa/conf/GENERIC:1.38	Tue Jun 29 10:22:35 2021
+++ src/sys/arch/hppa/conf/GENERIC	Sun May 15 08:28:29 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.38 2021/06/29 10:22:35 nia Exp $
+# $NetBSD: GENERIC,v 1.39 2022/05/15 08:28:29 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	"arch/hppa/conf/std.hppa"
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		"GENERIC-$Revision: 1.38 $"
+#ident 		"GENERIC-$Revision: 1.39 $"
 
 maxusers	32		# estimated number of users
 
@@ -95,21 +95,21 @@ file-system 	FDESC		# /dev/fd
 file-system 	KERNFS		# /kern
 file-system 	NULLFS		# loopback file system
 file-system 	OVERLAY		# overlay file system
-file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+file-system 	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
 file-system 	PROCFS		# /proc
 file-system 	UMAPFS		# NULLFS + uid and gid remapping
 file-system 	UNION		# union file system
-file-system	CODA		# Coda File System; also needs vcoda (below)
-file-system	PTYFS		# /dev/pts/N support
-file-system	TMPFS		# Efficient memory file-system
-#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+file-system 	CODA		# Coda File System; also needs vcoda (below)
+file-system 	PTYFS		# /dev/pts/N support
+file-system 	TMPFS		# Efficient memory file-system
+#file-system 	UDF		# experimental - OSTA UDF CD/DVD file-system
 
 # File system options
 options 	QUOTA		# legacy UFS quotas
 options 	QUOTA2		# new, in-filesystem UFS quotas
 #options 	FFS_EI		# FFS Endian Independent support
 options 	WAPBL		# File system journaling support
-#options	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
+#options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
 options 	NFSSERVER	# Network File System server
 #options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
 options 	UFS_EXTATTR	# Extended attribute support for UFS1
@@ -335,7 +335,7 @@ osiop*	at gsc? flags 0x0		# NCR 53c7
 siop*	at gsc?# NCR 53c720 (Fast/Wide)
 siop*	at mainbus0			# NCR 53c720 (Fast/Wide)
 siop*	at phantomas?			# NCR 53c720 (Fast/Wide)
-siop*	at uturn? 			# NCR 53c720 (Fast/Wide)
+siop*	at uturn?			# NCR 53c720 (Fast/Wide)
 
 # PCI SCSI controllers
 adv*	at pci? dev ? function ?	# AdvanSys 1200[A,B], 9xx[U,UA] SCSI
@@ -400,7 +400,7 @@ icpsp*	at icp? unit ?			# SCSI pass-thro
 # how to set up DMA modes for this chip. This may work, or may cause
 # a machine hang with some controllers.
 pciide* 	at pci? dev ? function ? flags 0x	# GENERIC pciide driver
-acardide*	at pci? dev ? function ?	# Acard IDE controllers
+acardide* 	at pci? dev ? function ?	# Acard IDE controllers
 aceride* 	at pci? dev ? function ?	# Acer Lab IDE controllers
 artsata* 	at pci? dev ? function ?	# Intel i31244 SATA controller
 cmdide* 	at pci? dev ? function ?	# CMD tech IDE controllers
@@ -410,12 +410,12 @@ hptide* 	at pci? dev ? function ?	# Trio
 nside*  	at pci? dev ? function ?	# National Semiconductor IDE controllers
 optiide* 	at pci? dev ? function ?	# Opti IDE controllers
 pdcide* 	at pci? dev ? function ?	# Promise IDE controllers
-pdcsata*	at pci? dev ? function ?	# Promise SATA150 controllers
+pdcsata* 	at pci? dev ? function ?	# Promise SATA150 controllers
 rccide* 	at pci? dev ? function ?	# ServerWorks IDE controllers
-satalink*	at pci? dev ? function ?	# SiI SATALink controllers
+satalink* 	at pci? dev ? function ?	# SiI SATALink controllers
 siside* 	at pci? dev ? function ?	# SiS IDE controllers
 slide*  	at pci? dev ? function ?	# Symphony Labs IDE controllers
-stpcide*	at pci? dev ? function ?	# STMicro STPC IDE controllers
+stpcide* 	at pci? dev ? function ?	# STMicro STPC IDE controllers
 viaide* 	at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers
 
 # ATA (IDE) bus support
@@ -451,7 +451,7 @@ uk*	at atapibus? drive ? flags 0x	# 
 # Miscellaneous mass storage devices
 
 # GSC floppy
-#fdc*	at gsc? 			# PC floppy controller (WD37C65C)
+#fdc*	at gsc?# PC floppy controller (WD37C65C)
 #fd*	at fdc? drive ?			# the drives themselves
 
 # Network Interfaces
@@ -462,33 +462,33 @@ ie*	at gsc?# old 82C5[89]6 Ethernet,
 iee*	at gsc?# 82C596 Ethernet
 
 # PCI network interfaces
-an*	at pci? dev ? function ?	# Aironet PC4500/PC4800 (802.11)
-atw*	at pci? dev ? function ?	# ADMtek ADM8211 (802.11)
+an* 	at pci? dev ? function ?	# Aironet PC4500/PC4800 

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

2022-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 15 08:28:29 UTC 2022

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

Log Message:
Sprinkle some  consistency


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/hppa/conf/GENERIC

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



CVS commit: src/sys/arch/sparc/sparc

2022-05-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun May 15 02:14:15 UTC 2022

Modified Files:
src/sys/arch/sparc/sparc: locore.s

Log Message:
remove unused Lpanic_savefpstate.


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.282 src/sys/arch/sparc/sparc/locore.s:1.283
--- src/sys/arch/sparc/sparc/locore.s:1.282	Sat Apr 16 18:15:21 2022
+++ src/sys/arch/sparc/sparc/locore.s	Sun May 15 02:14:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.282 2022/04/16 18:15:21 andvar Exp $	*/
+/*	$NetBSD: locore.s,v 1.283 2022/05/15 02:14:15 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -5621,10 +5621,6 @@ Lkcerr:
  *
  * The IPI version just deals with updating event counters first.
  */
-Lpanic_savefpstate:
-	.asciz	"cpu%d: NULL fpstate"
-	_ALIGN
-
 ENTRY(ipi_savefpstate)
 	sethi	%hi(CPUINFO_VA+CPUINFO_SAVEFPSTATE), %o5
 	ldd	[%o5 + %lo(CPUINFO_VA+CPUINFO_SAVEFPSTATE)], %o2



CVS commit: src/sys/arch/sparc/sparc

2022-05-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun May 15 02:14:15 UTC 2022

Modified Files:
src/sys/arch/sparc/sparc: locore.s

Log Message:
remove unused Lpanic_savefpstate.


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/sys/arch/sparc/sparc/locore.s

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



CVS commit: src/sys/arch/hppa/gsc

2022-05-14 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun May 15 00:25:15 UTC 2022

Modified Files:
src/sys/arch/hppa/gsc: harmony.c

Log Message:
harmony.c: expand and correct a couple of comments


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/gsc/harmony.c

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

Modified files:

Index: src/sys/arch/hppa/gsc/harmony.c
diff -u src/sys/arch/hppa/gsc/harmony.c:1.10 src/sys/arch/hppa/gsc/harmony.c:1.11
--- src/sys/arch/hppa/gsc/harmony.c:1.10	Thu Feb  4 15:08:44 2021
+++ src/sys/arch/hppa/gsc/harmony.c	Sun May 15 00:25:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.10 2021/02/04 15:08:44 isaki Exp $	*/
+/*	$NetBSD: harmony.c,v 1.11 2022/05/15 00:25:15 gutteridge Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -136,7 +136,10 @@ const struct audio_hw_if harmony_sa_hw_i
 	.get_locks		= harmony_get_locks,
 };
 
-/* The HW actually supports more frequencies, but these looks enough. */
+/*
+ * The HW actually supports more frequencies, but these are the standard ones.
+ * For the full list, see the definition of harmony_speeds below.
+ */
 #define HARMONY_FORMAT(enc, prec) \
 	{ \
 		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
@@ -343,7 +346,7 @@ harmony_reset_codec(struct harmony_softc
 	/* start reset */
 	WRITE_REG(sc, HARMONY_RESET, RESET_RST);
 
-	DELAY(10);		/* wait at least 0.05 sec */
+	DELAY(10);		/* wait at least 0.1 sec */
 
 	harmony_set_gainctl(sc);
 	WRITE_REG(sc, HARMONY_RESET, 0);



CVS commit: src/sys/arch/hppa/gsc

2022-05-14 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun May 15 00:25:15 UTC 2022

Modified Files:
src/sys/arch/hppa/gsc: harmony.c

Log Message:
harmony.c: expand and correct a couple of comments


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/gsc/harmony.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

2022-05-14 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat May 14 07:11:23 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
PR 56829: Fix "map" call to Open Firmware and no longer mess up OFW stack.
This unbreaks miniroot.fs.

Thanks to Björn Johannesson for originally pointing this out and to
mrg@ for pointing out the actual issue and suggesting a fix.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc64/sparc64/ofw_machdep.c

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

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.16 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.17
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.16	Fri Sep 15 13:25:34 2017
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Sat May 14 07:11:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.16 2017/09/15 13:25:34 martin Exp $	*/
+/*	$NetBSD: Locore.c,v 1.17 2022/05/14 07:11:23 hgutch Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -664,8 +664,6 @@ OF_map_phys(paddr_t paddr, off_t size, v
 		cell_t vaddr;
 		cell_t paddr_hi;
 		cell_t paddr_lo;
-		cell_t status;
-		cell_t retaddr;
 	} args;
 
 #ifdef	__notyet
@@ -676,7 +674,7 @@ OF_map_phys(paddr_t paddr, off_t size, v
 #endif
 	args.name = ADR2CELL("call-method");
 	args.nargs = 7;
-	args.nreturns = 1;
+	args.nreturns = 0;
 	args.method = ADR2CELL("map");
 	args.ihandle = HDL2CELL(mmuh);
 	args.mode = mode;
@@ -687,9 +685,7 @@ OF_map_phys(paddr_t paddr, off_t size, v
 
 	if (openfirmware() == -1)
 		return -1;
-	if (args.status)
-		return -1;
-	return (vaddr_t)args.retaddr;
+	return 0;
 }
 
 

Index: src/sys/arch/sparc64/sparc64/ofw_machdep.c
diff -u src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.50 src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.51
--- src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.50	Thu Mar 17 08:08:03 2022
+++ src/sys/arch/sparc64/sparc64/ofw_machdep.c	Sat May 14 07:11:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.50 2022/03/17 08:08:03 andvar Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.51 2022/05/14 07:11:23 hgutch Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.50 2022/03/17 08:08:03 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.51 2022/05/14 07:11:23 hgutch Exp $");
 
 #include 
 #include 
@@ -339,8 +339,6 @@ prom_map_phys(paddr_t paddr, off_t size,
 		cell_t vaddr;
 		cell_t phys_hi;
 		cell_t phys_lo;
-		cell_t status;
-		cell_t retaddr;
 	} args;
 
 	if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) {
@@ -349,7 +347,7 @@ prom_map_phys(paddr_t paddr, off_t size,
 	}
 	args.name = ADR2CELL(&"call-method");
 	args.nargs = 7;
-	args.nreturns = 1;
+	args.nreturns = 0;
 	args.method = ADR2CELL(&"map");
 	args.ihandle = HDL2CELL(mmuh);
 	args.mode = mode;
@@ -360,9 +358,7 @@ prom_map_phys(paddr_t paddr, off_t size,
 
 	if (openfirmware() == -1)
 		return -1;
-	if (args.status)
-		return -1;
-	return (int)args.retaddr;
+	return 0;
 }
 
 



CVS commit: src/sys/arch

2022-05-14 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sat May 14 07:11:23 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
PR 56829: Fix "map" call to Open Firmware and no longer mess up OFW stack.
This unbreaks miniroot.fs.

Thanks to Björn Johannesson for originally pointing this out and to
mrg@ for pointing out the actual issue and suggesting a fix.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc64/sparc64/ofw_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/hppa/hppa

2022-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 06:07:53 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: idle_machdep.c machdep.c

Log Message:
Add some special NOPs to help qemu.

thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/hppa/machdep.c

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

Modified files:

Index: src/sys/arch/hppa/hppa/idle_machdep.c
diff -u src/sys/arch/hppa/hppa/idle_machdep.c:1.3 src/sys/arch/hppa/hppa/idle_machdep.c:1.4
--- src/sys/arch/hppa/hppa/idle_machdep.c:1.3	Mon Apr 15 20:45:08 2019
+++ src/sys/arch/hppa/hppa/idle_machdep.c	Sat May 14 06:07:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $	*/
+/*	$NetBSD: idle_machdep.c,v 1.4 2022/05/14 06:07:53 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.3 2019/04/15 20:45:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: idle_machdep.c,v 1.4 2022/05/14 06:07:53 skrll Exp $");
 
 #include 
 #include 
@@ -36,5 +36,8 @@ __KERNEL_RCSID(0, "$NetBSD: idle_machdep
 void
 cpu_idle(void)
 {
-	/* do nothing */
+/*
+	 * This NOP instruction is used by qemu to detect the idle loop.
+	 */
+	__asm volatile("or	%%r10,%%r10,%%r10" ::: "memory");
 }

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.16 src/sys/arch/hppa/hppa/machdep.c:1.17
--- src/sys/arch/hppa/hppa/machdep.c:1.16	Mon Sep 14 16:11:32 2020
+++ src/sys/arch/hppa/hppa/machdep.c	Sat May 14 06:07:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.16 2020/09/14 16:11:32 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.17 2022/05/14 06:07:53 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2020/09/14 16:11:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2022/05/14 06:07:53 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1447,8 +1447,13 @@ cpu_reboot(int howto, char *user_boot_st
 		:: "r" (CMD_RESET), "r" (HPPA_LBCAST + iomod_command));
 	}
 
-	for (;;)
-		/* loop while bus reset is coming up */ ;
+	for (;;) {
+		/*
+		 * loop while bus reset is coming up.  This NOP instruction
+		 * is used by qemu to detect the 'death loop'.
+		 */
+		__asm volatile("or %%r31, %%r31, %%r31" ::: "memory");
+	}
 	/* NOTREACHED */
 }
 



CVS commit: src/sys/arch/hppa/hppa

2022-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 14 06:07:53 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: idle_machdep.c machdep.c

Log Message:
Add some special NOPs to help qemu.

thanks to Helge Deller for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/hppa/idle_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/hppa/machdep.c

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



CVS commit: src/sys/arch/hppa/hppa

2022-05-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 13 18:40:03 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: hppa_machdep.c

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

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


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

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

Modified files:

Index: src/sys/arch/hppa/hppa/hppa_machdep.c
diff -u src/sys/arch/hppa/hppa/hppa_machdep.c:1.32 src/sys/arch/hppa/hppa/hppa_machdep.c:1.33
--- src/sys/arch/hppa/hppa/hppa_machdep.c:1.32	Sun Aug 22 20:18:39 2021
+++ src/sys/arch/hppa/hppa/hppa_machdep.c	Fri May 13 18:40:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_machdep.c,v 1.32 2021/08/22 20:18:39 andvar Exp $	*/
+/*	$NetBSD: hppa_machdep.c,v 1.33 2022/05/13 18:40:02 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.32 2021/08/22 20:18:39 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.33 2022/05/13 18:40:02 skrll Exp $");
 
 #include 
 #include 
@@ -279,7 +279,9 @@ hppa_ras(struct lwp *l)
 
 	p = l->l_proc;
 	tf = l->l_md.md_regs;
-	rasaddr = (intptr_t)ras_lookup(p, (void *)tf->tf_iioq_head);
+
+	rasaddr = (intptr_t)ras_lookup(p,
+	(void *)(tf->tf_iioq_head & ~HPPA_PC_PRIV_MASK));
 	if (rasaddr != -1) {
 		rasaddr |= HPPA_PC_PRIV_USER;
 		tf->tf_iioq_head = rasaddr;



CVS commit: src/sys/arch/hppa/hppa

2022-05-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 13 18:40:03 UTC 2022

Modified Files:
src/sys/arch/hppa/hppa: hppa_machdep.c

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

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


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

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



CVS commit: src/sys/arch

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:45:24 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
Add MFI_DEBUG and MFII_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.500 -r1.501 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.170 src/sys/arch/amd64/conf/ALL:1.171
--- src/sys/arch/amd64/conf/ALL:1.170	Sat May  7 04:32:29 2022
+++ src/sys/arch/amd64/conf/ALL	Fri May 13 10:45:24 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.170 2022/05/07 04:32:29 rin Exp $
+# $NetBSD: ALL,v 1.171 2022/05/13 10:45:24 msaitoh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.170 $"
+#ident		"ALL-$Revision: 1.171 $"
 
 maxusers	64		# estimated number of users
 
@@ -2026,6 +2026,8 @@ options MEC_DEBUG
 options MEDIABAY_DEBUG
 options MEMORY_MAP_DEBUG
 options MESH_DEBUG
+options MFI_DEBUG
+options MFII_DEBUG
 options MIDI_DEBUG
 options MLYDEBUG
 options MMEYEPCMCIADEBUG

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.500 src/sys/arch/i386/conf/ALL:1.501
--- src/sys/arch/i386/conf/ALL:1.500	Thu Dec 23 17:13:13 2021
+++ src/sys/arch/i386/conf/ALL	Fri May 13 10:45:24 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.500 2021/12/23 17:13:13 hannken Exp $
+# $NetBSD: ALL,v 1.501 2022/05/13 10:45:24 msaitoh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.500 $"
+#ident		"ALL-$Revision: 1.501 $"
 
 maxusers	64		# estimated number of users
 
@@ -2133,6 +2133,8 @@ options MEC_DEBUG
 options MEDIABAY_DEBUG
 options MEMORY_MAP_DEBUG
 options MESH_DEBUG
+options MFI_DEBUG
+options MFII_DEBUG
 options MIDI_DEBUG
 options MLYDEBUG
 options MMEYEPCMCIADEBUG



CVS commit: src/sys/arch

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:45:24 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
Add MFI_DEBUG and MFII_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.500 -r1.501 src/sys/arch/i386/conf/ALL

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



CVS commit: src/sys/arch/arm/rockchip

2022-05-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 13 09:49:44 UTC 2022

Modified Files:
src/sys/arch/arm/rockchip: rk_v1crypto.c

Log Message:
rkv1crypto(4): Fix units in RNG repeated-output health test.

This code was intended to check whether the two 4-word halves of an
8-word, 32-byte, 256-bit sample were repeated.

Instead, it accidentally checked whether the first 4 _bytes_ of the
two halves were repeated.

The effect was a false alarm rate of 1/2^32, instead of a false alarm
rate of 1/2^128, with no change on the true alarm rate in the event
of an RNG wedged producing all-zero or all-one bits.  1/2^128 is an
acceptable false alarm rate; 1/2^32, not so much.

(The false alarm right might be higher if the samples are not
perfectly uniformly distributed, which they most likey aren't,
although the documentation doesn't give any details other than
suggesting it's a ring oscillator under the hood, which provides
entropy from jitter induced by thermal noise.  This driver records
half a bit of entropy per bit of sample to be reasonably
conservative.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk_v1crypto.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_v1crypto.c
diff -u src/sys/arch/arm/rockchip/rk_v1crypto.c:1.9 src/sys/arch/arm/rockchip/rk_v1crypto.c:1.10
--- src/sys/arch/arm/rockchip/rk_v1crypto.c:1.9	Fri Apr  8 23:14:21 2022
+++ src/sys/arch/arm/rockchip/rk_v1crypto.c	Fri May 13 09:49:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk_v1crypto.c,v 1.9 2022/04/08 23:14:21 riastradh Exp $	*/
+/*	$NetBSD: rk_v1crypto.c,v 1.10 2022/05/13 09:49:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.9 2022/04/08 23:14:21 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.10 2022/05/13 09:49:44 riastradh Exp $");
 
 #include 
 
@@ -268,7 +268,7 @@ rk_v1crypto_rng_get(size_t nbytes, void 
 			device_printf(self, "timed out\n");
 			break;
 		}
-		if (consttime_memequal(buf, buf + n/2, n/2)) {
+		if (consttime_memequal(buf, buf + n/2, sizeof(buf[0]) * n/2)) {
 			device_printf(self, "failed repeated output test\n");
 			break;
 		}



CVS commit: src/sys/arch/arm/rockchip

2022-05-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 13 09:49:44 UTC 2022

Modified Files:
src/sys/arch/arm/rockchip: rk_v1crypto.c

Log Message:
rkv1crypto(4): Fix units in RNG repeated-output health test.

This code was intended to check whether the two 4-word halves of an
8-word, 32-byte, 256-bit sample were repeated.

Instead, it accidentally checked whether the first 4 _bytes_ of the
two halves were repeated.

The effect was a false alarm rate of 1/2^32, instead of a false alarm
rate of 1/2^128, with no change on the true alarm rate in the event
of an RNG wedged producing all-zero or all-one bits.  1/2^128 is an
acceptable false alarm rate; 1/2^32, not so much.

(The false alarm right might be higher if the samples are not
perfectly uniformly distributed, which they most likey aren't,
although the documentation doesn't give any details other than
suggesting it's a ring oscillator under the hood, which provides
entropy from jitter induced by thermal noise.  This driver records
half a bit of entropy per bit of sample to be reasonably
conservative.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk_v1crypto.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/x86/x86

2022-05-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 13 09:39:40 UTC 2022

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
x86/pmap: Feed entropy_extract output through nist_hash_drbg.

The entropy pool algorithm is NOT designed to provide backtracking
resistance on its own -- it MUST be combined with a PRNG/DRBG that
provides that.

The only reason we use entropy_extract here is that cprng(9) is not
available yet (which in turn is because kmem and other basic kernel
facilities aren't available yet), but nist_hash_drbg doesn't have any
initialization order requirements, so we'll just use it directly.


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

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.414 src/sys/arch/x86/x86/pmap.c:1.415
--- src/sys/arch/x86/x86/pmap.c:1.414	Sat May  7 14:59:25 2022
+++ src/sys/arch/x86/x86/pmap.c	Fri May 13 09:39:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.414 2022/05/07 14:59:25 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.415 2022/05/13 09:39:40 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.414 2022/05/07 14:59:25 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.415 2022/05/13 09:39:40 riastradh Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -178,6 +178,10 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.4
 #include 
 #endif
 
+#ifdef __HAVE_DIRECT_MAP
+#include 
+#endif
+
 /*
  * general info:
  *
@@ -1602,6 +1606,33 @@ pmap_init_pcpu(void)
 #endif
 
 #ifdef __HAVE_DIRECT_MAP
+static void
+randomize_hole(size_t *randholep, vaddr_t *randvap)
+{
+	struct nist_hash_drbg drbg;
+	uint8_t seed[NIST_HASH_DRBG_SEEDLEN_BYTES];
+	const char p[] = "x86/directmap";
+	int error;
+
+	entropy_extract(seed, sizeof(seed), 0);
+
+	error = nist_hash_drbg_instantiate(, seed, sizeof(seed),
+	/*nonce*/NULL, 0,
+	/*personalization*/p, strlen(p));
+	KASSERTMSG(error == 0, "error=%d", error);
+
+	error = nist_hash_drbg_generate(, randholep, sizeof(*randholep),
+	/*additional*/NULL, 0);
+	KASSERTMSG(error == 0, "error=%d", error);
+
+	error = nist_hash_drbg_generate(, randvap, sizeof(*randvap),
+	/*additional*/NULL, 0);
+	KASSERTMSG(error == 0, "error=%d", error);
+
+	explicit_memset(seed, 0, sizeof(seed));
+	explicit_memset(, 0, sizeof(drbg));
+}
+
 /*
  * Create the amd64 direct map. Called only once at boot time. We map all of
  * the physical memory contiguously using 2MB large pages, with RW permissions.
@@ -1648,8 +1679,7 @@ pmap_init_directmap(struct pmap *kpm)
 		panic("pmap_init_directmap: lastpa incorrect");
 	}
 
-	entropy_extract(, sizeof randhole, 0);
-	entropy_extract(, sizeof randva, 0);
+	randomize_hole(, );
 	startva = slotspace_rand(SLAREA_DMAP, lastpa, NBPD_L2,
 	randhole, randva);
 	endva = startva + lastpa;



CVS commit: src/sys/arch/x86/x86

2022-05-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 13 09:39:40 UTC 2022

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
x86/pmap: Feed entropy_extract output through nist_hash_drbg.

The entropy pool algorithm is NOT designed to provide backtracking
resistance on its own -- it MUST be combined with a PRNG/DRBG that
provides that.

The only reason we use entropy_extract here is that cprng(9) is not
available yet (which in turn is because kmem and other basic kernel
facilities aren't available yet), but nist_hash_drbg doesn't have any
initialization order requirements, so we'll just use it directly.


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

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



CVS commit: src/sys/arch/xen/x86

2022-05-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed May 11 16:22:46 UTC 2022

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/x86/x86_xpmap.c

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

Modified files:

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.90 src/sys/arch/xen/x86/x86_xpmap.c:1.91
--- src/sys/arch/xen/x86/x86_xpmap.c:1.90	Sun Sep  6 02:18:53 2020
+++ src/sys/arch/xen/x86/x86_xpmap.c	Wed May 11 16:22:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.90 2020/09/06 02:18:53 riastradh Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.91 2022/05/11 16:22:46 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.90 2020/09/06 02:18:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.91 2022/05/11 16:22:46 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -911,7 +911,7 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 	/* Unpin old PGD */
 	xpq_queue_unpin_table(xpmap_ptom_masked(old_pgd - KERNBASE));
 
-	/* Mark old tables RW */
+	/* Mark old tables RW if used, unmap otherwise */
 	page = old_pgd;
 	addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PTE_4KFRAME);
 	pte = (pd_entry_t *)((u_long)addr + KERNBASE);
@@ -925,6 +925,12 @@ xen_bootstrap_tables(vaddr_t old_pgd, va
 		 */
 		pte++;
 	}
+	while (page < old_pgd + (old_count * PAGE_SIZE)) {
+		addr = xpmap_ptom(((u_long)pte) - KERNBASE);
+		xpq_queue_pte_update(addr, 0);
+		page += PAGE_SIZE;
+		pte++;
+	}
 	xpq_flush_queue();
 }
 



CVS commit: src/sys/arch/xen/x86

2022-05-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed May 11 16:22:46 UTC 2022

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/x86/x86_xpmap.c

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



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

2022-05-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 11 13:58:43 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: vmparam.h

Log Message:
s/varible/variable/


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/include/vmparam.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/powerpc/include

2022-05-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed May 11 13:58:43 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: vmparam.h

Log Message:
s/varible/variable/


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/include/vmparam.h

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

Modified files:

Index: src/sys/arch/powerpc/include/vmparam.h
diff -u src/sys/arch/powerpc/include/vmparam.h:1.25 src/sys/arch/powerpc/include/vmparam.h:1.26
--- src/sys/arch/powerpc/include/vmparam.h:1.25	Wed Jan  6 08:17:46 2021
+++ src/sys/arch/powerpc/include/vmparam.h	Wed May 11 13:58:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.25 2021/01/06 08:17:46 rin Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.26 2022/05/11 13:58:43 andvar Exp $	*/
 
 #ifndef _POWERPC_VMPARAM_H_
 #define _POWERPC_VMPARAM_H_
@@ -30,7 +30,7 @@
 #if defined(MODULAR) || defined(_MODULE) || !defined(_KERNEL)
 /*
  * If we are a module or a modular kernel, then we need to defined the range
- * of our varible page sizes since BOOKE and OEA use 4KB pages while IBM4XX
+ * of our variable page sizes since BOOKE and OEA use 4KB pages while IBM4XX
  * use 16KB pages.
  * This is also required for userland by jemalloc.
  */



CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:31:12 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Make FD support optional (intended for install media).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/stand/installboot/installboot.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/stand/installboot/installboot.c
diff -u src/sys/arch/atari/stand/installboot/installboot.c:1.37 src/sys/arch/atari/stand/installboot/installboot.c:1.38
--- src/sys/arch/atari/stand/installboot/installboot.c:1.37	Wed May 11 10:27:45 2022
+++ src/sys/arch/atari/stand/installboot/installboot.c	Wed May 11 10:31:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.37 2022/05/11 10:27:45 rin Exp $	*/
+/*	$NetBSD: installboot.c,v 1.38 2022/05/11 10:31:12 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -65,7 +65,9 @@ static void	mkahdiboot(struct ahdi_root 
 		char *, u_int32_t);
 static void	mkbootblock(struct bootblock *, char *,
 char *, struct disklabel *, u_int);
+#ifdef SUPPORT_FD
 static void	install_fd(char *, struct disklabel *);
+#endif
 static void	install_hd(char *, struct disklabel *, bool);
 
 static struct bootblock	bootarea;
@@ -165,9 +167,11 @@ main(int argc, char *argv[])
 		++devchr;
 
 	switch (*devchr) {
+#ifdef SUPPORT_FD
 		case 'f': /* fd */
 			install_fd(dn, );
 			break;
+#endif
 		case 'w': /* wd */
 			use_wd = true;
 			/* FALLTHROUGH */
@@ -218,6 +222,7 @@ oscheck(void)
 }
 #endif
 
+#ifdef SUPPORT_FD
 static void
 install_fd(char *devnm, struct disklabel *label)
 {
@@ -272,6 +277,7 @@ install_fd(char *devnm, struct disklabel
 			printf("Boot block installed on %s\n", devnm);
 	}
 }
+#endif /* SUPPORT_FD */
 
 static void
 install_hd(char *devnm, struct disklabel *label, bool use_wd)



CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:31:12 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Make FD support optional (intended for install media).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/stand/installboot/installboot.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/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:27:45 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Refactor install_[sw]d() into install_hd().

Shave off ~0.5KB from install floppy, and dedup codes a lot.

Thanks tsutsui@ for kind review!


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/atari/stand/installboot/installboot.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/stand/installboot/installboot.c
diff -u src/sys/arch/atari/stand/installboot/installboot.c:1.36 src/sys/arch/atari/stand/installboot/installboot.c:1.37
--- src/sys/arch/atari/stand/installboot/installboot.c:1.36	Wed Jan 11 18:32:48 2017
+++ src/sys/arch/atari/stand/installboot/installboot.c	Wed May 11 10:27:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.36 2017/01/11 18:32:48 christos Exp $	*/
+/*	$NetBSD: installboot.c,v 1.37 2022/05/11 10:27:45 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -66,8 +66,7 @@ static void	mkahdiboot(struct ahdi_root 
 static void	mkbootblock(struct bootblock *, char *,
 char *, struct disklabel *, u_int);
 static void	install_fd(char *, struct disklabel *);
-static void	install_sd(char *, struct disklabel *);
-static void	install_wd(char *, struct disklabel *);
+static void	install_hd(char *, struct disklabel *, bool);
 
 static struct bootblock	bootarea;
 static struct ahdi_root ahdiboot;
@@ -104,6 +103,7 @@ main(int argc, char *argv[])
 	char		 *dn;
 	char		 *devchr;
 	int		 fd, c;
+	bool		 use_wd = false;
 
 #ifdef CHECK_OS_BOOTVERSION
 	/* check OS bootversion */
@@ -169,11 +169,10 @@ main(int argc, char *argv[])
 			install_fd(dn, );
 			break;
 		case 'w': /* wd */
-			install_wd(dn, );
-			setNVpref();
-			break;
+			use_wd = true;
+			/* FALLTHROUGH */
 		case 's': /* sd */
-			install_sd(dn, );
+			install_hd(dn, , use_wd);
 			setNVpref();
 			break;
 		default:
@@ -275,13 +274,19 @@ install_fd(char *devnm, struct disklabel
 }
 
 static void
-install_sd(char *devnm, struct disklabel *label)
+install_hd(char *devnm, struct disklabel *label, bool use_wd)
 {
 	const char	 *machpath;
 	char		 *xxb00t, *xxboot, *bootxx;
 	struct disklabel rawlabel;
 	u_int32_t	 bbsec;
 	u_int		 magic;
+	char		 disktype;
+
+	if (use_wd)
+		disktype = 'w';
+	else
+		disktype = 's';
 
 	if (label->d_partitions[0].p_size == 0)
 		errx(EXIT_FAILURE, "%s: No root-filesystem.", devnm);
@@ -302,7 +307,7 @@ install_sd(char *devnm, struct disklabel
 	if (bbsec) {
 		size_t xxb00tlen = strlen(mdecpath) + strlen(machpath) + 14;
 		xxb00t = alloca(xxb00tlen);
-		snprintf(xxb00t, xxb00tlen, "%s%ssdb00t.ahdi", mdecpath, machpath);
+		snprintf(xxb00t, xxb00tlen, "%s%s%cdb00t.ahdi", mdecpath, machpath, disktype);
 		xxboot = alloca(xxb00tlen);
 		snprintf(xxboot, xxb00tlen, "%s%sxxboot.ahdi", mdecpath, machpath);
 		magic = AHDIMAGIC;
@@ -310,14 +315,15 @@ install_sd(char *devnm, struct disklabel
 		size_t xxbootlen = strlen(mdecpath) + strlen(machpath) + 8;
 		xxb00t = NULL;
 		xxboot = alloca(xxbootlen);
-		snprintf(xxboot, xxbootlen, "%s%ssdboot", mdecpath, machpath);
+		snprintf(xxboot, xxbootlen, "%s%s%cdboot", mdecpath, machpath, disktype);
 		magic = NBDAMAGIC;
 	}
 	size_t bootxxlen = strlen(mdecpath) + strlen(machpath) + 8;
 	bootxx = alloca(bootxxlen);
 	snprintf(bootxx, bootxxlen, "%s%sbootxx", mdecpath, machpath);
 
-	trackpercyl = secpertrack = 0;
+	if (!use_wd)
+		trackpercyl = secpertrack = 0;
 	if (xxb00t)
 		mkahdiboot(, xxb00t, devnm, bbsec);
 	mkbootblock(, xxboot, bootxx, label, magic);
@@ -351,82 +357,6 @@ install_sd(char *devnm, struct disklabel
 }
 
 static void
-install_wd(char *devnm, struct disklabel *label)
-{
-	const char	 *machpath;
-	char		 *xxb00t, *xxboot, *bootxx;
-	struct disklabel rawlabel;
-	u_int32_t	 bbsec;
-	u_int		 magic;
-
-	if (label->d_partitions[0].p_size == 0)
-		errx(EXIT_FAILURE, "%s: No root-filesystem.", devnm);
-	if (label->d_partitions[0].p_fstype != FS_BSDFFS)
-		errx(EXIT_FAILURE, "%s: %s: Illegal root-filesystem type.",
-		 devnm, fstypenames[label->d_partitions[0].p_fstype]);
-
-	bbsec = readdisklabel(devnm, );
-	if (bbsec == NO_BOOT_BLOCK)
-		errx(EXIT_FAILURE, "%s: No NetBSD boot block.", devnm);
-	if (memcmp(label, , sizeof(*label)))
-		errx(EXIT_FAILURE, "%s: Invalid NetBSD boot block.", devnm);
-
-	if (milan)
-		machpath = milanpath;
-	else
-		machpath = stdpath;
-	if (bbsec) {
-		size_t xxb00tlen = strlen(mdecpath) + strlen(machpath) + 14;
-		xxb00t = alloca(xxb00tlen);
-		snprintf(xxb00t, xxb00tlen, "%s%swdb00t.ahdi", mdecpath, machpath);
-		xxboot = alloca(xxb00tlen);
-		snprintf(xxboot, xxb00tlen, "%s%sxxboot.ahdi", mdecpath, machpath);
-		magic = AHDIMAGIC;
-	} else {
-		size_t xxbootlen = strlen(mdecpath) + strlen(machpath) + 8;
-		xxb00t = NULL;
-		xxboot = alloca(xxbootlen);
-		snprintf(xxboot, xxbootlen, "%s%swdboot", mdecpath, 

CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:27:45 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Refactor install_[sw]d() into install_hd().

Shave off ~0.5KB from install floppy, and dedup codes a lot.

Thanks tsutsui@ for kind review!


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/atari/stand/installboot/installboot.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/arm/apple

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:10:28 UTC 2022

Modified Files:
src/sys/arch/arm/apple: apple_pmgr.c

Log Message:
Add aprints


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/apple/apple_pmgr.c

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

Modified files:

Index: src/sys/arch/arm/apple/apple_pmgr.c
diff -u src/sys/arch/arm/apple/apple_pmgr.c:1.1 src/sys/arch/arm/apple/apple_pmgr.c:1.2
--- src/sys/arch/arm/apple/apple_pmgr.c:1.1	Wed Apr 27 07:55:42 2022
+++ src/sys/arch/arm/apple/apple_pmgr.c	Tue May 10 08:10:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: apple_pmgr.c,v 1.1 2022/04/27 07:55:42 skrll Exp $ */
+/* $NetBSD: apple_pmgr.c,v 1.2 2022/05/10 08:10:28 skrll Exp $ */
 
 /*-
  * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apple_pmgr.c,v 1.1 2022/04/27 07:55:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_pmgr.c,v 1.2 2022/05/10 08:10:28 skrll Exp $");
 
 #include 
 
@@ -132,6 +132,9 @@ apple_pmgr_attach(device_t parent, devic
 		return;
 	}
 
+	aprint_naive("\n");
+	aprint_normal(": Apple PMGR\n");
+
 	for (int node = OF_child(phandle); node; node = OF_peer(node)) {
 		static const struct device_compatible_entry compat_ps[] = {
 			{ .compat = "apple,pmgr-pwrstate" },



CVS commit: src/sys/arch/arm/apple

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:10:28 UTC 2022

Modified Files:
src/sys/arch/arm/apple: apple_pmgr.c

Log Message:
Add aprints


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/apple/apple_pmgr.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

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:09:58 UTC 2022

Modified Files:
src/sys/arch/arm/apple: files.apple
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/apple: apple_smc.c

Log Message:
Add a driver for the Apple RTKit based System Management Controller
found on M1 SoCs.  From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/apple/apple_smc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/apple/files.apple
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/arm/apple/files.apple
diff -u src/sys/arch/arm/apple/files.apple:1.7 src/sys/arch/arm/apple/files.apple:1.8
--- src/sys/arch/arm/apple/files.apple:1.7	Tue May 10 08:05:32 2022
+++ src/sys/arch/arm/apple/files.apple	Tue May 10 08:09:57 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.apple,v 1.7 2022/05/10 08:05:32 skrll Exp $
+#	$NetBSD: files.apple,v 1.8 2022/05/10 08:09:57 skrll Exp $
 #
 # Configuration info for Apple Silicon SoCs
 #
@@ -45,6 +45,10 @@ device	applepmgr
 attach	applepmgr at fdt with apple_pmgr
 file	arch/arm/apple/apple_pmgr.c		apple_pmgr
 
+# SMC
+attach	applesmc at fdt with apple_rtkitsmc
+file	arch/arm/apple/apple_smc.c		apple_rtkitsmc
+
 # Watchdog timer
 device	applewdog: sysmon_wdog
 attach	applewdog at fdt with apple_wdog

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.200 src/sys/arch/evbarm/conf/GENERIC64:1.201
--- src/sys/arch/evbarm/conf/GENERIC64:1.200	Tue May 10 08:05:32 2022
+++ src/sys/arch/evbarm/conf/GENERIC64	Tue May 10 08:09:57 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.200 2022/05/10 08:05:32 skrll Exp $
+#	$NetBSD: GENERIC64,v 1.201 2022/05/10 08:09:57 skrll Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -182,6 +182,7 @@ appledart*	at fdt? pass 3		# Apple DART
 tegramc*	at fdt?	pass 4		# NVIDIA Tegra MC
 
 # Firmware devices
+applesmc*	at fdt? pass 3		# Apple RTKIT based SMC
 bcmmbox*	at fdt?			# Broadcom VideoCore IV mailbox
 bcmmbox*	at acpi?
 vcmbox* 	at bcmmbox?

Added files:

Index: src/sys/arch/arm/apple/apple_smc.c
diff -u /dev/null src/sys/arch/arm/apple/apple_smc.c:1.1
--- /dev/null	Tue May 10 08:09:58 2022
+++ src/sys/arch/arm/apple/apple_smc.c	Tue May 10 08:09:57 2022
@@ -0,0 +1,380 @@
+/*	$NetBSD: apple_smc.c,v 1.1 2022/05/10 08:09:57 skrll Exp $	*/
+/*	$OpenBSD: apple_smc.c,v 1.11 2022/03/25 15:52:03 kettenis Exp $	*/
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2021 Mark Kettenis 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+extern void (*cpuresetfn)(void);
+extern 

CVS commit: src/sys/arch

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:09:58 UTC 2022

Modified Files:
src/sys/arch/arm/apple: files.apple
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/apple: apple_smc.c

Log Message:
Add a driver for the Apple RTKit based System Management Controller
found on M1 SoCs.  From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/apple/apple_smc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/apple/files.apple
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/evbarm/conf/GENERIC64

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



CVS commit: src/sys/arch

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:05:33 UTC 2022

Modified Files:
src/sys/arch/arm/apple: files.apple
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/apple: apple_iic.c

Log Message:
Add a driver for the Apple M1 I2C controller.  From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/apple/apple_iic.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/apple/files.apple
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/evbarm/conf/GENERIC64

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



CVS commit: src/sys/arch

2022-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 08:05:33 UTC 2022

Modified Files:
src/sys/arch/arm/apple: files.apple
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/apple: apple_iic.c

Log Message:
Add a driver for the Apple M1 I2C controller.  From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/apple/apple_iic.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/apple/files.apple
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/arm/apple/files.apple
diff -u src/sys/arch/arm/apple/files.apple:1.6 src/sys/arch/arm/apple/files.apple:1.7
--- src/sys/arch/arm/apple/files.apple:1.6	Sat May  7 08:20:04 2022
+++ src/sys/arch/arm/apple/files.apple	Tue May 10 08:05:32 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.apple,v 1.6 2022/05/07 08:20:04 skrll Exp $
+#	$NetBSD: files.apple,v 1.7 2022/05/10 08:05:32 skrll Exp $
 #
 # Configuration info for Apple Silicon SoCs
 #
@@ -9,6 +9,11 @@ device	appledart
 attach	appledart at fdt with apple_dart
 file	arch/arm/apple/apple_dart.c		apple_dart
 
+# I2C controller
+device	appleiic: i2cbus
+attach	appleiic at fdt with apple_iic
+file	arch/arm/apple/apple_iic.c		apple_iic
+
 # Interrupt controller
 device	appleintc: pic, pic_splfuncs
 attach	appleintc at fdt with apple_intc

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.199 src/sys/arch/evbarm/conf/GENERIC64:1.200
--- src/sys/arch/evbarm/conf/GENERIC64:1.199	Sat May  7 08:20:04 2022
+++ src/sys/arch/evbarm/conf/GENERIC64	Tue May 10 08:05:32 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.199 2022/05/07 08:20:04 skrll Exp $
+#	$NetBSD: GENERIC64,v 1.200 2022/05/10 08:05:32 skrll Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -333,6 +333,7 @@ com*		at puc? port ?
 
 # I2C controllers
 options 	I2C_MAX_ADDR=0xfff
+appleiic*	at fdt?			# Apple I2C
 bsciic* 	at fdt?			# Broadcom BCM283x Serial Control
 bsciic* 	at acpi?
 dwiic*		at fdt?			# Designware I2C

Added files:

Index: src/sys/arch/arm/apple/apple_iic.c
diff -u /dev/null src/sys/arch/arm/apple/apple_iic.c:1.1
--- /dev/null	Tue May 10 08:05:33 2022
+++ src/sys/arch/arm/apple/apple_iic.c	Tue May 10 08:05:32 2022
@@ -0,0 +1,253 @@
+/*	$NetBSD: apple_iic.c,v 1.1 2022/05/10 08:05:32 skrll Exp $	*/
+/*	$OpenBSD: apliic.c,v 1.3 2022/02/14 14:55:53 kettenis Exp $	*/
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2021 Patrick Wildt 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+/* Registers. */
+#define I2C_MTXFIFO		0x00
+#define  I2C_MTXFIFO_DATA_MASK		__BITS(7,0)
+#define  

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

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

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

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.113 src/sys/arch/powerpc/oea/pmap.c:1.114
--- src/sys/arch/powerpc/oea/pmap.c:1.113	Sat Apr  9 23:38:32 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Mon May  9 11:39:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -674,7 +674,7 @@ static inline void
 pmap_pp_attr_clear(struct pmap_page *pp, int ptebit)
 {
 
-	pp->pp_attrs &= ptebit;
+	pp->pp_attrs &= ~ptebit;
 }
 
 static inline void



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

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

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

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/pmap.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/x86/x86

2022-05-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat May  7 14:59:25 UTC 2022

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.
This should only affect performances.


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

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



CVS commit: src/sys/arch/x86/x86

2022-05-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat May  7 14:59:25 UTC 2022

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.
This should only affect performances.


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

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.413 src/sys/arch/x86/x86/pmap.c:1.414
--- src/sys/arch/x86/x86/pmap.c:1.413	Sun Jan  2 20:28:53 2022
+++ src/sys/arch/x86/x86/pmap.c	Sat May  7 14:59:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.413 2022/01/02 20:28:53 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.414 2022/05/07 14:59:25 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.413 2022/01/02 20:28:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.414 2022/05/07 14:59:25 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3813,8 +3813,10 @@ pmap_zero_page(paddr_t pa)
 	memset(PAGE_ALIGNED(PMAP_DIRECT_MAP(pa)), 0, PAGE_SIZE);
 #else
 #if defined(XENPV)
-	if (XEN_VERSION_SUPPORTED(3, 4))
+	if (XEN_VERSION_SUPPORTED(3, 4)) {
 		xen_pagezero(pa);
+		return;
+	}
 #endif
 	struct cpu_info *ci;
 	pt_entry_t *zpte;



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

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 09:02:19 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
Remove SPR_CCR0 from ; we already have it in
, together with other 4xx-specific SPRs.

Thanks uwe@ for pointing out.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/include/spr.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/powerpc/include

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 09:02:19 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
Remove SPR_CCR0 from ; we already have it in
, together with other 4xx-specific SPRs.

Thanks uwe@ for pointing out.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/include/spr.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/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.55 src/sys/arch/powerpc/include/spr.h:1.56
--- src/sys/arch/powerpc/include/spr.h:1.55	Sat May  7 04:12:54 2022
+++ src/sys/arch/powerpc/include/spr.h	Sat May  7 09:02:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.55 2022/05/07 04:12:54 rin Exp $	*/
+/*	$NetBSD: spr.h,v 1.56 2022/05/07 09:02:19 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, The NetBSD Foundation, Inc.
@@ -144,7 +144,6 @@ mfspr(int reg)
 #define	SPR_TBL			0x11c	/* E468 Time Base Lower */
 #define	SPR_TBU			0x11d	/* E468 Time Base Upper */
 #define	SPR_PVR			0x11f	/* E468 Processor Version Register */
-#define	SPR_CCR0		0x3b3	/* .4.. Core Configuration Register */
 
 /* Time Base Register declarations */
 #define	TBR_TBL			0x10c	/* E468 Time Base Lower */



Re: CVS commit: src/sys/arch

2022-05-07 Thread Rin Okuyama

Oops, I missed it. I will fix soon.

Thanks again,
rin

On 2022/05/07 17:24, Valery Ushakov wrote:

On Sat, May 07, 2022 at 04:12:55 +, Rin Okuyama wrote:


Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


Note that we already have it defined (along with bunch of others) in
sys/arch/powerpc/include/ibm4xx/spr.h:74


-uwe



Re: CVS commit: src/sys/arch

2022-05-07 Thread Valery Ushakov
On Sat, May 07, 2022 at 04:12:55 +, Rin Okuyama wrote:

> Module Name:  src
> Committed By: rin
> Date: Sat May  7 04:12:55 UTC 2022
> 
> Modified Files:
>   src/sys/arch/evbppc/dht: locore.S
>   src/sys/arch/powerpc/include: spr.h
> 
> Log Message:
> Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
>  and use it.
> 
> Idea from uwe@, thanks!
> (and sorry for delayed response!)

Note that we already have it defined (along with bunch of others) in 
sys/arch/powerpc/include/ibm4xx/spr.h:74


-uwe


CVS commit: src/sys/arch/arm/broadcom

2022-05-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  7 07:26:27 UTC 2022

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_spi.c

Log Message:
Remove unnecessary gotos and label.  Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/broadcom/bcm2835_spi.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/arm/broadcom

2022-05-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  7 07:26:27 UTC 2022

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_spi.c

Log Message:
Remove unnecessary gotos and label.  Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/broadcom/bcm2835_spi.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_spi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_spi.c:1.11 src/sys/arch/arm/broadcom/bcm2835_spi.c:1.12
--- src/sys/arch/arm/broadcom/bcm2835_spi.c:1.11	Sat Aug  7 16:18:43 2021
+++ src/sys/arch/arm/broadcom/bcm2835_spi.c	Sat May  7 07:26:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_spi.c,v 1.11 2021/08/07 16:18:43 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $	*/
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.11 2021/08/07 16:18:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $");
 
 #include 
 #include 
@@ -298,7 +298,6 @@ bcmspi_intr(void *cookie)
 	if (ISSET(cs, SPI_CS_DONE)) {
 		if (sc->sc_wchunk != NULL) {
 			bcmspi_send(sc);
-			goto end;
 		} else {
 			bus_space_write_4(sc->sc_iot, sc->sc_ioh, SPI_CS,
 			sc->sc_CS);
@@ -309,14 +308,12 @@ bcmspi_intr(void *cookie)
 			KASSERT(st != NULL);
 			spi_done(st, 0);
 			sc->sc_running = false;
-			goto end;
 		}
 	} else if (ISSET(cs, SPI_CS_RXR)) {
 		bcmspi_recv(sc);
 		bcmspi_send(sc);
 	}
 
-end:
 	mutex_exit(>sc_mutex);
 	return ISSET(cs, SPI_CS_DONE|SPI_CS_RXR);
 }



CVS commit: src/sys/arch/powerpc

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 07:10:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Try to fix PV tracking support.

* For oea (with real PV tracking support):

  Define __HAVE_PMAP_PV_TRACK. Otherwise, pmap_pv_init() is not called by
  uvm_init().

* For booke and ibm4xx (without PV tracking support):

  For MODULAR kernel and modules, define __HAVE_PMAP_PV_TRACK together with
  PMAP_PV_TRACK_ONLY_STUBS, so that modules can be shared with oea.

Note that PMAP_PV_TRACK_ONLY_STUBS can be used even for oea,
as a compile-time option to strip real PV tracking support.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/include/oea/pmap.h

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

Modified files:

Index: src/sys/arch/powerpc/conf/files.powerpc
diff -u src/sys/arch/powerpc/conf/files.powerpc:1.100 src/sys/arch/powerpc/conf/files.powerpc:1.101
--- src/sys/arch/powerpc/conf/files.powerpc:1.100	Thu Feb 17 16:09:00 2022
+++ src/sys/arch/powerpc/conf/files.powerpc	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.powerpc,v 1.100 2022/02/17 16:09:00 macallan Exp $
+#	$NetBSD: files.powerpc,v 1.101 2022/05/07 07:10:46 rin Exp $
 
 defflag	opt_altivec.h	ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag	opt_openpic.h	OPENPIC_DISTRIBUTE
@@ -32,6 +32,8 @@ file	arch/powerpc/powerpc/db_trace.c			d
 file	arch/powerpc/powerpc/fpu.c
 file	arch/powerpc/powerpc/intr_stubs.c		ppc_booke
 
+file	uvm/pmap/pmap_pvt.cmodular | (ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601)
+
 # IBM 4xx Family files (40x)
 file	arch/powerpc/ibm4xx/pmap.c			ppc_ibm4xx
 file	arch/powerpc/ibm4xx/trap.c			ppc_ibm4xx
@@ -51,7 +53,6 @@ file	arch/powerpc/oea/pmap64.c			ppc_oea
 file	arch/powerpc/oea/pmap64_bridge.c		ppc_oea64_bridge
 file	arch/powerpc/oea/pmap_kernel.c			ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
 file	arch/powerpc/powerpc/trap.c			ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
-file	uvm/pmap/pmap_pvt.cppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
 
 # PPC BookE (MPC85xx) Family files
 file	arch/powerpc/booke/booke_machdep.c		ppc_booke

Index: src/sys/arch/powerpc/include/pmap.h
diff -u src/sys/arch/powerpc/include/pmap.h:1.41 src/sys/arch/powerpc/include/pmap.h:1.42
--- src/sys/arch/powerpc/include/pmap.h:1.41	Wed Feb 16 23:31:13 2022
+++ src/sys/arch/powerpc/include/pmap.h	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.41 2022/02/16 23:31:13 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.42 2022/05/07 07:10:46 rin Exp $	*/
 
 #ifndef _POWERPC_PMAP_H_
 #define _POWERPC_PMAP_H_
@@ -22,8 +22,6 @@
 
 #endif /* !_MODULE */
 
-#include 
-
 #if !defined(_LOCORE) && (defined(MODULAR) || defined(_MODULE))
 /*
  * Both BOOKE and OEA use __HAVE_VM_PAGE_MD but IBM4XX doesn't so define
@@ -41,6 +39,15 @@ struct vm_page_md {
 
 __CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*5);
 
+#ifndef __HAVE_PMAP_PV_TRACK
+/*
+ * We need empty stubs for modules shared with all sub-archs.
+ */
+#define	__HAVE_PMAP_PV_TRACK
+#define	PMAP_PV_TRACK_ONLY_STUBS
+#include 
+#endif /* !__HAVE_PMAP_PV_TRACK */
+
 #endif /* !LOCORE && (MODULAR || _MODULE) */
 
 #endif /* !_POWERPC_PMAP_H_ */

Index: src/sys/arch/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.36 src/sys/arch/powerpc/include/oea/pmap.h:1.37
--- src/sys/arch/powerpc/include/oea/pmap.h:1.36	Wed Feb 16 23:31:13 2022
+++ src/sys/arch/powerpc/include/oea/pmap.h	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.36 2022/02/16 23:31:13 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37 2022/05/07 07:10:46 rin Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -48,6 +48,9 @@
 #endif
 #include 
 
+#define	__HAVE_PMAP_PV_TRACK
+#include 
+
 /*
  * Pmap stuff
  */



CVS commit: src/sys/arch/powerpc

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 07:10:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Try to fix PV tracking support.

* For oea (with real PV tracking support):

  Define __HAVE_PMAP_PV_TRACK. Otherwise, pmap_pv_init() is not called by
  uvm_init().

* For booke and ibm4xx (without PV tracking support):

  For MODULAR kernel and modules, define __HAVE_PMAP_PV_TRACK together with
  PMAP_PV_TRACK_ONLY_STUBS, so that modules can be shared with oea.

Note that PMAP_PV_TRACK_ONLY_STUBS can be used even for oea,
as a compile-time option to strip real PV tracking support.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/include/oea/pmap.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/powerpc/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.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/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.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/booke/pci/pq3pci.c
diff -u src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30 src/sys/arch/powerpc/booke/pci/pq3pci.c:1.31
--- src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30	Tue Jan 11 22:45:56 2022
+++ src/sys/arch/powerpc/booke/pci/pq3pci.c	Sat May  7 05:08:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $	*/
+/*	$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 #define	__INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $");
 
 #include "locators.h"
 
@@ -727,8 +727,11 @@ static int
 pq3pci_once_init(void)
 {
 
-	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_VM);
-	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_VM);
+	/*
+	 * XXX necessary??
+	 */
+	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	return 0;
 }
@@ -1209,7 +1212,7 @@ pq3pci_msi_alloc_one(int ipl)
 	uint32_t bitmap[maplen];
 	pci_intr_handle_t handle;
 
-	mutex_spin_enter(_msigroups_lock);
+	mutex_enter(_msigroups_lock);
 	for (u_int i = 0; i < maplen; i++) {
 		struct pq3pci_msigroup * const msig = pq3pci_msigroups[i];
 		if (msig == NULL) {
@@ -1237,20 +1240,20 @@ pq3pci_msi_alloc_one(int ipl)
 			struct pq3pci_msihand * const msih __diagused =
 			pq3pci_msi_claim(handle);
 			KASSERT(msih != NULL);
-			mutex_spin_exit(_msigroups_lock);
+			mutex_exit(_msigroups_lock);
 			return handle;
 		}
 	}
 
 	if (freegroup-- == 0) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 
 	struct pq3pci_msigroup * const msig =
 	kmem_zalloc(sizeof(*msig), KM_NOSLEEP);
 	if (msig == NULL) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 	pq3pci_msi_group_setup(msig, freegroup, ipl);
@@ -1259,7 +1262,7 @@ pq3pci_msi_alloc_one(int ipl)
 	struct pq3pci_msihand * const msih __diagused =
 	pq3pci_msi_claim(handle);
 	KASSERT(msih != NULL);
-	mutex_spin_exit(_msigroups_lock);
+	mutex_exit(_msigroups_lock);
 	return handle;
 }
 
@@ -1327,17 +1330,17 @@ static struct pq3pci_intrsource *
 pq3pci_intr_source_lookup(struct pq3pci_softc *sc, pci_intr_handle_t handle)
 {
 	struct pq3pci_intrsource *pis;
-	mutex_spin_enter(_intrsources_lock);
+	mutex_enter(_intrsources_lock);
 	SIMPLEQ_FOREACH(pis, _intrsources, pis_link) {
 		if (pis->pis_handle == handle) {
-			mutex_spin_exit(_intrsources_lock);
+			mutex_exit(_intrsources_lock);
 			return pis;
 		}
 	}
 	pis = kmem_zalloc(sizeof(*pis), KM_NOSLEEP);
 	if (pis != NULL)
 		pq3pci_intr_source_setup(sc, pis, handle);
-	mutex_spin_exit(_intrsources_lock);
+	mutex_exit(_intrsources_lock);
 	return pis;
 }
 



CVS commit: src/sys/arch/powerpc/booke/dev

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:01:29 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Obsolete mdio_lock for pq3mdio_mii_{read,write}reg().

Callers (mii(4) layer and atphy(4) driver) acquire mii_lock() for
this purpose.

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/booke/dev/pq3etsec.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/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.56 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.57
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.56	Sat Aug  7 16:19:02 2021
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Sat May  7 05:01:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.56 2021/08/07 16:19:02 thorpej Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.57 2022/05/07 05:01:29 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.56 2021/08/07 16:19:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.57 2022/05/07 05:01:29 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -251,8 +251,6 @@ struct pq3etsec_softc {
 struct pq3mdio_softc {
 	device_t mdio_dev;
 
-	kmutex_t *mdio_lock;
-
 	bus_space_tag_t mdio_bst;
 	bus_space_handle_t mdio_bsh;
 };
@@ -380,7 +378,6 @@ pq3mdio_attach(device_t parent, device_t
 	struct cpunode_locators * const cnl = >cna_locs;
 
 	mdio->mdio_dev = self;
-	mdio->mdio_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
 
 	if (device_is_a(parent, "cpunode")) {
 		struct cpunode_softc * const psc = device_private(parent);
@@ -416,8 +413,6 @@ pq3mdio_mii_readreg(device_t self, int p
 	struct pq3mdio_softc * const mdio = device_private(self);
 	uint32_t miimcom = etsec_mdio_read(mdio, MIIMCOM);
 
-	mutex_enter(mdio->mdio_lock);
-
 	etsec_mdio_write(mdio, MIIMADD,
 	__SHIFTIN(phy, MIIMADD_PHY) | __SHIFTIN(reg, MIIMADD_REG));
 
@@ -436,7 +431,6 @@ pq3mdio_mii_readreg(device_t self, int p
 	aprint_normal_dev(mdio->mdio_dev, "%s: phy %d reg %d: %#x\n",
 	__func__, phy, reg, data);
 #endif
-	mutex_exit(mdio->mdio_lock);
 	return 0;
 }
 
@@ -451,8 +445,6 @@ pq3mdio_mii_writereg(device_t self, int 
 	__func__, phy, reg, data);
 #endif
 
-	mutex_enter(mdio->mdio_lock);
-
 	etsec_mdio_write(mdio, MIIMADD,
 	__SHIFTIN(phy, MIIMADD_PHY) | __SHIFTIN(reg, MIIMADD_REG));
 	etsec_mdio_write(mdio, MIIMCOM, 0);	/* clear any past bits */
@@ -466,8 +458,6 @@ pq3mdio_mii_writereg(device_t self, int 
 	if (miimcom == MIIMCOM_SCAN)
 		etsec_mdio_write(mdio, MIIMCOM, miimcom);
 
-	mutex_exit(mdio->mdio_lock);
-
 	return 0;
 }
 



CVS commit: src/sys/arch/powerpc/booke/dev

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:01:29 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Obsolete mdio_lock for pq3mdio_mii_{read,write}reg().

Callers (mii(4) layer and atphy(4) driver) acquire mii_lock() for
this purpose.

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/booke/dev/pq3etsec.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/amd64/conf

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:32:29 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
Add MODULAR_DEFAULT_VERBOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/amd64/conf/ALL

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



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

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:32:29 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
Add MODULAR_DEFAULT_VERBOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/amd64/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.169 src/sys/arch/amd64/conf/ALL:1.170
--- src/sys/arch/amd64/conf/ALL:1.169	Thu Dec 23 17:13:13 2021
+++ src/sys/arch/amd64/conf/ALL	Sat May  7 04:32:29 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.169 2021/12/23 17:13:13 hannken Exp $
+# $NetBSD: ALL,v 1.170 2022/05/07 04:32:29 rin Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.169 $"
+#ident		"ALL-$Revision: 1.170 $"
 
 maxusers	64		# estimated number of users
 
@@ -97,6 +97,7 @@ options 	SYSVSHM		# System V-like memory
 
 options 	MODULAR		# new style module(7) framework
 options 	MODULAR_DEFAULT_AUTOLOAD
+options 	MODULAR_DEFAULT_VERBOSE
 
 options 	USERCONF	# userconf(4) support
 options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)



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

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:19:22 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke: trap_subr.S

Log Message:
Make this assemble correctly with clang.

At the moment, clang wrongly handles m[ft]sprgN (N >= 4);
use m[ft]spr for SPR_SPRGN instead.

Now, clang-compiled kernel seems working just fine on my RB800!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/booke/trap_subr.S

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

Modified files:

Index: src/sys/arch/powerpc/booke/trap_subr.S
diff -u src/sys/arch/powerpc/booke/trap_subr.S:1.13 src/sys/arch/powerpc/booke/trap_subr.S:1.14
--- src/sys/arch/powerpc/booke/trap_subr.S:1.13	Mon Jul  6 10:16:12 2020
+++ src/sys/arch/powerpc/booke/trap_subr.S	Sat May  7 04:19:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $	*/
+/*	$NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-RCSID("$NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $")
+RCSID("$NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $")
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -68,15 +68,20 @@ RCSID("$NetBSD: trap_subr.S,v 1.13 2020/
 	 * needed, saves sprg3, and then refers to the save using a
 	 * displacement of -amount.
 	 */
+	/*
+	 * XXXclang
+	 * At the moment, clang cannot correctly assemble m[ft]sprgN
+	 * (N >= 4); use m[ft]spr for SPR_SPRGN instead.
+	 */
 #define	FRAME_EXC_PROLOGUE(start, sprg, srr)\
-	mt##sprg %r2;			/* save r2 */			\
+	mtspr	sprg,%r2;		/* save r2 */			\
 	mfsprg3	%r2;			/* get save_area pointer */	\
 	addi	%r2,%r2,4*(32-start);	\
 	/* allocate save area */	\
 	mtsprg3	%r2;			/* save updated pointer */	\
 	stmw	%r##start,-4*(32-start)(%r2);\
 	/* free r24-r31 for use */	\
-	mf##sprg %r26;			/* get saved r2 */		\
+	mfspr	%r26,sprg;		/* get saved r2 */		\
 	mfcr	%r27;			/* get Condition Register */	\
 	mfxer	%r28;			/* get XER */			\
 	mfspr	%r30, SPR_##srr##0;	/* get SRR0 */			\
@@ -103,41 +108,41 @@ RCSID("$NetBSD: trap_subr.S,v 1.13 2020/
 mtsrr1	r
 
 #define	FRAME_PROLOGUE		\
-	FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+	FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 #define	FRAME_PROLOGUE_DEAR_ESR	\
-	FRAME_EXC_PROLOGUE(24, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR; \
 	PROLOGUE_GET_DEAR
 
 #define	FRAME_PROLOGUE_ESR	\
-	FRAME_EXC_PROLOGUE(25, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(25, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR
 
 #define	FRAME_TLBPROLOGUE	\
-	FRAME_EXC_PROLOGUE(20, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(20, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR; \
 	PROLOGUE_GET_DEAR
 
 #define	FRAME_INTR_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+	FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 /*
  * These need to save SRR0/SRR1 as well their SRR0/SRR1 in case normal
  * exceptions happened during their execution.
  */
 #define	FRAME_CRIT_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 
 #define	FRAME_MCHK_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg5, MCSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG5, MCSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 
 #define	FRAME_DEBUG_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 



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

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:19:22 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke: trap_subr.S

Log Message:
Make this assemble correctly with clang.

At the moment, clang wrongly handles m[ft]sprgN (N >= 4);
use m[ft]spr for SPR_SPRGN instead.

Now, clang-compiled kernel seems working just fine on my RB800!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/booke/trap_subr.S

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



CVS commit: src/sys/arch

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/dht/locore.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/include/spr.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/evbppc/dht/locore.S
diff -u src/sys/arch/evbppc/dht/locore.S:1.2 src/sys/arch/evbppc/dht/locore.S:1.3
--- src/sys/arch/evbppc/dht/locore.S:1.2	Sun Feb 20 18:56:01 2022
+++ src/sys/arch/evbppc/dht/locore.S	Sat May  7 04:12:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.2 2022/02/20 18:56:01 christos Exp $	*/
+/*	$NetBSD: locore.S,v 1.3 2022/05/07 04:12:54 rin Exp $	*/
 
 /*
  * Taken from src/sys/arch/powerpc/ibm4xx/openbios/locore.s:
@@ -120,9 +120,9 @@ __start:
 	 * Note:Meaning of bits we need to set is undocumented.
 	 */
 	sync
-	mfspr   %r0,947 	/* mfccr0  %r0 */
+	mfspr   %r0,SPR_CCR0	/* XXXclang: mfccr0 %r0 */
 	oris%r0,%r0,0x5000@h
-	mtspr   947,%r0		/* mtccr0  %r0 */
+	mtspr   SPR_CCR0,%r0	/* XXXclang: mtccr0 %r0 */
 	isync
 
 	/* PPC405GP errata, item #58.

Index: src/sys/arch/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.54 src/sys/arch/powerpc/include/spr.h:1.55
--- src/sys/arch/powerpc/include/spr.h:1.54	Tue Nov  2 11:21:24 2021
+++ src/sys/arch/powerpc/include/spr.h	Sat May  7 04:12:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.54 2021/11/02 11:21:24 ryo Exp $	*/
+/*	$NetBSD: spr.h,v 1.55 2022/05/07 04:12:54 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, The NetBSD Foundation, Inc.
@@ -144,6 +144,7 @@ mfspr(int reg)
 #define	SPR_TBL			0x11c	/* E468 Time Base Lower */
 #define	SPR_TBU			0x11d	/* E468 Time Base Upper */
 #define	SPR_PVR			0x11f	/* E468 Processor Version Register */
+#define	SPR_CCR0		0x3b3	/* .4.. Core Configuration Register */
 
 /* Time Base Register declarations */
 #define	TBR_TBL			0x10c	/* E468 Time Base Lower */



CVS commit: src/sys/arch

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/dht/locore.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/include/spr.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/aarch64/aarch64

2022-05-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri May  6 06:09:51 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: cpuswitch.S locore.S vectors.S

Log Message:
Sprinkle isb after modifying system regs of pointer auth.
With options ARMV83_PAC, it now works on native Mac M1.

TODO: Multiple ISBs should be combined in one place.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/aarch64/vectors.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.33 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.34
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.33	Tue Mar  9 16:44:27 2021
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Fri May  6 06:09:50 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.34 2022/05/06 06:09:50 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.34 2022/05/06 06:09:50 ryo Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -115,6 +115,7 @@ ENTRY_NP(cpu_switchto)
 	msr	APGAKeyLo_EL1, x5
 	msr	APGAKeyHi_EL1, x6
 1:
+	isb
 #endif
 
 	msr	tpidr_el1, x1		/* switch curlwp to new lwp */
@@ -202,6 +203,7 @@ ENTRY_NP(cpu_switchto_softint)
 	ldp	x5, x6, [x0, #L_MD_IA_KERN]
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
+	isb
 1:
 #endif
 	ENABLE_INTERRUPT
@@ -235,6 +237,7 @@ ENTRY_NP(cpu_switchto_softint)
 	ldp	x5, x6, [x19, #L_MD_IA_KERN]
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
+	isb
 1:
 #endif
 
@@ -289,12 +292,14 @@ ENTRY_NP(lwp_trampoline)
 	ldr	w4, [x4]
 	cbz	w4, 1f
 	mov	x26, x1
+
 	bl	_C_LABEL(cprng_strong64)
-	str	x0, [x26, #L_MD_IA_KERN]
-	msr	APIAKeyLo_EL1, x0
+	mov	x25, x0
 	bl	_C_LABEL(cprng_strong64)
-	str	x0, [x26, #(L_MD_IA_KERN + 8)]
+	stp	x25, x0, [x26, #L_MD_IA_KERN]
+	msr	APIAKeyLo_EL1, x25
 	msr	APIAKeyHi_EL1, x0
+	isb
 1:
 #endif
 

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.85 src/sys/arch/aarch64/aarch64/locore.S:1.86
--- src/sys/arch/aarch64/aarch64/locore.S:1.85	Mon Jan 31 09:16:09 2022
+++ src/sys/arch/aarch64/aarch64/locore.S	Fri May  6 06:09:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.85 2022/01/31 09:16:09 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.86 2022/05/06 06:09:50 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.85 2022/01/31 09:16:09 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.86 2022/05/06 06:09:50 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -196,6 +196,7 @@ vstart:
 	ldr	x1, sctlr_pac
 	orr	x0, x0, x1		/*  enable PAC */
 	msr	sctlr_el1, x0
+	isb
 1:
 
 	adrl	x19, cpu_info_store	/* curcpu (_info_store[0] */
@@ -565,6 +566,7 @@ mp_vstart:
 	ldr	x1, sctlr_pac
 	orr	x0, x0, x1		/*  enable PAC */
 	msr	sctlr_el1, x0
+	isb
 1:
 
 	mov	fp, xzr			/* trace back starts here */

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.25 src/sys/arch/aarch64/aarch64/vectors.S:1.26
--- src/sys/arch/aarch64/aarch64/vectors.S:1.25	Fri May  6 05:14:38 2022
+++ src/sys/arch/aarch64/aarch64/vectors.S	Fri May  6 06:09:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.S,v 1.25 2022/05/06 05:14:38 ryo Exp $	*/
+/*	$NetBSD: vectors.S,v 1.26 2022/05/06 06:09:50 ryo Exp $	*/
 
 #include 
 #include 
@@ -11,7 +11,7 @@
 #include "opt_dtrace.h"
 #include "opt_gic.h"
 
-RCSID("$NetBSD: vectors.S,v 1.25 2022/05/06 05:14:38 ryo Exp $")
+RCSID("$NetBSD: vectors.S,v 1.26 2022/05/06 06:09:50 ryo Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -100,6 +100,7 @@ ENTRY_NBTI(\func)
 	ldp	x5, x6, [x1, #L_MD_IA_KERN]
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
+	isb
 1:
 #endif
 	.endif
@@ -310,6 +311,7 @@ ENTRY_NP(el0_trap_exit)
 	ldp	x5, x6, [x9, #L_MD_IA_USER]
 	msr	APIAKeyLo_EL1, x5
 	msr	APIAKeyHi_EL1, x6
+	isb
 1:
 #endif
 



CVS commit: src/sys/arch/aarch64/aarch64

2022-05-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri May  6 06:09:51 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: cpuswitch.S locore.S vectors.S

Log Message:
Sprinkle isb after modifying system regs of pointer auth.
With options ARMV83_PAC, it now works on native Mac M1.

TODO: Multiple ISBs should be combined in one place.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/aarch64/aarch64/vectors.S

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



CVS commit: src/sys/arch/aarch64/aarch64

2022-05-05 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri May  6 05:14:38 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: vectors.S

Log Message:
md_astpending is uint32_t


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/vectors.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.24 src/sys/arch/aarch64/aarch64/vectors.S:1.25
--- src/sys/arch/aarch64/aarch64/vectors.S:1.24	Sat Sep 18 12:25:06 2021
+++ src/sys/arch/aarch64/aarch64/vectors.S	Fri May  6 05:14:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.S,v 1.24 2021/09/18 12:25:06 jmcneill Exp $	*/
+/*	$NetBSD: vectors.S,v 1.25 2022/05/06 05:14:38 ryo Exp $	*/
 
 #include 
 #include 
@@ -11,7 +11,7 @@
 #include "opt_dtrace.h"
 #include "opt_gic.h"
 
-RCSID("$NetBSD: vectors.S,v 1.24 2021/09/18 12:25:06 jmcneill Exp $")
+RCSID("$NetBSD: vectors.S,v 1.25 2022/05/06 05:14:38 ryo Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -282,7 +282,7 @@ ENTRY_NP(el0_trap_exit)
 	cbz	w8, 9f
 
 	/* curlwp->l_md.md_astpending = 0; */
-	str	xzr, [x9, #L_MD_ASTPENDING]
+	str	wzr, [x9, #L_MD_ASTPENDING]
 
 	/*  trap_doast(tf); */
 	ENABLE_INTERRUPT



CVS commit: src/sys/arch/aarch64/aarch64

2022-05-05 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri May  6 05:14:38 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: vectors.S

Log Message:
md_astpending is uint32_t


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/vectors.S

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



CVS commit: src/sys/arch/arm

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:12:28 UTC 2022

Modified Files:
src/sys/arch/arm/arm: efi_machdep.c
src/sys/arch/arm/arm32: pmap.c

Log Message:
Catch up with aarch64 TTBR0 handling in pmap_{,de}activate_efirt and
kpreempt_{en,dis}able.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/efi_machdep.c
cvs rdiff -u -r1.436 -r1.437 src/sys/arch/arm/arm32/pmap.c

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



CVS commit: src/sys/arch/arm

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:12:28 UTC 2022

Modified Files:
src/sys/arch/arm/arm: efi_machdep.c
src/sys/arch/arm/arm32: pmap.c

Log Message:
Catch up with aarch64 TTBR0 handling in pmap_{,de}activate_efirt and
kpreempt_{en,dis}able.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/efi_machdep.c
cvs rdiff -u -r1.436 -r1.437 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm/efi_machdep.c
diff -u src/sys/arch/arm/arm/efi_machdep.c:1.1 src/sys/arch/arm/arm/efi_machdep.c:1.2
--- src/sys/arch/arm/arm/efi_machdep.c:1.1	Sat Apr  2 11:16:06 2022
+++ src/sys/arch/arm/arm/efi_machdep.c	Tue May  3 20:12:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: efi_machdep.c,v 1.1 2022/04/02 11:16:06 skrll Exp $ */
+/* $NetBSD: efi_machdep.c,v 1.2 2022/05/03 20:12:27 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.1 2022/04/02 11:16:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.2 2022/05/03 20:12:27 skrll Exp $");
 
 #include 
 #include 
@@ -50,6 +50,10 @@ static struct {
 int
 arm_efirt_md_enter(void)
 {
+	kpreempt_disable();
+
+	struct lwp * const l = curlwp;
+
 	arm_efirt_state.aert_tpidrprw = armreg_tpidrprw_read();
 
 	/* Disable the VFP.  */
@@ -65,6 +69,9 @@ arm_efirt_md_enter(void)
 	if (err)
 		return err;
 
+	if ((l->l_flag & LW_SYSTEM) == 0) {
+		pmap_deactivate(l);
+	}
 	pmap_activate_efirt();
 
 	return 0;
@@ -73,7 +80,12 @@ arm_efirt_md_enter(void)
 void
 arm_efirt_md_exit(void)
 {
+	struct lwp * const l = curlwp;
+
 	pmap_deactivate_efirt();
+	if ((l->l_flag & LW_SYSTEM) == 0) {
+		pmap_activate(l);
+	}
 
 	armreg_tpidrprw_write(arm_efirt_state.aert_tpidrprw);
 
@@ -83,6 +95,8 @@ arm_efirt_md_exit(void)
 
 	/* Remove custom fault handler */
 	cpu_unset_onfault();
+
+	kpreempt_enable();
 }
 
 

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.436 src/sys/arch/arm/arm32/pmap.c:1.437
--- src/sys/arch/arm/arm32/pmap.c:1.436	Sat Apr  9 23:38:31 2022
+++ src/sys/arch/arm/arm32/pmap.c	Tue May  3 20:12:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.437 2022/05/03 20:12:28 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.437 2022/05/03 20:12:28 skrll Exp $");
 
 #include 
 #include 
@@ -4986,15 +4986,16 @@ pmap_md_pdetab_deactivate(pmap_t pm)
 void
 pmap_activate_efirt(void)
 {
-	kpreempt_disable();
-
-	struct cpu_info * const ci = curcpu();
 	struct pmap * const pm = _pmap;
-	struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci));
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, " (pm=%#jx)", (uintptr_t)pm, 0, 0, 0);
 
+	KASSERT(kpreempt_disabled());
+
+	struct cpu_info * const ci = curcpu();
+	struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci));
+
 	PMAPCOUNT(activations);
 
 	/*
@@ -5038,6 +5039,10 @@ pmap_activate(struct lwp *l)
 	UVMHIST_CALLARGS(maphist, "l=%#jx pm=%#jx", (uintptr_t)l,
 	(uintptr_t)npm, 0, 0);
 
+#ifdef ARM_MMU_EXTENDED
+	KASSERT(kpreempt_disabled());
+#endif
+
 	struct cpu_info * const ci = curcpu();
 
 	/*
@@ -5197,6 +5202,7 @@ pmap_deactivate(struct lwp *l)
 		(uintptr_t)pm, 0, 0);
 
 #ifdef ARM_MMU_EXTENDED
+	KASSERT(kpreempt_disabled());
 	pmap_md_pdetab_deactivate(pm);
 #else
 	/*
@@ -5219,6 +5225,7 @@ pmap_deactivate_efirt(void)
 {
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 
+	KASSERT(kpreempt_disabled());
 	struct cpu_info * const ci = curcpu();
 
 	/*
@@ -5234,7 +5241,6 @@ pmap_deactivate_efirt(void)
 
 	KASSERTMSG(ci->ci_pmap_asid_cur == KERNEL_PID, "ci_pmap_asid_cur %u",
 	ci->ci_pmap_asid_cur);
-	kpreempt_enable();
 
 	UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0);
 }



CVS commit: src/sys/arch/aarch64/aarch64

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:10:20 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: efi_machdep.c

Log Message:
Style. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/efi_machdep.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/efi_machdep.c
diff -u src/sys/arch/aarch64/aarch64/efi_machdep.c:1.12 src/sys/arch/aarch64/aarch64/efi_machdep.c:1.13
--- src/sys/arch/aarch64/aarch64/efi_machdep.c:1.12	Wed Apr 27 23:38:31 2022
+++ src/sys/arch/aarch64/aarch64/efi_machdep.c	Tue May  3 20:10:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: efi_machdep.c,v 1.12 2022/04/27 23:38:31 ryo Exp $ */
+/* $NetBSD: efi_machdep.c,v 1.13 2022/05/03 20:10:20 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.12 2022/04/27 23:38:31 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.13 2022/05/03 20:10:20 skrll Exp $");
 
 #include 
 #include 
@@ -106,11 +106,9 @@ arm_efirt_md_map_range(vaddr_t va, paddr
 int
 arm_efirt_md_enter(void)
 {
-	struct lwp *l;
-	int err;
-
 	kpreempt_disable();
-	l = curlwp;
+
+	struct lwp * const l = curlwp;
 
 	/* Save FPU state */
 	arm_efirt_state.fpu_used = fpu_used_p(l) != 0;
@@ -125,7 +123,7 @@ arm_efirt_md_enter(void)
 	 * Install custom fault handler. EFI lock is held across calls so
 	 * shared faultbuf is safe here.
 	 */
-	err = cpu_set_onfault(_efirt_state.faultbuf);
+	int err = cpu_set_onfault(_efirt_state.faultbuf);
 	if (err)
 		return err;
 
@@ -142,7 +140,7 @@ arm_efirt_md_enter(void)
 void
 arm_efirt_md_exit(void)
 {
-	struct lwp *l = curlwp;
+	struct lwp * const l = curlwp;
 
 	if (efi_userva) {
 		pmap_deactivate_efirt();
@@ -151,7 +149,6 @@ arm_efirt_md_exit(void)
 		}
 	}
 
-
 	/* Disable FP access */
 	reg_cpacr_el1_write(CPACR_FPEN_NONE);
 	isb();



CVS commit: src/sys/arch/aarch64/aarch64

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:10:20 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: efi_machdep.c

Log Message:
Style. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/efi_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/aarch64/aarch64

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:09:54 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
Sprinkle some KASSERT(kpreempt_disabled());


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/aarch64/aarch64/pmap.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/aarch64/aarch64

2022-05-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May  3 20:09:54 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
Sprinkle some KASSERT(kpreempt_disabled());


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/aarch64/aarch64/pmap.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.136 src/sys/arch/aarch64/aarch64/pmap.c:1.137
--- src/sys/arch/aarch64/aarch64/pmap.c:1.136	Wed Apr 27 23:38:31 2022
+++ src/sys/arch/aarch64/aarch64/pmap.c	Tue May  3 20:09:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.136 2022/04/27 23:38:31 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.137 2022/05/03 20:09:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.136 2022/04/27 23:38:31 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.137 2022/05/03 20:09:54 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -1502,6 +1502,8 @@ pmap_activate_efirt(void)
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(pmaphist, " (pm=%#jx)", (uintptr_t)pm, 0, 0, 0);
 
+	KASSERT(kpreempt_disabled());
+
 	ci->ci_pmap_asid_cur = pai->pai_asid;
 	UVMHIST_LOG(pmaphist, "setting asid to %#jx", pai->pai_asid,
 	0, 0, 0);
@@ -1527,6 +1529,7 @@ pmap_activate(struct lwp *l)
 	UVMHIST_CALLARGS(pmaphist, "lwp=%p (pid=%d, kernel=%u)", l,
 	l->l_proc->p_pid, pm == pmap_kernel() ? 1 : 0, 0);
 
+	KASSERT(kpreempt_disabled());
 	KASSERT((reg_tcr_el1_read() & TCR_EPD0) != 0);
 
 	if (pm == pmap_kernel())
@@ -1561,6 +1564,8 @@ pmap_deactivate_efirt(void)
 
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist);
 
+	KASSERT(kpreempt_disabled());
+
 	/* Disable translation table walks using TTBR0 */
 	uint64_t tcr = reg_tcr_el1_read();
 	reg_tcr_el1_write(tcr | TCR_EPD0);
@@ -1588,6 +1593,8 @@ pmap_deactivate(struct lwp *l)
 	UVMHIST_CALLARGS(pmaphist, "lwp=%p (pid=%d, (kernel=%u))", l,
 	l->l_proc->p_pid, pm == pmap_kernel() ? 1 : 0, 0);
 
+	KASSERT(kpreempt_disabled());
+
 	/* Disable translation table walks using TTBR0 */
 	tcr = reg_tcr_el1_read();
 	reg_tcr_el1_write(tcr | TCR_EPD0);



CVS commit: src/sys/arch/landisk/landisk

2022-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue May  3 14:20:24 UTC 2022

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

Log Message:
Fix vnode locking around VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/landisk/landisk/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/landisk/landisk/autoconf.c
diff -u src/sys/arch/landisk/landisk/autoconf.c:1.9 src/sys/arch/landisk/landisk/autoconf.c:1.10
--- src/sys/arch/landisk/landisk/autoconf.c:1.9	Sat Mar 19 13:49:21 2022
+++ src/sys/arch/landisk/landisk/autoconf.c	Tue May  3 14:20:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.9 2022/03/19 13:49:21 hannken Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.10 2022/05/03 14:20:24 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2022/03/19 13:49:21 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2022/05/03 14:20:24 mlelstv Exp $");
 
 #include 
 #include 
@@ -122,6 +122,7 @@ match_bootdisk(device_t dv, struct btinf
 		vput(tmpvn);
 		return (0);
 	}
+	VOP_UNLOCK(tmpvn);
 	error = VOP_IOCTL(tmpvn, DIOCGDINFO, , FREAD, NOCRED);
 	if (error) {
 		/*
@@ -140,6 +141,7 @@ match_bootdisk(device_t dv, struct btinf
 		found = 1;
 
 closeout:
+	vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(tmpvn, FREAD, NOCRED);
 	vput(tmpvn);
 	return (found);



CVS commit: src/sys/arch/landisk/landisk

2022-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue May  3 14:20:24 UTC 2022

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

Log Message:
Fix vnode locking around VOP_OPEN.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/landisk/landisk/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/i386/stand/lib

2022-05-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May  3 10:09:40 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/stand/lib/biosdisk.c

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

Modified files:

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.57 src/sys/arch/i386/stand/lib/biosdisk.c:1.58
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.57	Tue Dec 28 00:37:16 2021
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue May  3 10:09:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.57 2021/12/28 00:37:16 simonb Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.58 2022/05/03 10:09:40 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -544,7 +544,7 @@ ingest_label(struct biosdisk *d, struct 
 		d->part[part].size = lp->d_partitions[part].p_size;
 	}
 }
-	
+
 static int
 check_label(struct biosdisk *d, daddr_t sector)
 {
@@ -787,7 +787,6 @@ read_partitions(struct biosdisk *d, dadd
 #endif
 #ifndef NO_DISKLABEL
 	error = read_label(d, offset);
-	
 #endif
 	return error;
 }
@@ -893,7 +892,7 @@ biosdisk_probe(void)
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -969,7 +968,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidrame;
-			
+
 		first = 1;
 		for (part = 0; part < BIOSDISKNPART; part++) {
 #ifndef NO_GPT
@@ -1240,7 +1239,7 @@ raidframe_part_offset(struct biosdisk *d
 	return RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
 }
 #endif
-	
+
 int
 biosdisk_open(struct open_file *f, ...)
 /* struct open_file *f, int biosdev, int partition */
@@ -1356,7 +1355,7 @@ biosdisk_find_name(const char *fname, in
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -1401,7 +1400,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidframe;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			bool bootme = d->part[part].attr & GPT_ENT_ATTR_BOOTME;
 			if (d->part[part].size == 0)
@@ -1499,7 +1498,7 @@ biosdisk_find_raid(const char *name, int
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -1527,7 +1526,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidframe;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;



CVS commit: src/sys/arch/i386/stand/lib

2022-05-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May  3 10:09:40 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/stand/lib/biosdisk.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/aarch64

2022-05-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  2 10:13:16 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_machdep.c
src/sys/arch/aarch64/include: armreg.h

Log Message:
Only print the appropriate PAR fields for PAR.F={0,1}

Group the fields in the header.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/aarch64/aarch64/db_machdep.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/aarch64/include/armreg.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/aarch64

2022-05-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  2 10:13:16 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: db_machdep.c
src/sys/arch/aarch64/include: armreg.h

Log Message:
Only print the appropriate PAR fields for PAR.F={0,1}

Group the fields in the header.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/aarch64/aarch64/db_machdep.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/aarch64/include/armreg.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/db_machdep.c
diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.42 src/sys/arch/aarch64/aarch64/db_machdep.c:1.43
--- src/sys/arch/aarch64/aarch64/db_machdep.c:1.42	Sun Oct 31 16:23:47 2021
+++ src/sys/arch/aarch64/aarch64/db_machdep.c	Mon May  2 10:13:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.42 2021/10/31 16:23:47 skrll Exp $ */
+/* $NetBSD: db_machdep.c,v 1.43 2022/05/02 10:13:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.42 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.43 2022/05/02 10:13:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -456,17 +456,29 @@ db_par_print(uint64_t par, vaddr_t va)
 	paddr_t pa = (__SHIFTOUT(par, PAR_PA) << PAR_PA_SHIFT) +
 	(va & __BITS(PAR_PA_SHIFT - 1, 0));
 
-	db_printf("%016"PRIx64": ATTR=0x%02lx, NS=%ld, S=%ld, SHA=%ld, PTW=%ld"
-	", FST=%ld, F=%ld, PA=%016"PRIxPADDR"\n",
-	par,
-	__SHIFTOUT(par, PAR_ATTR),
-	__SHIFTOUT(par, PAR_NS),
-	__SHIFTOUT(par, PAR_S),
-	__SHIFTOUT(par, PAR_SHA),
-	__SHIFTOUT(par, PAR_PTW),
-	__SHIFTOUT(par, PAR_FST),
-	__SHIFTOUT(par, PAR_F),
-	pa);
+	if (__SHIFTOUT(par, PAR_F) == 0) {
+		db_printf("%016" PRIx64
+		": ATTR=0x%02" __PRIxBITS
+		", NS=%" __PRIuBITS
+		", SH=%" __PRIuBITS
+		", PA=%016" PRIxPADDR
+		" (no fault)\n",
+		par,
+		__SHIFTOUT(par, PAR_ATTR),
+		__SHIFTOUT(par, PAR_NS),
+		__SHIFTOUT(par, PAR_SH),
+		pa);
+	} else {
+		db_printf("%016" PRIx64
+		", S=%" __PRIuBITS
+		", PTW=%" __PRIuBITS
+		", FST=%" __PRIuBITS
+		" (fault)\n",
+		par,
+		__SHIFTOUT(par, PAR_S),
+		__SHIFTOUT(par, PAR_PTW),
+		__SHIFTOUT(par, PAR_FST));
+	}
 }
 
 void

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.60 src/sys/arch/aarch64/include/armreg.h:1.61
--- src/sys/arch/aarch64/include/armreg.h:1.60	Wed Jan  5 19:53:32 2022
+++ src/sys/arch/aarch64/include/armreg.h	Mon May  2 10:13:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.60 2022/01/05 19:53:32 ryo Exp $ */
+/* $NetBSD: armreg.h,v 1.61 2022/05/02 10:13:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -788,11 +788,12 @@ AARCH64REG_WRITE_INLINE(par_el1)
 #define	PAR_PA			__BITS(51,12)	// F=0 physical address
 #define	PAR_PA_SHIFT		12
 #define	PAR_NS			__BIT(9)	// F=0 non-secure
+#define	PAR_SH			__BITS(8,7)	// F=0 shareability attribute
+#define	 PAR_SH_NONE		 0
+#define	 PAR_SH_OUTER		 2
+#define	 PAR_SH_INNER		 3
+
 #define	PAR_S			__BIT(9)	// F=1 failure stage
-#define	PAR_SHA			__BITS(8,7)	// F=0 shareability attribute
-#define	 PAR_SHA_NONE		 0
-#define	 PAR_SHA_OUTER		 2
-#define	 PAR_SHA_INNER		 3
 #define	PAR_PTW			__BIT(8)	// F=1 partial table walk
 #define	PAR_FST			__BITS(6,1)	// F=1 fault status code
 #define	PAR_F			__BIT(0)	// translation failed



CVS commit: src/sys/arch/arm/apple

2022-05-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon May  2 04:39:29 UTC 2022

Modified Files:
src/sys/arch/arm/apple: apple_intc.c

Log Message:
fix non-MULTIPROCESSOR build


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/apple/apple_intc.c

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

Modified files:

Index: src/sys/arch/arm/apple/apple_intc.c
diff -u src/sys/arch/arm/apple/apple_intc.c:1.7 src/sys/arch/arm/apple/apple_intc.c:1.8
--- src/sys/arch/arm/apple/apple_intc.c:1.7	Mon Mar 28 19:59:26 2022
+++ src/sys/arch/arm/apple/apple_intc.c	Mon May  2 04:39:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $ */
+/* $NetBSD: apple_intc.c,v 1.8 2022/05/02 04:39:29 ryo Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -32,7 +32,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.8 2022/05/02 04:39:29 ryo Exp $");
 
 #include 
 #include 
@@ -503,16 +503,20 @@ apple_intc_attach(device_t parent, devic
 		pc->pc_sc = sc;
 		pc->pc_cpuid = cpuno;
 
+#ifdef MULTIPROCESSOR
 		pic->pic_cpus = ci->ci_kcpuset;
+#endif
 		pic->pic_ops = _intc_localpicops;
 		pic->pic_maxsources = 2;
 		snprintf(pic->pic_name, sizeof(pic->pic_name), "AIC/%lu", cpuno);
 
 		pic_add(pic, PIC_IRQBASE_ALLOC);
 
+#ifdef MULTIPROCESSOR
 		intr_establish_xname(pic->pic_irqbase + LOCALPIC_SOURCE_IPI,
 		IPL_HIGH, IST_LEVEL | IST_MPSAFE, apple_intc_ipi_handler,
 		pc, "ipi");
+#endif
 	}
 
 	apple_intc_cpu_init(>sc_pic, curcpu());



CVS commit: src/sys/arch/arm/apple

2022-05-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon May  2 04:39:29 UTC 2022

Modified Files:
src/sys/arch/arm/apple: apple_intc.c

Log Message:
fix non-MULTIPROCESSOR build


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/apple/apple_intc.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/aarch64/aarch64

2022-04-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 30 07:07:01 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: fault.c

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/fault.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/fault.c
diff -u src/sys/arch/aarch64/aarch64/fault.c:1.22 src/sys/arch/aarch64/aarch64/fault.c:1.23
--- src/sys/arch/aarch64/aarch64/fault.c:1.22	Mon Jan 31 09:16:09 2022
+++ src/sys/arch/aarch64/aarch64/fault.c	Sat Apr 30 07:07:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.22 2022/01/31 09:16:09 ryo Exp $	*/
+/*	$NetBSD: fault.c,v 1.23 2022/04/30 07:07:01 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.22 2022/01/31 09:16:09 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.23 2022/04/30 07:07:01 skrll Exp $");
 
 #include "opt_compat_netbsd32.h"
 #include "opt_cpuoptions.h"
@@ -224,7 +224,6 @@ data_abort_handler(struct trapframe *tf,
 		return;
 	}
 
-
  do_fault:
 	/* faultbail path? */
 	if (curcpu()->ci_intr_depth == 0) {



CVS commit: src/sys/arch/aarch64/aarch64

2022-04-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 30 07:07:01 UTC 2022

Modified Files:
src/sys/arch/aarch64/aarch64: fault.c

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/fault.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/rs6000/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:59:15 UTC 2022

Modified Files:
src/sys/arch/rs6000/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/rs6000/stand/boot/devopen.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/rs6000/stand/boot/devopen.c
diff -u src/sys/arch/rs6000/stand/boot/devopen.c:1.2 src/sys/arch/rs6000/stand/boot/devopen.c:1.3
--- src/sys/arch/rs6000/stand/boot/devopen.c:1.2	Sun Aug 10 07:40:49 2014
+++ src/sys/arch/rs6000/stand/boot/devopen.c	Sat Apr 30 03:59:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.2 2014/08/10 07:40:49 isaki Exp $	*/
+/*	$NetBSD: devopen.c,v 1.3 2022/04/30 03:59:15 rin Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -73,7 +73,7 @@ devparse(const char *fname, int *dev, in
 
 	if (*s == '(') {
 		/* lookup device and get index */
-		*s = NULL;
+		*s = '\0';
 		if ((*dev = devlookup(nametmp)) < 0)
 		goto baddev;
 
@@ -86,13 +86,13 @@ devparse(const char *fname, int *dev, in
 }
 			} else {
 if (flag) {
-	*s = NULL;
+	*s = '\0';
 	flag = 0;
 }
 			}
 		}
 		if (*s == ')')
-			*s = NULL;
+			*s = '\0';
 
 		switch (argc) {
 		case 3:



CVS commit: src/sys/arch/rs6000/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:59:15 UTC 2022

Modified Files:
src/sys/arch/rs6000/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/rs6000/stand/boot/devopen.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/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.19
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18	Tue Sep 29 15:12:52 2015
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sat Apr 30 03:52:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.18 2015/09/29 15:12:52 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.19 2022/04/30 03:52:41 rin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -473,7 +473,7 @@ dlabel_valid(int unit)
 
 	dsk = lookup_disk(unit);
 	if (dsk == NULL)
-		return NULL;
+		return 0;
 	return dsk->dlabel != NULL;
 }
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.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/prep/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:41:05 UTC 2022

Modified Files:
src/sys/arch/prep/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/prep/stand/boot/devopen.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/prep/stand/boot/devopen.c
diff -u src/sys/arch/prep/stand/boot/devopen.c:1.5 src/sys/arch/prep/stand/boot/devopen.c:1.6
--- src/sys/arch/prep/stand/boot/devopen.c:1.5	Sun Aug 10 07:40:49 2014
+++ src/sys/arch/prep/stand/boot/devopen.c	Sat Apr 30 03:41:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.5 2014/08/10 07:40:49 isaki Exp $	*/
+/*	$NetBSD: devopen.c,v 1.6 2022/04/30 03:41:05 rin Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -73,7 +73,7 @@ devparse(const char *fname, int *dev, in
 
 	if (*s == '(') {
 		/* lookup device and get index */
-		*s = NULL;
+		*s = '\0';
 		if ((*dev = devlookup(nametmp)) < 0)
 		goto baddev;
 
@@ -86,13 +86,13 @@ devparse(const char *fname, int *dev, in
 }
 			} else {
 if (flag) {
-	*s = NULL;
+	*s = '\0';
 	flag = 0;
 }
 			}
 		}
 		if (*s == ')')
-			*s = NULL;
+			*s = '\0';
 
 		switch (argc) {
 		case 3:



CVS commit: src/sys/arch/prep/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:41:05 UTC 2022

Modified Files:
src/sys/arch/prep/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/prep/stand/boot/devopen.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/landisk/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:37:09 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: boot2.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/boot2.c

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

Modified files:

Index: src/sys/arch/landisk/stand/boot/boot2.c
diff -u src/sys/arch/landisk/stand/boot/boot2.c:1.6 src/sys/arch/landisk/stand/boot/boot2.c:1.7
--- src/sys/arch/landisk/stand/boot/boot2.c:1.6	Sat Jun 11 06:31:49 2016
+++ src/sys/arch/landisk/stand/boot/boot2.c	Sat Apr 30 03:37:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.6 2016/06/11 06:31:49 dholland Exp $	*/
+/*	$NetBSD: boot2.c,v 1.7 2022/04/30 03:37:09 rin Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -479,7 +479,7 @@ parseboot(char *arg, char **filename, in
 	*howto = 0;
 
 	/* if there were no arguments */
-	if (*arg == NULL)
+	if (*arg == '\0')
 		return (1);
 
 	/* format is... */
@@ -493,7 +493,7 @@ parseboot(char *arg, char **filename, in
 		*filename = arg;
 
 		opts = gettrailer(arg);
-		if (*opts == NULL) {
+		if (*opts == '\0') {
 			opts = NULL;
 		} else if (*opts != '-') {
 			printf("invalid arguments\n");



CVS commit: src/sys/arch/landisk/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:37:09 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: boot2.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/boot2.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

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:39:51 UTC 2022

Modified Files:
src/sys/arch/cobalt/stand/boot: tgets.c
src/sys/arch/mmeye/stand/boot: tgets.c
src/sys/arch/prep/stand/boot: tgets.c
src/sys/arch/rs6000/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.

XXX
Too many copies for tgets.c...


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/cobalt/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mmeye/stand/boot/tgets.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/prep/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/rs6000/stand/boot/tgets.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/cobalt/stand/boot/tgets.c
diff -u src/sys/arch/cobalt/stand/boot/tgets.c:1.4 src/sys/arch/cobalt/stand/boot/tgets.c:1.5
--- src/sys/arch/cobalt/stand/boot/tgets.c:1.4	Wed Oct 17 19:54:09 2007
+++ src/sys/arch/cobalt/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.4 2007/10/17 19:54:09 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.5 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -45,12 +45,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT / 32); /* XXX */
+		delay(SCANDELAY / 32); /* XXX */
 	}
 	return -1;
 next:

Index: src/sys/arch/mmeye/stand/boot/tgets.c
diff -u src/sys/arch/mmeye/stand/boot/tgets.c:1.1 src/sys/arch/mmeye/stand/boot/tgets.c:1.2
--- src/sys/arch/mmeye/stand/boot/tgets.c:1.1	Thu Mar  3 05:59:37 2011
+++ src/sys/arch/mmeye/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.1 2011/03/03 05:59:37 kiyohara Exp $	*/
+/*	$NetBSD: tgets.c,v 1.2 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -45,12 +45,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return -1;
 next:

Index: src/sys/arch/prep/stand/boot/tgets.c
diff -u src/sys/arch/prep/stand/boot/tgets.c:1.4 src/sys/arch/prep/stand/boot/tgets.c:1.5
--- src/sys/arch/prep/stand/boot/tgets.c:1.4	Mon Apr 10 18:40:06 2006
+++ src/sys/arch/prep/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.4 2006/04/10 18:40:06 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.5 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return (-1);
 next:

Index: src/sys/arch/rs6000/stand/boot/tgets.c
diff -u src/sys/arch/rs6000/stand/boot/tgets.c:1.1 src/sys/arch/rs6000/stand/boot/tgets.c:1.2
--- src/sys/arch/rs6000/stand/boot/tgets.c:1.1	Mon Dec 17 19:09:55 2007
+++ src/sys/arch/rs6000/stand/boot/tgets.c	Fri Apr 29 21:39:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.1 2007/12/17 19:09:55 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.2 2022/04/29 21:39:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return (-1);
 next:



CVS commit: src/sys/arch

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:39:51 UTC 2022

Modified Files:
src/sys/arch/cobalt/stand/boot: tgets.c
src/sys/arch/mmeye/stand/boot: tgets.c
src/sys/arch/prep/stand/boot: tgets.c
src/sys/arch/rs6000/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.

XXX
Too many copies for tgets.c...


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/cobalt/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mmeye/stand/boot/tgets.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/prep/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/rs6000/stand/boot/tgets.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/acorn32/stand/boot32

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:03:08 UTC 2022

Modified Files:
src/sys/arch/acorn32/stand/boot32: boot32.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/acorn32/stand/boot32/boot32.c

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

Modified files:

Index: src/sys/arch/acorn32/stand/boot32/boot32.c
diff -u src/sys/arch/acorn32/stand/boot32/boot32.c:1.48 src/sys/arch/acorn32/stand/boot32/boot32.c:1.49
--- src/sys/arch/acorn32/stand/boot32/boot32.c:1.48	Wed Nov 10 15:33:26 2021
+++ src/sys/arch/acorn32/stand/boot32/boot32.c	Fri Apr 29 21:03:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot32.c,v 1.48 2021/11/10 15:33:26 msaitoh Exp $	*/
+/*	$NetBSD: boot32.c,v 1.49 2022/04/29 21:03:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002 Reinoud Zandijk
@@ -1070,7 +1070,7 @@ process_args(int argc, char **argv, int 
 	static char filename[80];
 
 	*howto = 0;
-	*file = NULL; *start_args = 1;
+	*file = '\0'; *start_args = 1;
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] == '-')
 			for (j = 1; argv[i][j]; j++)
@@ -1085,7 +1085,7 @@ process_args(int argc, char **argv, int 
 			break;
 		}
 	}
-	if (*file == NULL) {
+	if (*file == '\0') {
 		if (*howto & RB_ASKNAME) {
 			printf("boot: ");
 			kgets(filename, sizeof(filename));



CVS commit: src/sys/arch/acorn32/stand/boot32

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:03:08 UTC 2022

Modified Files:
src/sys/arch/acorn32/stand/boot32: boot32.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/acorn32/stand/boot32/boot32.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/bebox/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:48:27 UTC 2022

Modified Files:
src/sys/arch/bebox/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/bebox/stand/boot/tgets.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/bebox/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:48:27 UTC 2022

Modified Files:
src/sys/arch/bebox/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/bebox/stand/boot/tgets.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/bebox/stand/boot/tgets.c
diff -u src/sys/arch/bebox/stand/boot/tgets.c:1.8 src/sys/arch/bebox/stand/boot/tgets.c:1.9
--- src/sys/arch/bebox/stand/boot/tgets.c:1.8	Fri Feb 25 10:12:44 2011
+++ src/sys/arch/bebox/stand/boot/tgets.c	Fri Apr 29 20:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.8 2011/02/25 10:12:44 kiyohara Exp $	*/
+/*	$NetBSD: tgets.c,v 1.9 2022/04/29 20:48:26 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return -1;
 next:



CVS commit: src/sys/arch/sparc/stand/ofwboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:24:02 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

- Stop redefining roundup2().
- Compare kvamap->start (uint64_t) with 0 instead of NULL.
- Include  explicitly.

Thanks gson@ for notification.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c

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

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.16 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.17
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.16	Fri Nov  4 20:04:11 2016
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Fri Apr 29 20:24:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.16 2016/11/04 20:04:11 macallan Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.17 2022/04/29 20:24:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include 
+
 #include 
 #include 
 
@@ -47,8 +49,6 @@
 #define hi(val)		((uint32_t)(((val) >> 32) & (uint32_t)-1))
 #define lo(val)		((uint32_t)((val) & (uint32_t)-1))
 
-#define roundup2(x, y)	(((x)+((y)-1))&(~((y)-1)))
-
 
 typedef int phandle_t;
 
@@ -133,7 +133,7 @@ kvamap_extract(vaddr_t va, vsize_t len, 
 
 	*new_va  = va;
 	for (i = 0; (len > 0) && (i < MAXSEGNUM); i++) {
-		if (kvamap[i].start == NULL)
+		if (kvamap[i].start == 0)
 			break;
 		if ((kvamap[i].start <= va) && (va < kvamap[i].end)) {
 			uint64_t va_len = kvamap[i].end - va;
@@ -155,7 +155,7 @@ kvamap_enter(uint64_t va, uint64_t len)
 
 	DPRINTF(("kvamap_enter: %d@%p\n", (int)len, (void*)(u_long)va));
 	for (i = 0; (len > 0) && (i < MAXSEGNUM); i++) {
-		if (kvamap[i].start == NULL) {
+		if (kvamap[i].start == 0) {
 			kvamap[i].start = va;
 			kvamap[i].end = va + len;
 			break;



CVS commit: src/sys/arch/sparc/stand/ofwboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:24:02 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

- Stop redefining roundup2().
- Compare kvamap->start (uint64_t) with 0 instead of NULL.
- Include  explicitly.

Thanks gson@ for notification.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c

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



  1   2   3   4   5   6   7   8   9   10   >