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

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

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

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

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

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

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


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

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

Modified files:

Index: src/sys/arch/x86/x86/viac7temp.c
diff -u src/sys/arch/x86/x86/viac7temp.c:1.8 src/sys/arch/x86/x86/viac7temp.c:1.8.32.1
--- src/sys/arch/x86/x86/viac7temp.c:1.8	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/x86/x86/viac7temp.c	Thu Apr 18 16:40:17 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: viac7temp.c,v 1.8.32.1 2024/04/18 16:40:17 martin Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viac7temp.c,v 1.8.32.1 2024/04/18 16:40:17 martin Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 27315;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}



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

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

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

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

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

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

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


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

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



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

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

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

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

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

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

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


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

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

Modified files:

Index: src/sys/arch/vax/vsa/ncr.c
diff -u src/sys/arch/vax/vsa/ncr.c:1.49.4.1 src/sys/arch/vax/vsa/ncr.c:1.49.4.2
--- src/sys/arch/vax/vsa/ncr.c:1.49.4.1	Mon Mar 23 10:06:26 2020
+++ src/sys/arch/vax/vsa/ncr.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $	*/
+/*	$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.2 2024/02/19 09:02:16 martin Exp $");
 
 #include 
 #include 
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49
 #include 
 #include 
 #include 
+#include 
 
 #include "ioconf.h"
 
@@ -209,6 +210,16 @@ si_vsbus_attach(device_t parent, device_
 	else
 		target = (clk_page[0xbc/2] >> tweak) & 7;
 
+	/*
+	 * Explicitly enable upto 128KB "Big DMA" on KA420.
+	 * (It looks KA420 firmware doesn't enable it on network boot)
+	 */
+#define STC_MODE_OFF	(KA420_STC_MODE - KA420_SCS_BASE)
+	if (vax_boardtype == VAX_BTYP_420) {
+		bus_space_write_1(ncr_sc->sc_regt, ncr_sc->sc_regh,
+		STC_MODE_OFF, 1);
+	}
+
 	aprint_normal("\n");
 	aprint_normal_dev(self, "NCR5380, SCSI ID %d\n", target);
 

Index: src/sys/arch/vax/vsa/vsbus.c
diff -u src/sys/arch/vax/vsa/vsbus.c:1.65 src/sys/arch/vax/vsa/vsbus.c:1.65.4.1
--- src/sys/arch/vax/vsa/vsbus.c:1.65	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/vax/vsa/vsbus.c	Mon Feb 19 09:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $ */
+/*	$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $ */
 /*
  * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65 2018/09/03 16:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vsbus.c,v 1.65.4.1 2024/02/19 09:02:16 martin Exp $");
 
 #include "opt_cputype.h"
 
@@ -146,7 +146,6 @@ vsbus_attach(device_t parent, device_t s
 		} else {
 			dbase = KA420_DMA_BASE;
 			dsize = KA420_DMA_SIZE;
-			*(char *)(sc->sc_vsregs + 0xe0) = 1; /* Big DMA */
 		}
 		sc->sc_dmasize = dsize;
 		sc->sc_dmaaddr = uvm_km_alloc(kernel_map, dsize, 0,



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

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

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

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

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

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

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


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

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



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

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

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

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

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

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


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

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

Modified files:

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



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

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

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

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

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

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


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

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



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

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:32:23 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: dmac_0448.h scsi_1185.c

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

sys/arch/newsmips/dev/dmac_0448.h: revision 1.7
sys/arch/newsmips/dev/scsi_1185.c: revision 1.25

Use DELAY(9), not empty for() loop that could be optimized out.
No visible regression on NWS-3260 and NWS-3470.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.96.1 src/sys/arch/newsmips/dev/dmac_0448.h
cvs rdiff -u -r1.23 -r1.23.20.1 src/sys/arch/newsmips/dev/scsi_1185.c

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

Modified files:

Index: src/sys/arch/newsmips/dev/dmac_0448.h
diff -u src/sys/arch/newsmips/dev/dmac_0448.h:1.6 src/sys/arch/newsmips/dev/dmac_0448.h:1.6.96.1
--- src/sys/arch/newsmips/dev/dmac_0448.h:1.6	Wed Apr  9 15:40:30 2008
+++ src/sys/arch/newsmips/dev/dmac_0448.h	Mon Nov 27 19:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmac_0448.h,v 1.6 2008/04/09 15:40:30 tsutsui Exp $	*/
+/*	$NetBSD: dmac_0448.h,v 1.6.96.1 2023/11/27 19:32:23 martin Exp $	*/
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -120,7 +120,7 @@ struct	dm_stat {
 	unsigned int dm_width;
 };
 
-#define	DMAC_WAIT	nops(10)
+#define	DMAC_WAIT	DELAY(1)
 
 #define PINTEN		0xbfc80001
 # define	DMA_INTEN	0x10

Index: src/sys/arch/newsmips/dev/scsi_1185.c
diff -u src/sys/arch/newsmips/dev/scsi_1185.c:1.23 src/sys/arch/newsmips/dev/scsi_1185.c:1.23.20.1
--- src/sys/arch/newsmips/dev/scsi_1185.c:1.23	Thu Jul 21 19:49:58 2016
+++ src/sys/arch/newsmips/dev/scsi_1185.c	Mon Nov 27 19:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsi_1185.c,v 1.23 2016/07/21 19:49:58 christos Exp $	*/
+/*	$NetBSD: scsi_1185.c,v 1.23.20.1 2023/11/27 19:32:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.23 2016/07/21 19:49:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.23.20.1 2023/11/27 19:32:23 martin Exp $");
 
 #define	__INTR_PRIVATE
 #include 
@@ -116,10 +116,9 @@ __KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,
 #define	splscsi splsc
 
 #if defined(__mips__) && defined(CPU_SINGLE)
-#define nops(x)		{ int __i; for (__i = 0; __i < (x); __i++) ; }
-#define	DMAC_WAIT0	;
+#define	DMAC_WAIT0	__nothing
 #else
-#define	DMAC_WAIT0	DMAC_WAIT
+#define	DMAC_WAIT0	DMAC_WAIT	/* see MODIFY HISTORY comment above */
 #endif
 
 #ifdef DMAC_MAP_INIT



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

2023-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 27 19:32:23 UTC 2023

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: dmac_0448.h scsi_1185.c

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

sys/arch/newsmips/dev/dmac_0448.h: revision 1.7
sys/arch/newsmips/dev/scsi_1185.c: revision 1.25

Use DELAY(9), not empty for() loop that could be optimized out.
No visible regression on NWS-3260 and NWS-3470.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.96.1 src/sys/arch/newsmips/dev/dmac_0448.h
cvs rdiff -u -r1.23 -r1.23.20.1 src/sys/arch/newsmips/dev/scsi_1185.c

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



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

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

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

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

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

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

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

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

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


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

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

Modified files:

Index: src/sys/arch/newsmips/conf/GENERIC
diff -u src/sys/arch/newsmips/conf/GENERIC:1.137.2.1 src/sys/arch/newsmips/conf/GENERIC:1.137.2.2
--- src/sys/arch/newsmips/conf/GENERIC:1.137.2.1	Sun Nov  5 17:30:38 2023
+++ src/sys/arch/newsmips/conf/GENERIC	Sun Nov  5 17:47:07 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.137.2.1 2023/11/05 17:30:38 martin Exp $
+# $NetBSD: GENERIC,v 1.137.2.2 2023/11/05 17:47:07 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/newsmips/conf/std.newsmip
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.137.2.1 $"
+#ident 		"GENERIC-$Revision: 1.137.2.2 $"
 
 maxusers	16
 
@@ -166,6 +166,7 @@ zstty4	at zsc2 channel 0		# tty04
 zstty5	at zsc2 channel 1		# tty05
 
 fb0	at hb0 addr 0x8800		# NWB-253 frame buffer
+fb0	at hb0 addr 0x9020		# LCD-MONO on NWS-32x0
 wsdisplay0 at fb? console ?
 
 xafb*	at ap?# "XA" frame buffer

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

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

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

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

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

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

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

Make local functions and variables static.

Use proper C99 exact-width integer types.

Use C99 designated struct initializers.

Remove trailing spaces and tab.

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

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

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


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

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



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

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

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: DEJIKO GENERIC WAPIKO

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

sys/arch/newsmips/conf/GENERIC: revision 1.144
sys/arch/newsmips/conf/WAPIKO: revision 1.50
sys/arch/newsmips/conf/DEJIKO: revision 1.36

Use FONT_SONY12x24 for Sony fans, rather than Gallant fonts used on Sun.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/newsmips/conf/DEJIKO
cvs rdiff -u -r1.137 -r1.137.2.1 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/newsmips/conf/WAPIKO

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

Modified files:

Index: src/sys/arch/newsmips/conf/DEJIKO
diff -u src/sys/arch/newsmips/conf/DEJIKO:1.35 src/sys/arch/newsmips/conf/DEJIKO:1.35.4.1
--- src/sys/arch/newsmips/conf/DEJIKO:1.35	Wed Aug  1 20:04:13 2018
+++ src/sys/arch/newsmips/conf/DEJIKO	Sun Nov  5 17:30:38 2023
@@ -1,4 +1,4 @@
-# 	$NetBSD: DEJIKO,v 1.35 2018/08/01 20:04:13 maxv Exp $
+# 	$NetBSD: DEJIKO,v 1.35.4.1 2023/11/05 17:30:38 martin Exp $
 #
 #	Dejiko's sekai-seifuku NEWS5000 nyo.
 
@@ -45,7 +45,8 @@ include 	"conf/compat_netbsd14.config"
 # wscons options
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 config	netbsd root on ? type ?
 

Index: src/sys/arch/newsmips/conf/GENERIC
diff -u src/sys/arch/newsmips/conf/GENERIC:1.137 src/sys/arch/newsmips/conf/GENERIC:1.137.2.1
--- src/sys/arch/newsmips/conf/GENERIC:1.137	Fri Apr 26 21:40:31 2019
+++ src/sys/arch/newsmips/conf/GENERIC	Sun Nov  5 17:30:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.137 2019/04/26 21:40:31 sevan Exp $
+# $NetBSD: GENERIC,v 1.137.2.1 2023/11/05 17:30:38 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/newsmips/conf/std.newsmip
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.137 $"
+#ident 		"GENERIC-$Revision: 1.137.2.1 $"
 
 maxusers	16
 
@@ -124,7 +124,8 @@ options 	NFS_BOOT_DHCP
 # wscons options
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 config	netbsd	root on ? type ?
 

Index: src/sys/arch/newsmips/conf/WAPIKO
diff -u src/sys/arch/newsmips/conf/WAPIKO:1.49 src/sys/arch/newsmips/conf/WAPIKO:1.49.4.1
--- src/sys/arch/newsmips/conf/WAPIKO:1.49	Wed Aug  1 20:04:13 2018
+++ src/sys/arch/newsmips/conf/WAPIKO	Sun Nov  5 17:30:38 2023
@@ -1,7 +1,7 @@
 #
 # NEWS3400 config file
 #
-# 	$NetBSD: WAPIKO,v 1.49 2018/08/01 20:04:13 maxv Exp $
+# 	$NetBSD: WAPIKO,v 1.49.4.1 2023/11/05 17:30:38 martin Exp $
 #
 include 	"arch/newsmips/conf/std.newsmips"
 
@@ -84,7 +84,8 @@ sd*	at scsibus? target ? lun ?	# SCSI di
 
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	FONT_GALLANT12x22
+#options 	FONT_GALLANT12x22
+options 	FONT_SONY12x24
 
 wsdisplay0 at fb? console ?
 wskbd0	at kb? console ?



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

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

Modified Files:
src/sys/arch/newsmips/conf [netbsd-9]: DEJIKO GENERIC WAPIKO

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

sys/arch/newsmips/conf/GENERIC: revision 1.144
sys/arch/newsmips/conf/WAPIKO: revision 1.50
sys/arch/newsmips/conf/DEJIKO: revision 1.36

Use FONT_SONY12x24 for Sony fans, rather than Gallant fonts used on Sun.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/arch/newsmips/conf/DEJIKO
cvs rdiff -u -r1.137 -r1.137.2.1 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/newsmips/conf/WAPIKO

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



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

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

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: zs_hb.c

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

sys/arch/newsmips/dev/zs_hb.c: revision 1.30

Don't use aprint_error(9) for a normal attach message.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.20.1 src/sys/arch/newsmips/dev/zs_hb.c

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

Modified files:

Index: src/sys/arch/newsmips/dev/zs_hb.c
diff -u src/sys/arch/newsmips/dev/zs_hb.c:1.27 src/sys/arch/newsmips/dev/zs_hb.c:1.27.20.1
--- src/sys/arch/newsmips/dev/zs_hb.c:1.27	Thu Jul 21 19:49:58 2016
+++ src/sys/arch/newsmips/dev/zs_hb.c	Sun Nov  5 17:08:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs_hb.c,v 1.27 2016/07/21 19:49:58 christos Exp $	*/
+/*	$NetBSD: zs_hb.c,v 1.27.20.1 2023/11/05 17:08:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.27 2016/07/21 19:49:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.27.20.1 2023/11/05 17:08:08 martin Exp $");
 
 #include 
 #include 
@@ -214,7 +214,7 @@ zs_hb_attach(device_t parent, device_t s
 #endif
 	}
 
-	aprint_error(" level %d\n", intlevel);
+	aprint_normal(" level %d\n", intlevel);
 
 	zs_delay = zs_hb_delay;
 



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

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

Modified Files:
src/sys/arch/newsmips/dev [netbsd-9]: zs_hb.c

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

sys/arch/newsmips/dev/zs_hb.c: revision 1.30

Don't use aprint_error(9) for a normal attach message.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.20.1 src/sys/arch/newsmips/dev/zs_hb.c

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



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

2023-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 10 18:55:58 UTC 2023

Modified Files:
src/sys/arch/evbmips/conf [netbsd-9]: INSTALL_CI20

Log Message:
Additionally pull up following revision(s) (requested by he in ticket #1747):

sys/arch/evbmips/conf/INSTALL_CI20: revision 1.3

INSTALL_CI20: bump ramdisk image size since contents grew a bit recently.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.26.1 src/sys/arch/evbmips/conf/INSTALL_CI20

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/evbmips/conf/INSTALL_CI20
diff -u src/sys/arch/evbmips/conf/INSTALL_CI20:1.1 src/sys/arch/evbmips/conf/INSTALL_CI20:1.1.26.1
--- src/sys/arch/evbmips/conf/INSTALL_CI20:1.1	Mon Apr  6 14:18:09 2015
+++ src/sys/arch/evbmips/conf/INSTALL_CI20	Tue Oct 10 18:55:58 2023
@@ -1,8 +1,8 @@
-# $NetBSD: INSTALL_CI20,v 1.1 2015/04/06 14:18:09 joerg Exp $
+# $NetBSD: INSTALL_CI20,v 1.1.26.1 2023/10/10 18:55:58 martin Exp $
 
 include		"arch/evbmips/conf/CI20"
 
-#ident 		"INSTALL_CI20-$Revision: 1.1 $"
+#ident 		"INSTALL_CI20-$Revision: 1.1.26.1 $"
 
 # Enable the hooks used for initializing the root memory-disk.
 # The ramdisk size must be kept in sync manually with the size of
@@ -11,4 +11,4 @@ pseudo-device	md# memory disk device
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# force root on memory disk
 options 	MEMORY_DISK_SERVER=0		# no userspace memory disk
-options 	MEMORY_DISK_ROOT_SIZE=12288	# size of memory disk, in blocks
+options 	MEMORY_DISK_ROOT_SIZE=12416	# size of memory disk, in blocks



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

2023-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 10 18:55:58 UTC 2023

Modified Files:
src/sys/arch/evbmips/conf [netbsd-9]: INSTALL_CI20

Log Message:
Additionally pull up following revision(s) (requested by he in ticket #1747):

sys/arch/evbmips/conf/INSTALL_CI20: revision 1.3

INSTALL_CI20: bump ramdisk image size since contents grew a bit recently.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.26.1 src/sys/arch/evbmips/conf/INSTALL_CI20

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



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

2023-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 10 13:07:51 UTC 2023

Modified Files:
src/sys/arch/evbmips/conf [netbsd-9]: INSTALL_OMSAL400

Log Message:
Additionally pull up the following revision for ticket #397 to fix
the build:

sys/arch/evbmips/conf/INSTALL_OMSAL400  1.4

Make more room for ramdisk image (which recently grew a bit)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.70.1 src/sys/arch/evbmips/conf/INSTALL_OMSAL400

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/evbmips/conf/INSTALL_OMSAL400
diff -u src/sys/arch/evbmips/conf/INSTALL_OMSAL400:1.2 src/sys/arch/evbmips/conf/INSTALL_OMSAL400:1.2.70.1
--- src/sys/arch/evbmips/conf/INSTALL_OMSAL400:1.2	Fri Feb  6 18:50:27 2009
+++ src/sys/arch/evbmips/conf/INSTALL_OMSAL400	Tue Oct 10 13:07:50 2023
@@ -1,8 +1,8 @@
-# $NetBSD: INSTALL_OMSAL400,v 1.2 2009/02/06 18:50:27 jym Exp $
+# $NetBSD: INSTALL_OMSAL400,v 1.2.70.1 2023/10/10 13:07:50 martin Exp $
 
 include		"arch/evbmips/conf/OMSAL400"
 
-#ident 		"INSTALL_OMSAL400-$Revision: 1.2 $"
+#ident 		"INSTALL_OMSAL400-$Revision: 1.2.70.1 $"
 
 # Enable the hooks used for initializing the root memory-disk.
 # The ramdisk size must be kept in sync manually with the size of
@@ -11,5 +11,5 @@ pseudo-device	md# memory disk device
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# force root on memory disk
 options 	MEMORY_DISK_SERVER=0		# no userspace memory disk
-options 	MEMORY_DISK_ROOT_SIZE=8192	# size of memory disk, in blocks
+options 	MEMORY_DISK_ROOT_SIZE=8350	# size of memory disk, in blocks
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode



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

2023-10-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct 10 13:07:51 UTC 2023

Modified Files:
src/sys/arch/evbmips/conf [netbsd-9]: INSTALL_OMSAL400

Log Message:
Additionally pull up the following revision for ticket #397 to fix
the build:

sys/arch/evbmips/conf/INSTALL_OMSAL400  1.4

Make more room for ramdisk image (which recently grew a bit)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.70.1 src/sys/arch/evbmips/conf/INSTALL_OMSAL400

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



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

2023-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 15:40:22 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-9]: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot [netbsd-9]: eficpufunc.c eficpufunc.h

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

sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.22
sys/arch/i386/stand/efiboot/eficpufunc.c: revision 1.1
sys/arch/i386/stand/efiboot/eficpufunc.h: revision 1.1
sys/arch/i386/stand/efiboot/eficons.c: revision 1.13
sys/arch/i386/stand/efiboot/eficons.c: revision 1.14

efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.
``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.
Proposed as PR port-amd64/57523

efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.1 -r1.15.2.2 \
src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.6.6.4 -r1.6.6.5 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1.4.2 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.h

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



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

2023-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 15:40:22 UTC 2023

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-9]: Makefile.efiboot eficons.c
Added Files:
src/sys/arch/i386/stand/efiboot [netbsd-9]: eficpufunc.c eficpufunc.h

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

sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.22
sys/arch/i386/stand/efiboot/eficpufunc.c: revision 1.1
sys/arch/i386/stand/efiboot/eficpufunc.h: revision 1.1
sys/arch/i386/stand/efiboot/eficons.c: revision 1.13
sys/arch/i386/stand/efiboot/eficons.c: revision 1.14

efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.
``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.
Proposed as PR port-amd64/57523

efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.1 -r1.15.2.2 \
src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.6.6.4 -r1.6.6.5 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r0 -r1.1.4.2 src/sys/arch/i386/stand/efiboot/eficpufunc.c \
src/sys/arch/i386/stand/efiboot/eficpufunc.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/i386/stand/efiboot/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.15.2.1 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.15.2.2
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.15.2.1	Tue Sep 17 19:32:00 2019
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Fri Sep 15 15:40:22 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.15.2.1 2019/09/17 19:32:00 martin Exp $
+# $NetBSD: Makefile.efiboot,v 1.15.2.2 2023/09/15 15:40:22 martin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -14,9 +14,11 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 
 SOURCES= start.S boot.c conf.c devopen.c dev_net.c self_reloc.c panic.c
 SOURCES+= efiboot.c efichar.c eficons.c efidelay.c efidev.c
+SOURCES+= eficpufunc.c
 SOURCES+= efidisk.c efidisk_ll.c efigetsecs.c efimemory.c
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
+LIBI386SRCS+= comio_direct.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
 LIBI386SRCS+= exec_multiboot1.c exec_multiboot2.c
 # use our own nfs implementation

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.6.6.4 src/sys/arch/i386/stand/efiboot/eficons.c:1.6.6.5
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.6.6.4	Tue Feb 25 19:25:19 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Sep 15 15:40:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.6.6.4 2020/02/25 19:25:19 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.6.6.5 2023/09/15 15:40:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -26,9 +26,12 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 
+#include 
+
 #include "efiboot.h"
 
 #include "bootinfo.h"
@@ -60,6 +63,8 @@ static u_char serbuf[16];
 static int serbuf_read = 0;
 static int serbuf_write = 0;
 
+static int raw_com_addr = 0;
+
 static void eficons_init_video(void);
 static void efi_switch_video_to_text_mode(void);
 
@@ -76,6 +81,12 @@ static int efi_com_putc(int);
 static int efi_com_status(int);
 static int efi_com_waitforinputevent(uint64_t);
 
+static int raw_com_init(int, int);
+static int raw_com_getc(void);
+static int raw_com_putc(int);
+static int raw_com_status(int);
+static int raw_com_waitforinputevent(uint64_t);
+
 static int efi_find_gop_mode(char *);
 
 static int iodev;
@@ -134,11 +145,8 @@ ok:
 	case CONSDEV_COM3:
 		iodev = dev;
 		btinfo_console.addr = ioport;
-		if (btinfo_console.addr == 0) {
-			if (!efi_valid_com(iodev))
-goto nocom;
+		if (btinfo_console.addr == 0)
 			btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
-		}
 		if (speed != 0)
 			btinfo_console.speed = speed;
 		efi_com_init(btinfo_console.addr, btinfo_console.speed);
@@ -149,8 +157,6 @@ ok:
 	case CONSDEV_COM2KBD:
 	case CONSDEV_COM3KBD:
 		iodev = dev - CONSDEV_COM0KBD + CONSDEV_COM0;
-		if (!efi_valid_com(iodev))
-			goto nocom;
 		btinfo_console.addr = getcomaddr(iodev - CONSDEV_COM0);
 
 		efi_cons_putc('0' + iodev - CONSDEV_COM0);
@@ -868,7 +874,7 @@ efi_com_init(int addr, int speed)
 		return 0;
 
 	if (!efi_valid_com(iodev))
-		return 0;
+		return raw_com_init(addr, speed);
 
 	serio = serios[iodev - CONSDEV_COM0];
 
@@ -884,6 +890,7 @@ efi_com_init(int addr, int speed)
 		}
 

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

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:09:09 UTC 2023

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

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

sys/arch/x86/pci/pci_machdep.c: revision 1.94

Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/arch/x86/pci/pci_machdep.c

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



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

2023-08-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 23 17:09:09 UTC 2023

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

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

sys/arch/x86/pci/pci_machdep.c: revision 1.94

Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.86 src/sys/arch/x86/pci/pci_machdep.c:1.86.2.1
--- src/sys/arch/x86/pci/pci_machdep.c:1.86	Fri May 24 14:28:48 2019
+++ src/sys/arch/x86/pci/pci_machdep.c	Wed Aug 23 17:09:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.86 2019/05/24 14:28:48 nonaka Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.86.2.1 2023/08/23 17:09:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.86 2019/05/24 14:28:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.86.2.1 2023/08/23 17:09:09 martin Exp $");
 
 #include 
 #include 
@@ -485,6 +485,8 @@ pci_attach_hook(device_t parent, device_
 	pci_chipset_tag_t pc = pba->pba_pc;
 	pcitag_t tag;
 	pcireg_t id, class;
+	int i;
+	bool havehb = false;
 #endif
 
 	if (pba->pba_bus == 0)
@@ -502,19 +504,25 @@ pci_attach_hook(device_t parent, device_
 #ifdef __HAVE_PCI_MSI_MSIX
 	/*
 	 * In order to decide whether the system supports MSI we look
-	 * at the host bridge, which should be device 0 function 0 on
-	 * bus 0.  It is better to not enable MSI on systems that
+	 * at the host bridge, which should be device 0 on bus 0.
+	 * It is better to not enable MSI on systems that
 	 * support it than the other way around, so be conservative
 	 * here.  So we don't enable MSI if we don't find a host
 	 * bridge there.  We also deliberately don't enable MSI on
 	 * chipsets from low-end manifacturers like VIA and SiS.
 	 */
-	tag = pci_make_tag(pc, 0, 0, 0);
-	id = pci_conf_read(pc, tag, PCI_ID_REG);
-	class = pci_conf_read(pc, tag, PCI_CLASS_REG);
-
-	if (PCI_CLASS(class) != PCI_CLASS_BRIDGE ||
-	PCI_SUBCLASS(class) != PCI_SUBCLASS_BRIDGE_HOST)
+	for (i = 0; i <= 7; i++) {
+		tag = pci_make_tag(pc, 0, 0, i);
+		id = pci_conf_read(pc, tag, PCI_ID_REG);
+		class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+
+		if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
+		PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) {
+			havehb = true;
+			break;
+		}
+	}
+	if (havehb == false)
 		return;
 
 	/* VMware and KVM use old chipset, but they can use MSI/MSI-X */



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

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:10:21 UTC 2023

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

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

sys/arch/x86/pci/amdzentemp.c: revision 1.20
sys/arch/x86/pci/amdsmn.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.19

Add Zen4 Ryzen "Phoenix" support.
Add Zen2 Mendocino APU support.
Add Zen4 Phoenix support.


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.4 -r1.5.2.5 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.4 -r1.9.2.5 src/sys/arch/x86/pci/amdzentemp.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5.2.4 src/sys/arch/x86/pci/amdsmn.c:1.5.2.5
--- src/sys/arch/x86/pci/amdsmn.c:1.5.2.4	Wed Jun 21 18:56:58 2023
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Aug 22 16:10:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.5.2.5 2023/08/22 16:10:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.5 2023/08/22 16:10:21 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -112,6 +112,11 @@ static const struct pciid {
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F19_7X_RC,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 static int amdsmn_match(device_t, cfdata_t, void *);

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9.2.4 src/sys/arch/x86/pci/amdzentemp.c:1.9.2.5
--- src/sys/arch/x86/pci/amdzentemp.c:1.9.2.4	Wed Jun 21 18:56:58 2023
+++ src/sys/arch/x86/pci/amdzentemp.c	Tue Aug 22 16:10:21 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.9.2.5 2023/08/22 16:10:21 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.5 2023/08/22 16:10:21 martin Exp $ ");
 
 #include 
 #include 
@@ -370,15 +370,19 @@ amdzentemp_probe_ccd_sensors17h(struct a
 {
 	int maxreg;
 
-	sc->sc_ccd_offset = 0x154;
-
 	switch (model) {
 	case 0x00 ... 0x2f: /* Zen1, Zen+ */
+		sc->sc_ccd_offset = 0x154;
 		maxreg = 4;
 		break;
 	case 0x30 ... 0x3f: /* Zen2 TR (Castle Peak)/EPYC (Rome) */
 	case 0x60 ... 0x7f: /* Zen2 Ryzen (Renoir APU, Matisse) */
 	case 0x90 ... 0x9f: /* Zen2 Ryzen (Van Gogh APU) */
+		sc->sc_ccd_offset = 0x154;
+		maxreg = 8;
+		break;
+	case 0xa0 ... 0xaf: /* Zen2 Ryzen (Mendocino APU) */
+		sc->sc_ccd_offset = 0x300;
 		maxreg = 8;
 		break;
 	default:
@@ -403,6 +407,7 @@ amdzentemp_probe_ccd_sensors19h(struct a
 		maxreg = 8;
 		break;
 	case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */
+	case 0x70 ... 0x7f: /* Zen4 Ryzen "Phoenix" */
 		sc->sc_ccd_offset = 0x308;
 		maxreg = 8;
 		break;



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

2023-08-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 22 16:10:21 UTC 2023

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

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

sys/arch/x86/pci/amdzentemp.c: revision 1.20
sys/arch/x86/pci/amdsmn.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.19

Add Zen4 Ryzen "Phoenix" support.
Add Zen2 Mendocino APU support.
Add Zen4 Phoenix support.


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.4 -r1.5.2.5 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.4 -r1.9.2.5 src/sys/arch/x86/pci/amdzentemp.c

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



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

2023-08-10 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Aug 10 10:30:28 UTC 2023

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

Log Message:
Pull up the following revisions(s) (requested by riastradh in ticket #1713):
sys/arch/xen/x86/xen_ipi.c: revision 1.41 via patch

xen/x86: Fix 'mach cpu N' in ddb by passing the right pointer to a
struct intrframe to IPI handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/xen/x86/xen_ipi.c

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



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

2023-08-10 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Aug 10 10:30:28 UTC 2023

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

Log Message:
Pull up the following revisions(s) (requested by riastradh in ticket #1713):
sys/arch/xen/x86/xen_ipi.c: revision 1.41 via patch

xen/x86: Fix 'mach cpu N' in ddb by passing the right pointer to a
struct intrframe to IPI handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/xen/x86/xen_ipi.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/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.32 src/sys/arch/xen/x86/xen_ipi.c:1.32.4.1
--- src/sys/arch/xen/x86/xen_ipi.c:1.32	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/x86/xen_ipi.c	Thu Aug 10 10:30:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.32 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.32.4.1 2023/08/10 10:30:28 sborrill Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.32 2019/02/02 12:32:55 cherry Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.32.4.1 2023/08/10 10:30:28 sborrill Exp $");
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.32 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.32.4.1 2023/08/10 10:30:28 sborrill Exp $");
 
 #include "opt_ddb.h"
 
@@ -87,16 +87,13 @@ static void (*ipifunc[XEN_NIPIS])(struct
 };
 
 static int
-xen_ipi_handler(void *arg)
+xen_ipi_handler(void *arg, struct intrframe *regs)
 {
 	uint32_t pending;
 	int bit;
 	struct cpu_info *ci;
-	struct intrframe *regs;
 
 	ci = curcpu();
-	regs = arg;
-	
 	pending = atomic_swap_32(>ci_ipis, 0);
 
 	KDASSERT((pending >> XEN_NIPIS) == 0);
@@ -138,7 +135,8 @@ xen_ipi_init(void)
 	device_xname(ci->ci_dev));
 
 	if (xen_intr_establish_xname(-1, _pic, evtchn, IST_LEVEL, IPL_HIGH,
-		xen_ipi_handler, ci, true, intr_xname) == NULL) {
+		(int (*)(void *))xen_ipi_handler, ci, true, intr_xname)
+	== NULL) {
 		panic("%s: unable to register ipi handler\n", __func__);
 		/* NOTREACHED */
 	}



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 13:14:39 UTC 2023

Modified Files:
src/sys/arch/mips/include [netbsd-9]: asm.h

Log Message:
Apply patch, requested by riastradh in ticket #1676:

sys/arch/mips/include/asm.h (apply patch)

Additional build fix for mips1 (and mips2?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.55.4.1 src/sys/arch/mips/include/asm.h:1.55.4.2
--- src/sys/arch/mips/include/asm.h:1.55.4.1	Mon Jul 31 13:44:15 2023
+++ src/sys/arch/mips/include/asm.h	Tue Aug  1 13:14:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.55.4.1 2023/07/31 13:44:15 martin Exp $	*/
+/*	$NetBSD: asm.h,v 1.55.4.2 2023/08/01 13:14:39 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -512,8 +512,13 @@ _C_LABEL(x):
 #endif
 
 /* XXX pullup more mips barrier improvements here */
+#if defined(MULTIPROCESSOR) && (__mips >= 3 || !defined(__mips_o32))
 #define	SYNC_ACQ	sync
 #define	SYNC_REL	sync
+#else
+#define	SYNC_ACQ	/* nothing */
+#define	SYNC_REL	/* nothing */
+#endif
 
 /*
  * Store-before-load barrier.  Do not use this unless you know what



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 13:14:39 UTC 2023

Modified Files:
src/sys/arch/mips/include [netbsd-9]: asm.h

Log Message:
Apply patch, requested by riastradh in ticket #1676:

sys/arch/mips/include/asm.h (apply patch)

Additional build fix for mips1 (and mips2?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 src/sys/arch/mips/include/asm.h

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



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

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

Modified Files:
src/sys/arch/alpha/alpha [netbsd-9]: locore.s multiproc.s

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

sys/arch/alpha/include/asm.h: revision 1.45 (patch)
(also applied to locore.s and multiproc.s)

alpha: Add missing barriers in cpu_switchto.
Details in comments.
(accidently missed in original commit for ticket #264)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/alpha/alpha/locore.s
cvs rdiff -u -r1.13 -r1.13.92.1 src/sys/arch/alpha/alpha/multiproc.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/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.123 src/sys/arch/alpha/alpha/locore.s:1.123.4.1
--- src/sys/arch/alpha/alpha/locore.s:1.123	Sat Apr  6 03:06:24 2019
+++ src/sys/arch/alpha/alpha/locore.s	Mon Jul 31 17:59:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.123 2019/04/06 03:06:24 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.123.4.1 2023/07/31 17:59:23 martin Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.123 2019/04/06 03:06:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.123.4.1 2023/07/31 17:59:23 martin Exp $");
 
 #include "assym.h"
 
@@ -686,8 +686,28 @@ LEAF(cpu_switchto, 0)
 
 	SWITCH_CONTEXT/* swap the context */
 
-	GET_CPUINFO
+	/*
+	 * Issue barriers to coordinate mutex_exit on this CPU with
+	 * mutex_vector_enter on another CPU.
+	 *
+	 * 1. Any prior mutex_exit by oldlwp must be visible to other
+	 *CPUs before we set ci_curlwp := newlwp on this one,
+	 *requiring a store-before-store barrier.
+	 *
+	 * 2. ci_curlwp := newlwp must be visible on all other CPUs
+	 *before any subsequent mutex_exit by newlwp can even test
+	 *whether there might be waiters, requiring a
+	 *store-before-load barrier.
+	 *
+	 * See kern_mutex.c for details -- this is necessary for
+	 * adaptive mutexes to detect whether the lwp is on the CPU in
+	 * order to safely block without requiring atomic r/m/w in
+	 * mutex_exit.
+	 */
+	GET_CPUINFO/* v0 = curcpu() */
+	wmb		/* store-before-store XXX patch out if !MP? */
 	stq	s2, CPU_INFO_CURLWP(v0)		/* curlwp = l */
+	mb		/* store-before-load XXX patch out if !MP? */
 
 	/*
 	 * Now running on the new PCB.

Index: src/sys/arch/alpha/alpha/multiproc.s
diff -u src/sys/arch/alpha/alpha/multiproc.s:1.13 src/sys/arch/alpha/alpha/multiproc.s:1.13.92.1
--- src/sys/arch/alpha/alpha/multiproc.s:1.13	Mon Apr 28 20:23:10 2008
+++ src/sys/arch/alpha/alpha/multiproc.s	Mon Jul 31 17:59:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: multiproc.s,v 1.13 2008/04/28 20:23:10 martin Exp $ */
+/* $NetBSD: multiproc.s,v 1.13.92.1 2023/07/31 17:59:23 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-__KERNEL_RCSID(5, "$NetBSD: multiproc.s,v 1.13 2008/04/28 20:23:10 martin Exp $")
+__KERNEL_RCSID(5, "$NetBSD: multiproc.s,v 1.13.92.1 2023/07/31 17:59:23 martin Exp $")
 
 /*
  * Multiprocessor glue code.
@@ -65,6 +65,11 @@ NESTED_NOPROFILE(cpu_spinup_trampoline,0
 
 	/* Switch to this CPU's idle thread. */
 	ldq	a0, CPU_INFO_IDLE_LWP(s0)
+	/*
+	 * No membar needed because we're not switching from a
+	 * previous lwp, and the idle lwp we're switching to can't be
+	 * holding locks already; see cpu_switchto.
+	 */
 	stq	a0, CPU_INFO_CURLWP(s0)	/* set curlwp */
 	ldq	a0, L_MD_PCBPADDR(a0)
 	SWITCH_CONTEXT



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

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

Modified Files:
src/sys/arch/alpha/alpha [netbsd-9]: locore.s multiproc.s

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

sys/arch/alpha/include/asm.h: revision 1.45 (patch)
(also applied to locore.s and multiproc.s)

alpha: Add missing barriers in cpu_switchto.
Details in comments.
(accidently missed in original commit for ticket #264)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/arch/alpha/alpha/locore.s
cvs rdiff -u -r1.13 -r1.13.92.1 src/sys/arch/alpha/alpha/multiproc.s

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



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 15:39:24 UTC 2023

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

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

sys/arch/xen/x86/hypervisor_machdep.c: revision 1.46 (patch)

xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/arch/xen/x86/hypervisor_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/xen/x86/hypervisor_machdep.c
diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.36 src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.2.1
--- src/sys/arch/xen/x86/hypervisor_machdep.c:1.36	Thu May  9 17:09:51 2019
+++ src/sys/arch/xen/x86/hypervisor_machdep.c	Mon Jul 31 15:39:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor_machdep.c,v 1.36 2019/05/09 17:09:51 bouyer Exp $	*/
+/*	$NetBSD: hypervisor_machdep.c,v 1.36.2.1 2023/07/31 15:39:23 martin Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36 2019/05/09 17:09:51 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.2.1 2023/07/31 15:39:23 martin Exp $");
 
 #include 
 #include 
@@ -168,6 +168,8 @@ stipending(void)
 	volatile struct vcpu_info *vci;
 	int ret;
 
+	kpreempt_disable();
+
 	ret = 0;
 	ci = curcpu();
 	vci = ci->ci_vcpu;
@@ -211,6 +213,8 @@ stipending(void)
 		ci->ci_xpending);
 #endif
 
+	kpreempt_enable();
+
 	return (ret);
 }
 



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 15:39:24 UTC 2023

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

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

sys/arch/xen/x86/hypervisor_machdep.c: revision 1.46 (patch)

xen/x86: Need kpreempt_disable/enable around curcpu() access.

This is called with `hardware' interrupts enabled (between sti and
cli), so presumably preemption is possible here.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/arch/xen/x86/hypervisor_machdep.c

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



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 15:29:23 UTC 2023

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

Log Message:
Apply patch, requested by riastradh in ticket #1680, pulling up
the essential part of

sys/arch/xen/xen/if_xennet_xenbus.c 1.129

xennet(4): Add missing membar.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.4.1 src/sys/arch/xen/xen/if_xennet_xenbus.c

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



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 15:29:23 UTC 2023

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

Log Message:
Apply patch, requested by riastradh in ticket #1680, pulling up
the essential part of

sys/arch/xen/xen/if_xennet_xenbus.c 1.129

xennet(4): Add missing membar.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.4.1 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.86 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.86.4.1
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.86	Sat Mar  9 08:42:25 2019
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Jul 31 15:29:23 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.86 2019/03/09 08:42:25 maxv Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.86.4.1 2023/07/31 15:29:23 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.86 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.86.4.1 2023/07/31 15:29:23 martin Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -967,7 +967,7 @@ again:
 	sc->sc_tx_ring.sring->rsp_event =
 	resp_prod + ((sc->sc_tx_ring.sring->req_prod - resp_prod) >> 1) + 1;
 	ifp->if_timer = 0;
-	xen_wmb();
+	xen_mb();
 	if (resp_prod != sc->sc_tx_ring.sring->rsp_prod)
 		goto again;
 end:



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 14:56:20 UTC 2023

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

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

sys/arch/xen/x86/xen_intr.c: revision 1.31

xen_intr.c: Use kpreempt_disable/enable around access to curcpu().

curcpu() is not otherwise guaranteed to be stable at these points.

While here, nix nonsensical membars.  This need only be synchronized
with interrupts on the same CPU.

Proposed on port-xen:
https://mail-index.netbsd.org/port-xen/2022/07/13/msg010250.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/xen/x86/xen_intr.c

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

Modified files:

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.17 src/sys/arch/xen/x86/xen_intr.c:1.17.2.1
--- src/sys/arch/xen/x86/xen_intr.c:1.17	Fri Jun  7 12:43:52 2019
+++ src/sys/arch/xen/x86/xen_intr.c	Mon Jul 31 14:56:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.17 2019/06/07 12:43:52 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.17.2.1 2023/07/31 14:56:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.17 2019/06/07 12:43:52 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.17.2.1 2023/07/31 14:56:19 martin Exp $");
 
 #include 
 #include 
@@ -103,19 +103,28 @@ xen_spllower(int nlevel)
 void
 x86_disable_intr(void)
 {
+
+	kpreempt_disable();
 	curcpu()->ci_vcpu->evtchn_upcall_mask = 1;
-	x86_lfence();
+	kpreempt_enable();
+
+	__insn_barrier();
 }
 
 void
 x86_enable_intr(void)
 {
-	volatile struct vcpu_info *_vci = curcpu()->ci_vcpu;
+	struct cpu_info *ci;
+
+	__insn_barrier();
+
+	kpreempt_disable();
+	ci = curcpu();
+	ci->ci_vcpu->evtchn_upcall_mask = 0;
 	__insn_barrier();
-	_vci->evtchn_upcall_mask = 0;
-	x86_lfence(); /* unmask then check (avoid races) */
-	if (__predict_false(_vci->evtchn_upcall_pending))
+	if (__predict_false(ci->ci_vcpu->evtchn_upcall_pending))
 		hypervisor_force_callback();
+	kpreempt_enable();
 }
 
 #endif /* !XENPVHVM */
@@ -123,20 +132,27 @@ x86_enable_intr(void)
 u_long
 xen_read_psl(void)
 {
+	u_long psl;
+
+	kpreempt_disable();
+	psl = curcpu()->ci_vcpu->evtchn_upcall_mask;
+	kpreempt_enable();
 
-	return (curcpu()->ci_vcpu->evtchn_upcall_mask);
+	return psl;
 }
 
 void
 xen_write_psl(u_long psl)
 {
-	struct cpu_info *ci = curcpu();
+	struct cpu_info *ci;
 
+	kpreempt_disable();
+	ci = curcpu();
 	ci->ci_vcpu->evtchn_upcall_mask = psl;
-	xen_rmb();
-	if (ci->ci_vcpu->evtchn_upcall_pending && psl == 0) {
+	__insn_barrier();
+	if (__predict_false(ci->ci_vcpu->evtchn_upcall_pending) && psl == 0)
 		hypervisor_force_callback();
-	}
+	kpreempt_enable();
 }
 
 void *



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

2023-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 31 14:56:20 UTC 2023

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

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

sys/arch/xen/x86/xen_intr.c: revision 1.31

xen_intr.c: Use kpreempt_disable/enable around access to curcpu().

curcpu() is not otherwise guaranteed to be stable at these points.

While here, nix nonsensical membars.  This need only be synchronized
with interrupts on the same CPU.

Proposed on port-xen:
https://mail-index.netbsd.org/port-xen/2022/07/13/msg010250.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/xen/x86/xen_intr.c

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



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

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

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

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

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

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

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

PR kern/57240

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

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

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

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

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

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

sparc: Add missing barriers in cpu_switchto.

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

vax: Note where cpu_switchto needs barriers.

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


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

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.1 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.2
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.11.4.1	Tue Dec 24 17:30:28 2019
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Mon Jul 31 13:44:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.11.4.2 2023/07/31 13:44:15 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.11.4.2 2023/07/31 13:44:15 martin Exp $")
 
 /*
  * At 

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

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

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

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

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

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

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

PR kern/57240

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

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

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

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

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

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

sparc: Add missing barriers in cpu_switchto.

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

vax: Note where cpu_switchto needs barriers.

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


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

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



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

2023-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 30 11:41:48 UTC 2023

Modified Files:
src/sys/arch/mips/cavium/dev [netbsd-9]: octeon_rnm.c

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

sys/arch/mips/cavium/dev/octeon_rnm.c: revision 1.16 (patch)

octrnm(4): Raise delay on startup.

According to CN50XX-HRM-V0.99E and CN78XX-HM-0.99E:
The entropy is provided by the jitter of 125 of 128 free-running
oscillators XORed into a 128-bit LFSR.  The LFSR accumulates entropy
over 81 cycles, after which it is fed into a SHA-1 engine.
[...]
The SHA-1 engine runs once every 81 cycles.
[...]
The hardware produces new 64-bit random number every 81 cycles.

The last sentence means that we only need to wait 81 cycles _between_
consecutive SHA-1 outputs (which isn't relevant anyway because we
reconfigure it into raw mode later), but the first two quotes might
mean that we need to wait 81+81 cycles for the _first_ output to be
produced on boot when running the self-test.

Now, in this case, the self-test is run with the LFSR unhooked, by
clearing the RNM_CTL_STATUS[ENT_EN] bit, so that SHA-1 is computed
from a known input -- this is really just paranoia to make sure that
_some_ functions of the device (which is conjured out of thin air at
a fixed virtual address, with no firmware bindings to guide us)
behave as we expect.

And it's not clear if it really does take 81+81 cycles for the first
SHA-1 output to appear when the LFSR isn't feeding into it anyway.

But experimentally, delay of 81+81 cycles seems to work whereas a
delay of only 81 cycles crashes.
PR kern/57280


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/arch/mips/cavium/dev/octeon_rnm.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/mips/cavium/dev/octeon_rnm.c
diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.2.4.2 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.2.4.3
--- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.2.4.2	Tue May 19 17:39:04 2020
+++ src/sys/arch/mips/cavium/dev/octeon_rnm.c	Sun Jul 30 11:41:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_rnm.c,v 1.2.4.2 2020/05/19 17:39:04 martin Exp $	*/
+/*	$NetBSD: octeon_rnm.c,v 1.2.4.3 2023/07/30 11:41:48 martin Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.2.4.2 2020/05/19 17:39:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.2.4.3 2023/07/30 11:41:48 martin Exp $");
 
 #include 
 #include 
@@ -118,7 +118,8 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c
 //#define	OCTEON_RNM_DEBUG
 
 #define	ENT_DELAY_CLOCK 8	/* cycles for each 64-bit RO sample batch */
-#define	RNG_DELAY_CLOCK 81	/* cycles for each SHA-1 output */
+#define	LFSR_DELAY_CLOCK 81	/* cycles to fill LFSR buffer */
+#define	SHA1_DELAY_CLOCK 81	/* cycles to compute SHA-1 output */
 #define	NROGROUPS	16
 #define	RNG_FIFO_WORDS	(512/sizeof(uint64_t))
 
@@ -195,7 +196,7 @@ octeon_rnm_attach(device_t parent, devic
 	 */
 	octeon_rnm_reset(sc);
 	octeon_rnm_conditioned_deterministic(sc);
-	octeon_rnm_delay(RNG_DELAY_CLOCK*1);
+	octeon_rnm_delay(LFSR_DELAY_CLOCK + SHA1_DELAY_CLOCK);
 	sample = octeon_rnm_load(sc);
 	if (sample != expected)
 		aprint_error_dev(self, "self-test: read %016"PRIx64","



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

2023-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 30 11:41:48 UTC 2023

Modified Files:
src/sys/arch/mips/cavium/dev [netbsd-9]: octeon_rnm.c

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

sys/arch/mips/cavium/dev/octeon_rnm.c: revision 1.16 (patch)

octrnm(4): Raise delay on startup.

According to CN50XX-HRM-V0.99E and CN78XX-HM-0.99E:
The entropy is provided by the jitter of 125 of 128 free-running
oscillators XORed into a 128-bit LFSR.  The LFSR accumulates entropy
over 81 cycles, after which it is fed into a SHA-1 engine.
[...]
The SHA-1 engine runs once every 81 cycles.
[...]
The hardware produces new 64-bit random number every 81 cycles.

The last sentence means that we only need to wait 81 cycles _between_
consecutive SHA-1 outputs (which isn't relevant anyway because we
reconfigure it into raw mode later), but the first two quotes might
mean that we need to wait 81+81 cycles for the _first_ output to be
produced on boot when running the self-test.

Now, in this case, the self-test is run with the LFSR unhooked, by
clearing the RNM_CTL_STATUS[ENT_EN] bit, so that SHA-1 is computed
from a known input -- this is really just paranoia to make sure that
_some_ functions of the device (which is conjured out of thin air at
a fixed virtual address, with no firmware bindings to guide us)
behave as we expect.

And it's not clear if it really does take 81+81 cycles for the first
SHA-1 output to appear when the LFSR isn't feeding into it anyway.

But experimentally, delay of 81+81 cycles seems to work whereas a
delay of only 81 cycles crashes.
PR kern/57280


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/sys/arch/mips/cavium/dev/octeon_rnm.c

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



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 11:01:15 UTC 2023

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

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

sys/arch/x86/x86/coretemp.c: revision 1.38-1.39 (patch)

coretemp(4): Change limits of Tjmax.
 - Change the lower limit from 70 to 60. At least, some BIOSes can change
   the value down to 62.
 - Change the upper limit from 110 to 120. At least, some BIOSes can change
   the value up to 115.
 - Print error message when rdmsr(TEMPERATURE_TARGET) failed.
 - When Tjmax exceeded the limit, print warning message and use the value
   as it is.
 - KNF.


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

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

Modified files:

Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.36.4.1 src/sys/arch/x86/x86/coretemp.c:1.36.4.2
--- src/sys/arch/x86/x86/coretemp.c:1.36.4.1	Wed Jul 15 14:02:36 2020
+++ src/sys/arch/x86/x86/coretemp.c	Sat Jul 29 11:01:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.36.4.1 2020/07/15 14:02:36 martin Exp $ */
+/* $NetBSD: coretemp.c,v 1.36.4.2 2023/07/29 11:01:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36.4.1 2020/07/15 14:02:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36.4.2 2023/07/29 11:01:14 martin Exp $");
 
 #include 
 #include 
@@ -102,6 +102,10 @@ __KERNEL_RCSID(0, "$NetBSD: coretemp.c,v
 
 #define MSR_TEMP_TARGET_READOUT		__BITS(16, 23)
 
+#define TJMAX_DEFAULT		100
+#define TJMAX_LIMIT_LOW		60
+#define TJMAX_LIMIT_HIGH	120
+
 static int	coretemp_match(device_t, cfdata_t, void *);
 static void	coretemp_attach(device_t, device_t, void *);
 static int	coretemp_detach(device_t, int);
@@ -259,16 +263,15 @@ coretemp_tjmax(device_t self)
 {
 	struct coretemp_softc *sc = device_private(self);
 	struct cpu_info *ci = sc->sc_ci;
-	uint32_t model, stepping;
 	uint64_t msr;
+	uint32_t model, stepping;
+	int tjmax;
 
 	model = CPUID_TO_MODEL(ci->ci_signature);
 	stepping = CPUID_TO_STEPPING(ci->ci_signature);
 
-	/*
-	 * Use 100C as the initial value.
-	 */
-	sc->sc_tjmax = 100;
+	/* Set the initial value. */
+	sc->sc_tjmax = TJMAX_DEFAULT;
 
 	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
 		/*
@@ -304,20 +307,20 @@ coretemp_tjmax(device_t self)
 			sc->sc_tjmax = 90;
 	} else {
 notee:
-		/*
-		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,
-		 * but only consider the interval [70, 110] C as valid.
-		 * It is not fully known which CPU models have the MSR.
-		 */
-		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, ) == EFAULT)
-			return;
-
-		msr = __SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT);
-
-		if (msr >= 70 && msr <= 110) {
-			sc->sc_tjmax = msr;
+		/* Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET. */
+		if (rdmsr_safe(MSR_TEMPERATURE_TARGET, ) == EFAULT) {
+			aprint_error_dev(sc->sc_dev,
+			"Failed to read TEMPERATURE_TARGET MSR. "
+			"Use the default (%d)\n", sc->sc_tjmax);
 			return;
 		}
+
+		tjmax = __SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT);
+		if ((tjmax < TJMAX_LIMIT_LOW) || (tjmax > TJMAX_LIMIT_HIGH))
+			aprint_error_dev(sc->sc_dev,
+			"WARNING: Tjmax(%d) might exceeded the limit.\n",
+			tjmax);
+		sc->sc_tjmax = tjmax;
 	}
 }
 
@@ -334,7 +337,7 @@ coretemp_refresh(struct sysmon_envsys *s
 static void
 coretemp_refresh_xcall(void *arg0, void *arg1)
 {
-struct coretemp_softc *sc = arg0;
+	struct coretemp_softc *sc = arg0;
 	envsys_data_t *edata = arg1;
 	uint64_t msr;
 



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 11:01:15 UTC 2023

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

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

sys/arch/x86/x86/coretemp.c: revision 1.38-1.39 (patch)

coretemp(4): Change limits of Tjmax.
 - Change the lower limit from 70 to 60. At least, some BIOSes can change
   the value down to 62.
 - Change the upper limit from 110 to 120. At least, some BIOSes can change
   the value up to 115.
 - Print error message when rdmsr(TEMPERATURE_TARGET) failed.
 - When Tjmax exceeded the limit, print warning message and use the value
   as it is.
 - KNF.


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

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



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 09:48:51 UTC 2023

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

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

sys/arch/x86/include/specialreg.h   1.204-1.206, 1.208

- Add Intel CPUID 0x07 %ecx bit 24 BUS_LOCK_DETECT.
- Add AMD CPUID 0x8008 %ebx bit 30 IBPB_RET and CPUID 0x800a
  %edx bit 29 BusLockThreshold.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.14 -r1.150.2.15 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.14 src/sys/arch/x86/include/specialreg.h:1.150.2.15
--- src/sys/arch/x86/include/specialreg.h:1.150.2.14	Tue Jul 25 09:12:35 2023
+++ src/sys/arch/x86/include/specialreg.h	Sat Jul 29 09:48:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.14 2023/07/25 09:12:35 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.15 2023/07/29 09:48:51 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -466,6 +466,7 @@
 #define CPUID_SEF_MAWAU		__BITS(21, 17) /* MAWAU for BND{LD,ST}X */
 #define CPUID_SEF_RDPID		__BIT(22) /* RDPID and IA32_TSC_AUX */
 #define CPUID_SEF_KL		__BIT(23) /* Key Locker */
+#define CPUID_SEF_BUS_LOCK_DETECT __BIT(24) /* OS bus-lock detection */
 #define CPUID_SEF_CLDEMOTE	__BIT(25) /* Cache line demote */
 #define CPUID_SEF_MOVDIRI	__BIT(27) /* MOVDIRI instruction */
 #define CPUID_SEF_MOVDIR64B	__BIT(28) /* MOVDIR64B instruction */
@@ -480,7 +481,7 @@
 	"b\14AVX512_BITALG\0" "b\15TME_EN\0" "b\16AVX512_VPOPCNTDQ\0"	  \
 	"b\20LA57\0"			  \
 	"f\21\5MAWAU\0"			"b\26RDPID\0"	"b\27KL\0"	  \
-			"b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	  \
+	"b\30BUS_LOCK_DETECT" "b\31CLDEMOTE\0"		"b\33MOVDIRI\0"	  \
 	"b\34MOVDIR64B\0" "b\35ENQCMD\0" "b\36SGXLC\0"	"b\37PKS\0"
 
 /* %ecx = 0, %edx */
@@ -889,6 +890,7 @@
 #define CPUID_CAPEX_CPPC	   __BIT(27) /* Collaborative Processor Perf. Control */
 #define CPUID_CAPEX_PSFD	   __BIT(28) /* Predictive Store Forward Dis */
 #define CPUID_CAPEX_BTC_NO	   __BIT(29) /* Branch Type Confusion NO */
+#define CPUID_CAPEX_IBPB_RET	   __BIT(30) /* Clear RET address predictor */
 
 #define CPUID_CAPEX_FLAGS	"\20"	   \
 	"\1CLZERO"	"\2IRPERF"	"\3XSAVEERPTR"	"\4INVLPGB"	   \
@@ -899,7 +901,7 @@
 			"\24IBRS_SAMEMODE" \
 	"\25EFER_LSMSLE_UN""\30PPIN"	   \
 	"\31SSBD"	"\32VIRT_SSBD"	"\33SSB_NO"	"\34CPPC"	   \
-	"\35PSFD"	"\36BTC_NO"
+	"\35PSFD"	"\36BTC_NO"	"\37IBPB_RET"
 
 /* %ecx */
 #define CPUID_CAPEX_PerfTscSize	__BITS(17,16)	/* Perf. tstamp counter size */
@@ -939,6 +941,7 @@
 #define CPUID_AMD_SVM_IBSVIRT	  __BIT(26) /* IBS Virtualization */
 #define CPUID_AMD_SVM_XLVTOFFFLTCHG   __BIT(27) /* Ext LVToffset FLT changed */
 #define CPUID_AMD_SVM_VMCBADRCHKCHG   __BIT(28) /* VMCB addr check changed */
+#define CPUID_AMD_SVM_BUSLOCKTHRESH   __BIT(29) /* Bus Lock Threshold */
 
 
 #define CPUID_AMD_SVM_FLAGS	 "\20"	\
@@ -951,7 +954,7 @@
 	"\21" "VGIF"	"\22" "GMET"	"\23x2AVIC"	"\24SSSCHECK"	\
 	"\25" "SPEC_CTRL" "\26" "ROGPT"		"\30HOST_MCE_OVERRIDE"	\
 	"\31" "TLBICTL"	"\32VNMI" "\33IBSVIRT" "\34ExtLvtOffsetFaultChg" \
-	"\35VmcbAddrChkChg"
+	"\35VmcbAddrChkChg" "\36BusLockThreshold"
 
 /*
  * AMD Instruction-Based Sampling Capabilities.
@@ -1065,7 +1068,7 @@
 #define CPUID_AMDEXT2_FSRC	  __BIT(11) /* Fast Short Rep Cmpsb */
 #define CPUID_AMDEXT2_PREFETCHCTL __BIT(13) /* Prefetch control MSR */
 #define CPUID_AMDEXT2_CPUIDUSRDIS __BIT(17) /* CPUID dis. for non-priv. soft */
-#define CPUID_AMDEXT2_EPSF	  __BIT(18) /* Enhanced Predective Store Fwd */
+#define CPUID_AMDEXT2_EPSF	  __BIT(18) /* Enhanced Predictive Store Fwd */
 
 #define CPUID_AMDEXT2_FLAGS	 "\20"	  \
 	"\1NoNestedDataBp" "\2FsGsKernelGsBaseNonSerializing"		  \



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

2023-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 29 09:48:51 UTC 2023

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

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

sys/arch/x86/include/specialreg.h   1.204-1.206, 1.208

- Add Intel CPUID 0x07 %ecx bit 24 BUS_LOCK_DETECT.
- Add AMD CPUID 0x8008 %ebx bit 30 IBPB_RET and CPUID 0x800a
  %edx bit 29 BusLockThreshold.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.14 -r1.150.2.15 src/sys/arch/x86/include/specialreg.h

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



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:55:41 UTC 2023

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

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

sys/arch/xen/xen/xen_clock.c: revision 1.10
sys/arch/xen/xen/xen_clock.c: revision 1.12
(applied to sys/arch/xen/xen/clock.c)

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.

Pointed out by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/xen/xen/clock.c

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

Modified files:

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.78 src/sys/arch/xen/xen/clock.c:1.78.4.1
--- src/sys/arch/xen/xen/clock.c:1.78	Sat Mar  9 09:51:29 2019
+++ src/sys/arch/xen/xen/clock.c	Thu Jul 27 16:55:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $	*/
+/*	$NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78 2019/03/09 09:51:29 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.78.4.1 2023/07/27 16:55:41 martin Exp $");
 
 #include 
 #include 
@@ -769,7 +769,6 @@ xen_resumeclocks(struct cpu_info *ci)
 	if (ci->ci_xen_timer_intrhand == NULL)
 		panic("failed to establish timer interrupt handler");
 
-	hypervisor_unmask_event(evtch);
 
 	aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch);
 
@@ -783,10 +782,12 @@ xen_resumeclocks(struct cpu_info *ci)
 	/* Pretend the last hardclock happened right now.  */
 	ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns();
 
+
 	/* Arm the one-shot timer.  */
 	error = HYPERVISOR_set_timer_op(ci->ci_xen_hardclock_systime_ns +
 	NS_PER_TICK);
 	KASSERT(error == 0);
+	hypervisor_unmask_event(evtch);
 
 	/* We'd better not have switched CPUs.  */
 	KASSERT(ci == curcpu());



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:55:41 UTC 2023

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

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

sys/arch/xen/xen/xen_clock.c: revision 1.10
sys/arch/xen/xen/xen_clock.c: revision 1.12
(applied to sys/arch/xen/xen/clock.c)

Unmask event after VCPUOP_stop_periodic_timer and
initializing ci->ci_xen_hardclock_systime_ns, to avoid a possible race with
xen_timer_handler()

Unmask event after arming the one-shot timer in clock initialisation,
to avoid a possible race with xen_timer_handler() updating
ci_xen_hardclock_systime_ns while we're reading it.

Pointed out by Taylor R Campbell


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.78.4.1 src/sys/arch/xen/xen/clock.c

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



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:40:50 UTC 2023

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

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

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/x86/x86/errata.c

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

Modified files:

Index: src/sys/arch/x86/x86/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.26.2.1 src/sys/arch/x86/x86/errata.c:1.26.2.2
--- src/sys/arch/x86/x86/errata.c:1.26.2.1	Tue Jul 25 09:12:36 2023
+++ src/sys/arch/x86/x86/errata.c	Thu Jul 27 16:40:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $	*/
+/*	$NetBSD: errata.c,v 1.26.2.2 2023/07/27 16:40:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26.2.1 2023/07/25 09:12:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.26.2.2 2023/07/27 16:40:50 martin Exp $");
 
 #include 
 #include 
@@ -96,8 +96,8 @@ static const u_int cpurevs[] = {
 	ML_A1, 0x0730F01, ZP_B1, 0x0800F11, ZP_B2, 0x0800F12,
 	PiR_B2, 0x0800F82, Rome_B0, 0x0830F10,
 	/* XXX client Zen2 names aren't known yet. */
-	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F80, Z2_Luc, 0x0870F10,
-	Z2_Mat, 0x0890F70, Z2_VG, 0x0890F80, Z2_Men, 0x08A0F10,
+	Z2_XB, 0x0840F70, Z2_Ren, 0x0860F01, Z2_Luc, 0x0860F81,
+	Z2_Mat, 0x0870F10, Z2_VG, 0x0890F02, Z2_Men, 0x08A0F00,
 	Milan_B1, 0x0A00F11, Milan_B2, 0x0A00F12,
 	Genoa_B1, 0x0A10F11,
 	OINK



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

2023-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 27 16:40:50 UTC 2023

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

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

sys/arch/x86/x86/errata.c: revision 1.32

fix the cpuids for the zen2 client CPUs.

i'm not exactly how i came up with the values i had, though one
of them was still valid and matched my test systems.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/sys/arch/x86/x86/errata.c

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



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 11:34:37 UTC 2023

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

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

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

x86/fpu: Align savefpu to 64 bytes in fpuinit_mxcsr_mask.
16 bytes is not enough.

(Is this why it never worked on Xen some years back?  Got lucky and
accidentally had 64-byte alignment on native x86, but not in the call
stack in Xen?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.55.2.1 src/sys/arch/x86/x86/fpu.c:1.55.2.2
--- src/sys/arch/x86/x86/fpu.c:1.55.2.1	Sun Oct 18 18:42:10 2020
+++ src/sys/arch/x86/x86/fpu.c	Tue Jul 25 11:34:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.55.2.1 2020/10/18 18:42:10 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.55.2.2 2023/07/25 11:34:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.55.2.1 2020/10/18 18:42:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.55.2.2 2023/07/25 11:34:37 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -153,7 +153,7 @@ void
 fpuinit_mxcsr_mask(void)
 {
 #ifndef XENPV
-	union savefpu fpusave __aligned(16);
+	union savefpu fpusave __aligned(64);
 	u_long psl;
 
 	memset(, 0, sizeof(fpusave));



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

2023-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 25 11:34:37 UTC 2023

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

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

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

x86/fpu: Align savefpu to 64 bytes in fpuinit_mxcsr_mask.
16 bytes is not enough.

(Is this why it never worked on Xen some years back?  Got lucky and
accidentally had 64-byte alignment on native x86, but not in the call
stack in Xen?)


To generate a diff of this commit:
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/arch/x86/x86/fpu.c

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



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

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

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

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

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

x86: turn off zenbleed chicken bit on Zen2 cpus.

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

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

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

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


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

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



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

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

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

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

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

x86: turn off zenbleed chicken bit on Zen2 cpus.

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

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

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

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


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

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.13 src/sys/arch/x86/include/specialreg.h:1.150.2.14
--- src/sys/arch/x86/include/specialreg.h:1.150.2.13	Wed Jun 21 19:04:19 2023
+++ src/sys/arch/x86/include/specialreg.h	Tue Jul 25 09:12:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.13 2023/06/21 19:04:19 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.14 2023/07/25 09:12:35 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -1393,6 +1393,7 @@
 #define MSR_DE_CFG	0xc0011029
 #define 	DE_CFG_ERRATA_721	0x0001
 #define 	DE_CFG_LFENCE_SERIALIZE	__BIT(1)
+#define 	DE_CFG_ERRATA_ZENBLEED	__BIT(9)
 #define 	DE_CFG_ERRATA_1021	__BIT(13)
 
 #define MSR_BU_CFG2	0xc001102a

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



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

2023-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 30 17:22:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx [netbsd-9]: boot1.c

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

sys/arch/i386/stand/bootxx/boot1.c: revision 1.22

Primary bootstrap is now able to read a GPT inside RAIDframe.

Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set
with the limitation that the FFS filesystem had to start at bloc 0 in the
RAID. That allowed inner RAID partitionning with a disklabel, but not with
a GPT.

When booting on a RAID-1 RAIDframe, primary bootstrap now first try a
filesystem at bloc 0 of the RAID as before. On failure, it tries to
read a GPT and load secondary bootstrap from, by priority;
1) the first partition with the bootme attribute set
2) the first partition of type FFS, LFS, CCD or CGD
3) the first partition present in the GPT


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.64.1 src/sys/arch/i386/stand/bootxx/boot1.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/bootxx/boot1.c
diff -u src/sys/arch/i386/stand/bootxx/boot1.c:1.20 src/sys/arch/i386/stand/bootxx/boot1.c:1.20.64.1
--- src/sys/arch/i386/stand/bootxx/boot1.c:1.20	Thu Jan  6 01:08:48 2011
+++ src/sys/arch/i386/stand/bootxx/boot1.c	Fri Jun 30 17:22:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot1.c,v 1.20 2011/01/06 01:08:48 jakllsch Exp $	*/
+/*	$NetBSD: boot1.c,v 1.20.64.1 2023/06/30 17:22:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,15 +30,17 @@
  */
 
 #include 
-__RCSID("$NetBSD: boot1.c,v 1.20 2011/01/06 01:08:48 jakllsch Exp $");
+__RCSID("$NetBSD: boot1.c,v 1.20.64.1 2023/06/30 17:22:17 martin Exp $");
 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 	/* For RF_PROTECTED_SECTORS */
 
 #define XSTR(x) #x
@@ -49,6 +51,9 @@ static daddr_t bios_sector;
 static struct biosdisk_ll d;
 
 const char *boot1(uint32_t, uint64_t *);
+#ifndef NO_GPT
+static daddr_t gpt_lookup(daddr_t);
+#endif
 extern void putstr(const char *);
 
 extern struct disklabel ptn_disklabel;
@@ -90,6 +95,17 @@ boot1(uint32_t biosdev, uint64_t *sector
 	fd = ob();
 	if (fd != -1)
 		goto done;
+
+#ifndef NO_GPT
+	/*
+	 * Test for a GPT inside the RAID
+	 */
+	bios_sector += gpt_lookup(bios_sector);
+	fd = ob();
+	if (fd != -1)
+		goto done;
+#endif
+
 	/*
 	 * Nothing at the start of the MBR partition, fallback on
 	 * partition 'a' from the disklabel in this MBR partition.
@@ -145,3 +161,146 @@ blkdevstrategy(void *devdata, int flag, 
 
 	return 0;
 }
+
+#ifndef NO_GPT
+static int
+is_unused(struct gpt_ent *ent)
+{
+	const struct uuid unused = GPT_ENT_TYPE_UNUSED;
+
+	return (memcmp(ent->ent_type, , sizeof(unused)) == 0);
+}
+
+static int
+is_bootable(struct gpt_ent *ent)
+{
+	/* GPT_ENT_TYPE_NETBSD_RAID omitted as we are already in a RAID */
+	const struct uuid bootable[] = {
+		GPT_ENT_TYPE_NETBSD_FFS,
+		GPT_ENT_TYPE_NETBSD_LFS,
+		GPT_ENT_TYPE_NETBSD_CCD,
+		GPT_ENT_TYPE_NETBSD_CGD,
+	};
+	int i;
+
+	for (i = 0; i < sizeof(bootable) / sizeof(*bootable); i++) {
+		if (memcmp(ent->ent_type, [i],
+		sizeof(struct uuid)) == 0)
+			return 1;
+	}
+
+	return 0;
+}
+
+static daddr_t
+gpt_lookup(daddr_t sector)
+{
+	char buf[BIOSDISK_DEFAULT_SECSIZE];
+	struct mbr_sector *pmbr;	
+	const char gpt_hdr_sig[] = GPT_HDR_SIG;
+	struct gpt_hdr *hdr;
+	struct gpt_ent *ent;
+	uint32_t nents;
+	uint32_t entsz;
+	uint32_t entries_per_sector;
+	uint32_t sectors_per_entry;
+	uint64_t firstpart_lba = 0;
+	uint64_t bootable_lba = 0;
+	uint64_t bootme_lba = 0;
+	int i, j;
+
+	/*
+	 * Look for a PMBR
+	 */
+	if (readsects(, sector, 1, buf, 1) != 0)
+		return 0;
+
+	pmbr = (struct mbr_sector *)buf;
+
+	if (pmbr->mbr_magic != htole16(MBR_MAGIC))
+		return 0;
+
+	if (pmbr->mbr_parts[0].mbrp_type != MBR_PTYPE_PMBR)
+		return 0;
+
+	sector++; /* skip PMBR */
+
+	/*
+	 * Look for a GPT header
+	 * Space is scarce, we do not check CRC.
+	 */
+	if (readsects(, sector, 1, buf, 1) != 0)
+		return 0;
+
+	hdr = (struct gpt_hdr *)buf;
+
+	if (memcmp(gpt_hdr_sig, hdr->hdr_sig, sizeof(hdr->hdr_sig)) != 0)
+		return 0;
+
+	if (hdr->hdr_revision != htole32(GPT_HDR_REVISION))
+		return 0;
+
+	if (le32toh(hdr->hdr_size) > BIOSDISK_DEFAULT_SECSIZE)
+		return 0;
+
+	nents = le32toh(hdr->hdr_entries);
+	entsz = le32toh(hdr->hdr_entsz);
+
+	sector++; /* skip GPT header */
+
+	/*
+	 * Read partition table
+	 *
+	 * According to UEFI specification section 5.3.2, entries
+	 * are 128 * (2^n) bytes long. The most common scenario is
+	 * 128 bytes (n = 0) where there are 4 entries per sector.
+	 * If n > 2, then entries spans multiple sectors, but they
+	 * remain sector-aligned.
+	 */
+	entries_per_sector = BIOSDISK_DEFAULT_SECSIZE / entsz;
+	if (entries_per_sector == 0)
+		entries_per_sector = 1;
+
+	

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

2023-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun 30 17:22:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/bootxx [netbsd-9]: boot1.c

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

sys/arch/i386/stand/bootxx/boot1.c: revision 1.22

Primary bootstrap is now able to read a GPT inside RAIDframe.

Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set
with the limitation that the FFS filesystem had to start at bloc 0 in the
RAID. That allowed inner RAID partitionning with a disklabel, but not with
a GPT.

When booting on a RAID-1 RAIDframe, primary bootstrap now first try a
filesystem at bloc 0 of the RAID as before. On failure, it tries to
read a GPT and load secondary bootstrap from, by priority;
1) the first partition with the bootme attribute set
2) the first partition of type FFS, LFS, CCD or CGD
3) the first partition present in the GPT


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.64.1 src/sys/arch/i386/stand/bootxx/boot1.c

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



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

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

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.7 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.8
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.7	Mon Jan 23 12:23:53 2023
+++ src/sys/arch/x86/x86/procfs_machdep.c	Wed Jun 21 19:52:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.8 2023/06/21 19:52:39 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.8 2023/06/21 19:52:39 martin Exp $");
 
 #include 
 #include 
@@ -151,7 +151,7 @@ static const char * const x86_features[]
 	"avx_vnni", "avx512_bf16", NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, NULL, "lam", NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
@@ -172,7 +172,7 @@ static const char * const x86_features[]
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
 	"vgif", NULL, "x2avic", NULL, "v_spec_ctrl", NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+	NULL, "vnmi", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
 	NULL, "avx512vbmi", "umip", "pku",



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

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

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.


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

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



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

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

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

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

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

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

Bug found by Kalvis Duckmanton.

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


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

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

Modified files:

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

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



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

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

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

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

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

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

Bug found by Kalvis Duckmanton.

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


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

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



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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 18:56:58 UTC 2023

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

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

sys/arch/x86/pci/amdsmn.c: revision 1.16
sys/arch/x86/pci/amdzentemp.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.18

Reduce diff against DragonFly. No functional change.
amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh).


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.3 -r1.9.2.4 src/sys/arch/x86/pci/amdzentemp.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5.2.3 src/sys/arch/x86/pci/amdsmn.c:1.5.2.4
--- src/sys/arch/x86/pci/amdsmn.c:1.5.2.3	Tue Oct 11 18:16:20 2022
+++ src/sys/arch/x86/pci/amdsmn.c	Wed Jun 21 18:56:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.3 2022/10/11 18:16:20 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5.2.4 2023/06/21 18:56:58 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -93,7 +93,17 @@ static const struct pciid {
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
 	{
-		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC,
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, /* or F19_0X */
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F17_AX_RC, /* or F19_4X */
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
+	{
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F19_1X_RC,
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9.2.3 src/sys/arch/x86/pci/amdzentemp.c:1.9.2.4
--- src/sys/arch/x86/pci/amdzentemp.c:1.9.2.3	Mon Jan 23 12:27:33 2023
+++ src/sys/arch/x86/pci/amdzentemp.c	Wed Jun 21 18:56:58 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.4 2023/06/21 18:56:58 martin Exp $ ");
 
 #include 
 #include 
@@ -74,7 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
 #include "amdsmn.h"
 
 #define	AMD_CURTMP_RANGE_ADJUST	4900	/* in microKelvins (ie, 49C) */
-#define	AMD_CURTMP_RANGE_CHECK	__BIT(19)
 #define	F10_TEMP_CURTMP		__BITS(31,21)	/* XXX same as amdtemp.c */
 #define	F10_TEMP_CURTMP_MASK	0x7ff
 #define	F15M60_CURTMP_TJSEL	__BITS(17,16)
@@ -96,14 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdzentemp.c
  * to -49..206C.
  */
 #define	AMD_17H_CUR_TMP			0x59800
-
-/*
- * The following register set was discovered experimentally by Ondrej ÄŒerman
- * and collaborators, but is not (yet) documented in a PPR/OSRR (other than
- * the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to
- * SMU::THM).  It seems plausible and the Linux sensor folks have adopted it.
- */
-#define	AMD_17H_CCD_TMP_BASE		0x59954
+#define	AMD_17H_CUR_TMP_RANGE_SEL	__BIT(19)
 #define	AMD_17H_CCD_TMP_VALID		__BIT(11)
 
 struct amdzentemp_softc {
@@ -114,7 +106,7 @@ struct amdzentemp_softc {
 	size_t sc_sensor_len;
 	size_t sc_numsensors;
 	int32_t sc_offset;
-	uint32_t sc_ccd_tmp_base;
+	int32_t sc_ccd_offset;
 };
 
 enum {
@@ -129,6 +121,10 @@ enum {
 	CCD5,
 	CCD6,
 	CCD7,
+	CCD8,
+	CCD9,
+	CCD10,
+	CCD11,
 	CCD_MAX,
 	NUM_CCDS = CCD_MAX - CCD_BASE
 };
@@ -339,14 +335,16 @@ amdzentemp_family17_refresh(struct sysmo
 			edata->state = ENVSYS_SINVALID;
 			return;
 		}
-		minus49 = (temp & AMD_CURTMP_RANGE_CHECK) ? true : false;
+		minus49 = (temp & AMD_17H_CUR_TMP_RANGE_SEL) ?
+		true : false;
 		temp = __SHIFTOUT(temp, F10_TEMP_CURTMP);
 		break;
 	case CCD_BASE ... (CCD_MAX - 1):
 		/* Tccd */
 		i = edata->private - CCD_BASE;
 		error = amdsmn_read(sc->sc_smn,
-		sc->sc_ccd_tmp_base + (i * sizeof(temp)), );
+		AMD_17H_CUR_TMP + sc->sc_ccd_offset + (i * sizeof(temp)),
+		);
 		if (error || !ISSET(temp, AMD_17H_CCD_TMP_VALID)) {
 			edata->state = ENVSYS_SINVALID;
 			return;
@@ -372,6 +370,8 @@ amdzentemp_probe_ccd_sensors17h(struct a
 {
 	int maxreg;
 
+	sc->sc_ccd_offset = 0x154;
+
 	switch (model) {
 	case 0x00 ... 0x2f: /* Zen1, Zen+ */
 		maxreg = 4;
@@ -399,12 

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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 18:56:58 UTC 2023

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

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

sys/arch/x86/pci/amdsmn.c: revision 1.16
sys/arch/x86/pci/amdzentemp.c: revision 1.17
sys/arch/x86/pci/amdzentemp.c: revision 1.18

Reduce diff against DragonFly. No functional change.
amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh).


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.3 -r1.5.2.4 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.9.2.3 -r1.9.2.4 src/sys/arch/x86/pci/amdzentemp.c

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



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

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

Modified Files:
src/sys/arch/xen/conf [netbsd-9]: files.xen

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 src/sys/arch/xen/conf/files.xen

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

Modified files:

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.178.4.1 src/sys/arch/xen/conf/files.xen:1.178.4.2
--- src/sys/arch/xen/conf/files.xen:1.178.4.1	Wed Jul 15 17:25:08 2020
+++ src/sys/arch/xen/conf/files.xen	Mon May 15 10:25:31 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.178.4.1 2020/07/15 17:25:08 martin Exp $
+#	$NetBSD: files.xen,v 1.178.4.2 2023/05/15 10:25:31 martin Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -12,6 +12,9 @@ maxusers 2 16 128
 
 defparam opt_kernbase.h	KERNBASE
 
+# This options is of no use to Xen, but building requires its definition
+defflag opt_selfreloc.h SELFRELOC
+
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
 



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

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

Modified Files:
src/sys/arch/xen/conf [netbsd-9]: files.xen

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 src/sys/arch/xen/conf/files.xen

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



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

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 14:08:07 UTC 2023

Modified Files:
src/sys/arch/dreamcast/dev/microcode [netbsd-9]: Makefile aica_arm.c
aica_arm_locore.S aica_armcode.h

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

sys/arch/dreamcast/dev/microcode/aica_armcode.h: revision 1.5
sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.4
sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.5
sys/arch/dreamcast/dev/microcode/Makefile: revision 1.6
sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.7
sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.8

arm side of aica(4) sometimes became unresponsive when audioplay was performed 
several times.
- disabled data cache at startup.
- compiled with cross-arm-none-eabi-gcc-8.3.0nb4 of pkg.
- added memset() in asm because gcc8 (and later) detects the zero clear part in
  own bzero function and calls memset internally, and bzero were replaced with 
memset.
improve comment, update mailaddr, and remove clause 3 from my licenses.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/dreamcast/dev/microcode/Makefile
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/dreamcast/dev/microcode/aica_arm.c
cvs rdiff -u -r1.3 -r1.3.2.1 \
src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S
cvs rdiff -u -r1.4 -r1.4.2.1 \
src/sys/arch/dreamcast/dev/microcode/aica_armcode.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/dreamcast/dev/microcode/Makefile
diff -u src/sys/arch/dreamcast/dev/microcode/Makefile:1.5 src/sys/arch/dreamcast/dev/microcode/Makefile:1.5.2.1
--- src/sys/arch/dreamcast/dev/microcode/Makefile:1.5	Mon May  6 17:12:50 2019
+++ src/sys/arch/dreamcast/dev/microcode/Makefile	Thu Apr 20 14:08:07 2023
@@ -1,15 +1,16 @@
-#	$NetBSD: Makefile,v 1.5 2019/05/06 17:12:50 ryo Exp $
+#	$NetBSD: Makefile,v 1.5.2.1 2023/04/20 14:08:07 martin Exp $
 
 S	= ${.CURDIR}/../../../..
 
-CC	= ${TOOLDIR}/bin/arm--netbsdelf-gcc
-OBJCOPY	= ${TOOLDIR}/bin/arm--netbsdelf-objcopy
+TOOLDIR	?= /usr/pkg/cross-arm-none-eabi
+
+CC	= ${TOOLDIR}/bin/arm-none-eabi-gcc
+OBJCOPY	= ${TOOLDIR}/bin/arm-none-eabi-objcopy
 
 CFLAGS	= -W -Wall -mlittle-endian
 CFLAGS	+= -O3 -mcpu=arm7
 CFLAGS	+= -fomit-frame-pointer -funroll-loops -finline-functions
 CFLAGS	+= -I${S}
-#AFLAGS	= -mcpu=arm7tdmi -mthumb -mthumb-interwork -mapcs-32
 
 all: aica_armcode.h
 

Index: src/sys/arch/dreamcast/dev/microcode/aica_arm.c
diff -u src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.6 src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.6.2.1
--- src/sys/arch/dreamcast/dev/microcode/aica_arm.c:1.6	Mon May  6 17:12:50 2019
+++ src/sys/arch/dreamcast/dev/microcode/aica_arm.c	Thu Apr 20 14:08:07 2023
@@ -1,7 +1,7 @@
-/*	$NetBSD: aica_arm.c,v 1.6 2019/05/06 17:12:50 ryo Exp $	*/
+/*	$NetBSD: aica_arm.c,v 1.6.2.1 2023/04/20 14:08:07 martin Exp $	*/
 
 /*
- * Copyright (c) 2003 SHIMIZU Ryo 
+ * Copyright (c) 2003 Ryo Shimizu 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -13,8 +13,6 @@
  * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -56,11 +54,11 @@ typedef	unsigned long	uint32_t;
 #define	CH_WRITE_2(ch,off,val)	REG_WRITE_2(((ch) << 7) + (off), val)
 #define	CH_WRITE_4(ch,off,val)	REG_WRITE_4(((ch) << 7) + (off), val)
 
+void *memset(void *, int, unsigned long);
+
 void aica_init(void);
 inline int in_first_half(unsigned int);
 inline int in_second_half(unsigned int);
-void bzero_4(void *, unsigned int);
-void bzero(void *, unsigned int);
 uint32_t rate2reg(unsigned int);
 void aica_stop(void);
 void aica_main(void);
@@ -120,29 +118,6 @@ in_second_half(unsigned int loophalf)
 	return REG_READ_4(0x2814) >= loophalf;
 }
 
-
-void
-bzero_4(void *b, unsigned int len)
-{
-	uint32_t *p;
-
-	p = b;
-	len = (len + 3) & ~3;
-	for (; len != 0; len -= 4)
-		*p++ = 0;
-}
-
-void
-bzero(void *b,unsigned int len)
-{
-	uint8_t *p;
-
-	p = b;
-	for (; len != 0; len--)
-		*p++ = 0;
-}
-
-
 uint32_t
 rate2reg(unsigned int rate)
 {
@@ -197,8 +172,8 @@ aica_stop(void)
 
 	CH_WRITE_4(0, 0x00, 0x8000);
 	CH_WRITE_4(1, 0x00, 0x8000);
-	bzero_4((void *)AICA_DMABUF_LEFT, AICA_DMABUF_SIZE);
-	bzero_4((void *)AICA_DMABUF_RIGHT, AICA_DMABUF_SIZE);
+	memset((void *)AICA_DMABUF_LEFT, 0, AICA_DMABUF_SIZE);
+	memset((void 

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

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 14:08:07 UTC 2023

Modified Files:
src/sys/arch/dreamcast/dev/microcode [netbsd-9]: Makefile aica_arm.c
aica_arm_locore.S aica_armcode.h

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

sys/arch/dreamcast/dev/microcode/aica_armcode.h: revision 1.5
sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.4
sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.5
sys/arch/dreamcast/dev/microcode/Makefile: revision 1.6
sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.7
sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.8

arm side of aica(4) sometimes became unresponsive when audioplay was performed 
several times.
- disabled data cache at startup.
- compiled with cross-arm-none-eabi-gcc-8.3.0nb4 of pkg.
- added memset() in asm because gcc8 (and later) detects the zero clear part in
  own bzero function and calls memset internally, and bzero were replaced with 
memset.
improve comment, update mailaddr, and remove clause 3 from my licenses.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/dreamcast/dev/microcode/Makefile
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/dreamcast/dev/microcode/aica_arm.c
cvs rdiff -u -r1.3 -r1.3.2.1 \
src/sys/arch/dreamcast/dev/microcode/aica_arm_locore.S
cvs rdiff -u -r1.4 -r1.4.2.1 \
src/sys/arch/dreamcast/dev/microcode/aica_armcode.h

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



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

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 13:47:03 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: Makefile.luna68k

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

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/luna68k/conf/Makefile.luna68k

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

Modified files:

Index: src/sys/arch/luna68k/conf/Makefile.luna68k
diff -u src/sys/arch/luna68k/conf/Makefile.luna68k:1.29 src/sys/arch/luna68k/conf/Makefile.luna68k:1.29.4.1
--- src/sys/arch/luna68k/conf/Makefile.luna68k:1.29	Sat Sep 22 12:24:02 2018
+++ src/sys/arch/luna68k/conf/Makefile.luna68k	Thu Apr 20 13:47:02 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.luna68k,v 1.29 2018/09/22 12:24:02 rin Exp $
+#	$NetBSD: Makefile.luna68k,v 1.29.4.1 2023/04/20 13:47:02 martin Exp $
 
 # Makefile for NetBSD
 #
@@ -48,7 +48,7 @@ OPT_MODULAR=	%MODULAR%
 MD_OBJS=	locore.o
 MD_LIBS=	${FPSP}
 MD_CFILES=
-MD_SFILES=	
+MD_SFILES=	${LUNA68K}/luna68k/locore.s
 
 locore.o: ${LUNA68K}/luna68k/locore.s assym.h
 	${NORMAL_S}



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

2023-04-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 20 13:47:03 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf [netbsd-9]: Makefile.luna68k

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

sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/arch/luna68k/conf/Makefile.luna68k

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



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

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:45:37 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Backout accidental commit (branch/ticket mismatch)


To generate a diff of this commit:
cvs rdiff -u -r1.15.18.1 -r1.15.18.2 src/sys/arch/luna68k/luna68k/mainbus.c

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

Modified files:

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.2
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1	Wed Apr 19 16:43:23 2023
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Wed Apr 19 16:45:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $ */
+/* $NetBSD: mainbus.c,v 1.15.18.2 2023/04/19 16:45:37 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.2 2023/04/19 16:45:37 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ static const struct mainbus_attach_args 
 	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
 	{ "le",	0xf100, 3 },	/* Am7990 */
 	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
+	{ "xp", 0x7100, 1 },	/* HD647180XP */
 	{ "fb",	0xc110, -1 },	/* BrookTree RAMDAC */
 	{ "spc",0xe100, 2 },	/* internal MB89352 */
 	{ "spc",0xe140, 2 },	/* external MB89352 */



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

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:45:37 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

Log Message:
Backout accidental commit (branch/ticket mismatch)


To generate a diff of this commit:
cvs rdiff -u -r1.15.18.1 -r1.15.18.2 src/sys/arch/luna68k/luna68k/mainbus.c

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



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

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:43:23 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

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

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c

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

Modified files:

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.15 src/sys/arch/luna68k/luna68k/mainbus.c:1.15.18.1
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.15	Thu Mar  9 14:05:59 2017
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Wed Apr 19 16:43:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.15 2017/03/09 14:05:59 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15 2017/03/09 14:05:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15.18.1 2023/04/19 16:43:23 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ static const struct mainbus_attach_args 
 	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
 	{ "le",	0xf100, 3 },	/* Am7990 */
 	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xp", 0x7100, 1 },	/* HD647180XP */
+	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
 	{ "fb",	0xc110, -1 },	/* BrookTree RAMDAC */
 	{ "spc",0xe100, 2 },	/* internal MB89352 */
 	{ "spc",0xe140, 2 },	/* external MB89352 */



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

2023-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 19 16:43:23 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k [netbsd-9]: mainbus.c

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

sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/sys/arch/luna68k/luna68k/mainbus.c

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



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

2023-03-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar  3 17:04:17 UTC 2023

Modified Files:
src/sys/arch/arm/ti [netbsd-9]: if_cpsw.c

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1609):

sys/arch/arm/ti/if_cpsw.c: revision 1.17

Uncomment and protect sanity checks that would drop into the debugger with a
CPSW_DEBUG_DMA define.

This handles a condition where checking for DMA_RXEOQ in the received packet
results in the console being spammed with "rxeoq" messages, which soon results
in a kernel panic.  The corresponding Debugger() call for this check was
commented out.

The TI documentation ("AM335x and AMIC110 Sitara(TM) Processors Technical
Reference Manual") documents the EOQ bit thus:

(14.3.2.4.1.2.4) This bit is set by the EMAC when the EMAC identifies
that a descriptor is the last for a given packet received (also sets
the EOP flag), and there are no more descriptors in the receive list
(next descriptor pointer is NULL).  The software application can use
this bit to detect when the EMAC receiver for the corresponding channel
has halted. This is useful when the application appends additional free
buffer descriptors to an active receive queue. Note that this flag is
valid on EOP descriptors only.

Moving this check (and the offending printf() ) into a debug #ifdef results in
the BeagleBone Green surviving the nightly checks; it would always drop into
the debugger before this change.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/arch/arm/ti/if_cpsw.c

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



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

2023-03-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar  3 17:04:17 UTC 2023

Modified Files:
src/sys/arch/arm/ti [netbsd-9]: if_cpsw.c

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1609):

sys/arch/arm/ti/if_cpsw.c: revision 1.17

Uncomment and protect sanity checks that would drop into the debugger with a
CPSW_DEBUG_DMA define.

This handles a condition where checking for DMA_RXEOQ in the received packet
results in the console being spammed with "rxeoq" messages, which soon results
in a kernel panic.  The corresponding Debugger() call for this check was
commented out.

The TI documentation ("AM335x and AMIC110 Sitara(TM) Processors Technical
Reference Manual") documents the EOQ bit thus:

(14.3.2.4.1.2.4) This bit is set by the EMAC when the EMAC identifies
that a descriptor is the last for a given packet received (also sets
the EOP flag), and there are no more descriptors in the receive list
(next descriptor pointer is NULL).  The software application can use
this bit to detect when the EMAC receiver for the corresponding channel
has halted. This is useful when the application appends additional free
buffer descriptors to an active receive queue. Note that this flag is
valid on EOP descriptors only.

Moving this check (and the offending printf() ) into a debug #ifdef results in
the BeagleBone Green surviving the nightly checks; it would always drop into
the debugger before this change.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/arch/arm/ti/if_cpsw.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/ti/if_cpsw.c
diff -u src/sys/arch/arm/ti/if_cpsw.c:1.6.2.3 src/sys/arch/arm/ti/if_cpsw.c:1.6.2.4
--- src/sys/arch/arm/ti/if_cpsw.c:1.6.2.3	Thu Feb 20 14:36:38 2020
+++ src/sys/arch/arm/ti/if_cpsw.c	Fri Mar  3 17:04:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.6.2.4 2023/03/03 17:04:17 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.3 2020/02/20 14:36:38 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.4 2023/03/03 17:04:17 martin Exp $");
 
 #include 
 #include 
@@ -95,6 +95,8 @@ __KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 
 CTASSERT(powerof2(CPSW_NTXDESCS));
 CTASSERT(powerof2(CPSW_NRXDESCS));
 
+#undef CPSW_DEBUG_DMA	/* define this for DMA debugging */
+
 #define CPSW_PAD_LEN (ETHER_MIN_LEN - ETHER_CRC_LEN)
 
 #define TXDESC_NEXT(x) cpsw_txdesc_adjust((x), 1)
@@ -1159,10 +1161,12 @@ cpsw_rxintr(void *arg)
 			return 1;
 		}
 
+#if defined(CPSW_DEBUG_DMA)
 		if ((dw[3] & (CPDMA_BD_SOP | CPDMA_BD_EOP)) !=
 		(CPDMA_BD_SOP | CPDMA_BD_EOP)) {
-			//Debugger();
+			Debugger();
 		}
+#endif
 
 		bus_dmamap_sync(sc->sc_bdt, dm, 0, dm->dm_mapsize,
 		BUS_DMASYNC_POSTREAD);
@@ -1197,10 +1201,12 @@ next:
 		cpsw_rxdesc_paddr(sc, i));
 	}
 
+#if defined(CPSW_DEBUG_DMA)
 	if (sc->sc_rxeoq) {
 		device_printf(sc->sc_dev, "rxeoq\n");
-		//Debugger();
+		Debugger();
 	}
+#endif
 
 	cpsw_write_4(sc, CPSW_CPDMA_CPDMA_EOI_VECTOR, CPSW_INTROFF_RX);
 
@@ -1247,9 +1253,11 @@ cpsw_txintr(void *arg)
 
 		cpsw_get_txdesc(sc, sc->sc_txhead, );
 
+#if defined(CPSW_DEBUG_DMA)
 		if (dw[2] == 0) {
 			//Debugger();
 		}
+#endif
 
 		if (ISSET(dw[3], CPDMA_BD_SOP) == 0)
 			goto next;



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

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 19:20:45 UTC 2023

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

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

sys/arch/x86/x86/efi_machdep.c: revision 1.3
(applied to sys/arch/x86/x86/efi.c)

x86/efi: Print uuids in slightly more standard notation.

Anyone need a spare hyphen?  We had a few extras, apparently.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/arch/x86/x86/efi.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/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.19 src/sys/arch/x86/x86/efi.c:1.19.4.1
--- src/sys/arch/x86/x86/efi.c:1.19	Mon Dec  3 19:46:43 2018
+++ src/sys/arch/x86/x86/efi.c	Wed Feb 22 19:20:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $	*/
+/*	$NetBSD: efi.c,v 1.19.4.1 2023/02/22 19:20:45 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.19 2018/12/03 19:46:43 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.19.4.1 2023/02/22 19:20:45 martin Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ efi_aprintuuid(const struct uuid * uuid)
 	aprint_debug("-%04" PRIx16 "", uuid->time_mid);
 	aprint_debug("-%04" PRIx16 "", uuid->time_hi_and_version);
 	aprint_debug("-%02" PRIx8 "", uuid->clock_seq_hi_and_reserved);
-	aprint_debug("-%02" PRIx8 "", uuid->clock_seq_low);
+	aprint_debug("%02" PRIx8 "", uuid->clock_seq_low);
 	aprint_debug("-");
 	for (i = 0; i < _UUID_NODE_LEN; i++) {
 		aprint_debug("%02" PRIx8 "", uuid->node[i]);



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

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 19:20:45 UTC 2023

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

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

sys/arch/x86/x86/efi_machdep.c: revision 1.3
(applied to sys/arch/x86/x86/efi.c)

x86/efi: Print uuids in slightly more standard notation.

Anyone need a spare hyphen?  We had a few extras, apparently.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/arch/x86/x86/efi.c

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



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

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 12:09:16 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: boot.c conf.c devopen.c
en.c machdep.c rtc.c scsi.c scsivar.h sd.c version
Added Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: samachdep.h

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

sys/arch/next68k/stand/boot/en.c: revision 1.20
sys/arch/next68k/stand/boot/scsi.c: revision 1.13
sys/arch/next68k/stand/boot/scsi.c: revision 1.14
sys/arch/next68k/stand/boot/conf.c: revision 1.8
sys/arch/next68k/stand/boot/sd.c: revision 1.17
sys/arch/next68k/stand/boot/samachdep.h: revision 1.1
sys/arch/next68k/stand/boot/samachdep.h: revision 1.2
sys/arch/next68k/stand/boot/rtc.c: revision 1.8
sys/arch/next68k/stand/boot/machdep.c: revision 1.9
sys/arch/next68k/stand/boot/boot.c: revision 1.14
sys/arch/next68k/stand/boot/boot.c: revision 1.15
sys/arch/next68k/stand/boot/scsivar.h: revision 1.2
sys/arch/next68k/stand/boot/devopen.c: revision 1.8
sys/arch/next68k/stand/boot/version: revision 1.7

Use common declarations and macros in proper headers.

Also fix inconsistent sdopen() and sdstrategy() args and
remove useless #if 0'ed out code.
No functional change.

Replace DELAY() with one in hp300 bootloader and adjust cpuspeed counts.

Fix boot failure on my ancient Seagate ST52160N drive.
It looks some of such old drives can't respond to SCSI
test-unit-ready command without proper wait after SCSI bus reset.

Bump version again to denote a fix.

XXX we should re-evaluate cpuspeed counts for DELAY() in bootloaders
(where cache is disabled) on other m68k ports, hp300 and luna68k etc.

Actually bump version (missed in the previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.12.22.1 -r1.12.22.2 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.7 -r1.7.170.1 src/sys/arch/next68k/stand/boot/conf.c
cvs rdiff -u -r1.6.32.1 -r1.6.32.2 src/sys/arch/next68k/stand/boot/devopen.c
cvs rdiff -u -r1.19 -r1.19.6.1 src/sys/arch/next68k/stand/boot/en.c
cvs rdiff -u -r1.7.102.1 -r1.7.102.2 \
src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.6.70.1 -r1.6.70.2 src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r0 -r1.2.4.2 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.10.96.1 -r1.10.96.2 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.242.1 \
src/sys/arch/next68k/stand/boot/scsivar.h
cvs rdiff -u -r1.12.34.1 -r1.12.34.2 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.4.212.2 -r1.4.212.3 src/sys/arch/next68k/stand/boot/version

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

Modified files:

Index: src/sys/arch/next68k/stand/boot/boot.c
diff -u src/sys/arch/next68k/stand/boot/boot.c:1.12.22.1 src/sys/arch/next68k/stand/boot/boot.c:1.12.22.2
--- src/sys/arch/next68k/stand/boot/boot.c:1.12.22.1	Wed Feb 15 19:28:29 2023
+++ src/sys/arch/next68k/stand/boot/boot.c	Wed Feb 22 12:09:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.12.22.1 2023/02/15 19:28:29 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.12.22.2 2023/02/22 12:09:16 martin Exp $	*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -34,17 +34,17 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include /* for NEXT_RAMBASE */
 
 #include 
 
-#define KERN_LOADADDR NEXT_RAMBASE
+#include "samachdep.h"
 
-extern int errno;
+#define KERN_LOADADDR NEXT_RAMBASE
 
-extern char *mg;
 #define	MON(type, off) (*(type *)((u_int) (mg) + off))
 
 int devparse(const char *, int *, char *, char *, char *, char **);
@@ -56,18 +56,12 @@ int devparse(const char *, int *, char *
  * Boot device is derived from PROM provided information.
  */
 
-extern char bootprog_rev[];
-extern char bootprog_name[];
-extern int build;
 #define KNAMEN 100
 char kernel[KNAMEN];
 int entry_point;		/* return value filled in by machdep_start */
+int cpuspeed = MHZ_33;		/* assume fastest 33 MHz for sanity */
 int turbo;
 
-extern void rtc_init(void);
-
-extern int try_bootp;
-
 volatile int qq;
 
 int
@@ -86,10 +80,13 @@ main(char *boot_arg)
 	machine = MON(char, MG_machine_type);
 	if (machine == NeXT_TURBO_MONO ||
 	machine == NeXT_TURBO_COLOR ||
-	machine == NeXT_CUBE_TURBO)
+	machine == NeXT_CUBE_TURBO) {
 		turbo = 1;
-	else
+		cpuspeed = MHZ_33;
+	} else {
 		turbo = 0;
+		cpuspeed = MHZ_25;
+	}
 
 	memset(marks, 0, sizeof(marks));
 	printf(">> %s BOOT [%s #%d]\n", bootprog_name, bootprog_rev, build);

Index: src/sys/arch/next68k/stand/boot/conf.c
diff -u src/sys/arch/next68k/stand/boot/conf.c:1.7 src/sys/arch/next68k/stand/boot/conf.c:1.7.170.1
--- src/sys/arch/next68k/stand/boot/conf.c:1.7	Sun Dec 11 12:18:29 2005
+++ src/sys/arch/next68k/stand/boot/conf.c	Wed Feb 22 12:09:16 2023
@@ -1,4 +1,4 @@
-/*	

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

2023-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 12:09:16 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: boot.c conf.c devopen.c
en.c machdep.c rtc.c scsi.c scsivar.h sd.c version
Added Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: samachdep.h

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

sys/arch/next68k/stand/boot/en.c: revision 1.20
sys/arch/next68k/stand/boot/scsi.c: revision 1.13
sys/arch/next68k/stand/boot/scsi.c: revision 1.14
sys/arch/next68k/stand/boot/conf.c: revision 1.8
sys/arch/next68k/stand/boot/sd.c: revision 1.17
sys/arch/next68k/stand/boot/samachdep.h: revision 1.1
sys/arch/next68k/stand/boot/samachdep.h: revision 1.2
sys/arch/next68k/stand/boot/rtc.c: revision 1.8
sys/arch/next68k/stand/boot/machdep.c: revision 1.9
sys/arch/next68k/stand/boot/boot.c: revision 1.14
sys/arch/next68k/stand/boot/boot.c: revision 1.15
sys/arch/next68k/stand/boot/scsivar.h: revision 1.2
sys/arch/next68k/stand/boot/devopen.c: revision 1.8
sys/arch/next68k/stand/boot/version: revision 1.7

Use common declarations and macros in proper headers.

Also fix inconsistent sdopen() and sdstrategy() args and
remove useless #if 0'ed out code.
No functional change.

Replace DELAY() with one in hp300 bootloader and adjust cpuspeed counts.

Fix boot failure on my ancient Seagate ST52160N drive.
It looks some of such old drives can't respond to SCSI
test-unit-ready command without proper wait after SCSI bus reset.

Bump version again to denote a fix.

XXX we should re-evaluate cpuspeed counts for DELAY() in bootloaders
(where cache is disabled) on other m68k ports, hp300 and luna68k etc.

Actually bump version (missed in the previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.12.22.1 -r1.12.22.2 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.7 -r1.7.170.1 src/sys/arch/next68k/stand/boot/conf.c
cvs rdiff -u -r1.6.32.1 -r1.6.32.2 src/sys/arch/next68k/stand/boot/devopen.c
cvs rdiff -u -r1.19 -r1.19.6.1 src/sys/arch/next68k/stand/boot/en.c
cvs rdiff -u -r1.7.102.1 -r1.7.102.2 \
src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.6.70.1 -r1.6.70.2 src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r0 -r1.2.4.2 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.10.96.1 -r1.10.96.2 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.242.1 \
src/sys/arch/next68k/stand/boot/scsivar.h
cvs rdiff -u -r1.12.34.1 -r1.12.34.2 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.4.212.2 -r1.4.212.3 src/sys/arch/next68k/stand/boot/version

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



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

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

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

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

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

 s/impliment/implement/ in comment.

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

Misc KNF and cosmetics.

Use proper C99 int types.

Remove trailing spaces and TABs.

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

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

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

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

Bump version again to denote NeXT_CUBE_TURBO support.


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

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

Modified files:

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

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

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

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

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

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

 s/impliment/implement/ in comment.

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

Misc KNF and cosmetics.

Use proper C99 int types.

Remove trailing spaces and TABs.

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

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

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

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

Bump version again to denote NeXT_CUBE_TURBO support.


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

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



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

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

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

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

sys/arch/next68k/conf/GENERIC: revision 1.155 (patch)

next68k:  Specify -fno-unwind-tables to shrink kernel binary size.

next68k bootloader cannot load a kernel larger than ~3.8 MB.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.148.2.1 src/sys/arch/next68k/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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.148 src/sys/arch/next68k/conf/GENERIC:1.148.2.1
--- src/sys/arch/next68k/conf/GENERIC:1.148	Fri Apr 26 21:40:31 2019
+++ src/sys/arch/next68k/conf/GENERIC	Wed Feb 15 19:19:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.148 2019/04/26 21:40:31 sevan Exp $
+# $NetBSD: GENERIC,v 1.148.2.1 2023/02/15 19:19:38 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,9 +22,9 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.148 $"
+#ident 		"GENERIC-$Revision: 1.148.2.1 $"
 
-makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
+makeoptions	COPTS="-O2 -fno-unwind-tables -fno-reorder-blocks"	# see share/mk/sys.mk
 
 # Needs to be set per system.  i.e change these as you see fit
 maxusers	16



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

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

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

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

sys/arch/next68k/conf/GENERIC: revision 1.155 (patch)

next68k:  Specify -fno-unwind-tables to shrink kernel binary size.

next68k bootloader cannot load a kernel larger than ~3.8 MB.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.148.2.1 src/sys/arch/next68k/conf/GENERIC

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



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

2023-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 12 12:22:44 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: Makefile README devopen.c
dmareg.h machdep.c rtc.c scsi.c sd.c srt0.s version

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

sys/arch/next68k/stand/boot/scsi.c: revision 1.11
sys/arch/next68k/stand/boot/sd.c: revision 1.13
sys/arch/next68k/stand/boot/scsi.c: revision 1.12
sys/arch/next68k/stand/boot/sd.c: revision 1.14
sys/arch/next68k/stand/boot/sd.c: revision 1.15
sys/arch/next68k/stand/boot/sd.c: revision 1.16
sys/arch/next68k/stand/boot/rtc.c: revision 1.7
sys/arch/next68k/stand/boot/dmareg.h: revision 1.4
sys/arch/next68k/stand/boot/machdep.c: revision 1.8
sys/arch/next68k/stand/boot/srt0.s: revision 1.3
sys/arch/next68k/stand/boot/README: revision 1.2
sys/arch/next68k/stand/boot/devopen.c: revision 1.7
sys/arch/next68k/stand/boot/Makefile: revision 1.30
sys/arch/next68k/stand/boot/Makefile: revision 1.31
sys/arch/next68k/stand/boot/version: revision 1.5

Remove trailing spaces and TABs.

Make sure to specify volatile explicitly on DMA register accesses.

It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.

Avoid possible division by zero trap in error cases to make debug easier.

Request only 36 bytes for a response of INQUIRY command for legacy drives.
Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).
The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator) on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html

Disable DEBUG options properly.

Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.18.1 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.242.1 src/sys/arch/next68k/stand/boot/README
cvs rdiff -u -r1.6 -r1.6.32.1 src/sys/arch/next68k/stand/boot/devopen.c
cvs rdiff -u -r1.3 -r1.3.202.1 src/sys/arch/next68k/stand/boot/dmareg.h
cvs rdiff -u -r1.7 -r1.7.102.1 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.6 -r1.6.70.1 src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.10 -r1.10.96.1 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.12 -r1.12.34.1 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.2 -r1.2.218.1 src/sys/arch/next68k/stand/boot/srt0.s
cvs rdiff -u -r1.4 -r1.4.212.1 src/sys/arch/next68k/stand/boot/version

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



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

2023-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 12 12:22:44 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot [netbsd-9]: Makefile README devopen.c
dmareg.h machdep.c rtc.c scsi.c sd.c srt0.s version

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

sys/arch/next68k/stand/boot/scsi.c: revision 1.11
sys/arch/next68k/stand/boot/sd.c: revision 1.13
sys/arch/next68k/stand/boot/scsi.c: revision 1.12
sys/arch/next68k/stand/boot/sd.c: revision 1.14
sys/arch/next68k/stand/boot/sd.c: revision 1.15
sys/arch/next68k/stand/boot/sd.c: revision 1.16
sys/arch/next68k/stand/boot/rtc.c: revision 1.7
sys/arch/next68k/stand/boot/dmareg.h: revision 1.4
sys/arch/next68k/stand/boot/machdep.c: revision 1.8
sys/arch/next68k/stand/boot/srt0.s: revision 1.3
sys/arch/next68k/stand/boot/README: revision 1.2
sys/arch/next68k/stand/boot/devopen.c: revision 1.7
sys/arch/next68k/stand/boot/Makefile: revision 1.30
sys/arch/next68k/stand/boot/Makefile: revision 1.31
sys/arch/next68k/stand/boot/version: revision 1.5

Remove trailing spaces and TABs.

Make sure to specify volatile explicitly on DMA register accesses.

It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.

Avoid possible division by zero trap in error cases to make debug easier.

Request only 36 bytes for a response of INQUIRY command for legacy drives.
Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).
The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator) on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html

Disable DEBUG options properly.

Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.18.1 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.242.1 src/sys/arch/next68k/stand/boot/README
cvs rdiff -u -r1.6 -r1.6.32.1 src/sys/arch/next68k/stand/boot/devopen.c
cvs rdiff -u -r1.3 -r1.3.202.1 src/sys/arch/next68k/stand/boot/dmareg.h
cvs rdiff -u -r1.7 -r1.7.102.1 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.6 -r1.6.70.1 src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.10 -r1.10.96.1 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.12 -r1.12.34.1 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.2 -r1.2.218.1 src/sys/arch/next68k/stand/boot/srt0.s
cvs rdiff -u -r1.4 -r1.4.212.1 src/sys/arch/next68k/stand/boot/version

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

Modified files:

Index: src/sys/arch/next68k/stand/boot/Makefile
diff -u src/sys/arch/next68k/stand/boot/Makefile:1.29 src/sys/arch/next68k/stand/boot/Makefile:1.29.18.1
--- src/sys/arch/next68k/stand/boot/Makefile:1.29	Sat Apr  8 19:53:22 2017
+++ src/sys/arch/next68k/stand/boot/Makefile	Sun Feb 12 12:22:44 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2017/04/08 19:53:22 christos Exp $
+#	$NetBSD: Makefile,v 1.29.18.1 2023/02/12 12:22:44 martin Exp $
 
 NOMAN=	# defined
 
@@ -23,11 +23,14 @@ SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes # S
 RELOC=	438
 
 # XXX make defs arch-indep.
-INCLUDES+=	-I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa 
-DEFS+=		-D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP  -DDEBUG -DSD_DEBUG -DSCSI_DEBUG # -DEN_DEBUG   -DNETIF_DEBUG  
-SAMISCCPPFLAGS=	-DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER # -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG # -DNETIF_DEBUG -DNFS_DEBUG  -DARP_DEBUG 
+INCLUDES+=	-I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa
+DEFS+=		-D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP
+#DEFS+=		-DDEBUG -DSD_DEBUG -DSCSI_DEBUG -DEN_DEBUG -DNETIF_DEBUG
+SAMISCCPPFLAGS=	-DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER
+#SAMISCCPPFLAGS+= -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG-DNETIF_DEBUG
+#SAMISCCPPFLAGS+= -DNFS_DEBUG -DARP_DEBUG
 WARNS=1
-CFLAGS+=	 -ffreestanding -nostdinc ${INCLUDES} ${DEFS}
+CFLAGS+=	-ffreestanding -nostdinc ${INCLUDES} ${DEFS}
 CFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
 AFLAGS+=	${INCLUDES}
 # XXX SHOULD NOT NEED TO DEFINE THESE!

Index: src/sys/arch/next68k/stand/boot/README
diff -u src/sys/arch/next68k/stand/boot/README:1.1.1.1 src/sys/arch/next68k/stand/boot/README:1.1.1.1.242.1
--- src/sys/arch/next68k/stand/boot/README:1.1.1.1	Tue Jun  9 07:53:06 1998
+++ src/sys/arch/next68k/stand/boot/README	Sun Feb 12 12:22:44 2023
@@ -1,9 +1,9 @@
-$NetBSD: README,v 1.1.1.1 1998/06/09 07:53:06 dbj Exp $
+$NetBSD: README,v 1.1.1.1.242.1 2023/02/12 12:22:44 martin Exp 

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

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

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

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

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

Use explicit CPU strings and remove hp300 derived stuff.

Remove #ifdef'ed out hp300 specific stuff.

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

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

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

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

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

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

Tested on my NeXTstation slab.


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

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



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

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

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

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

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

Use explicit CPU strings and remove hp300 derived stuff.

Remove #ifdef'ed out hp300 specific stuff.

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

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

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

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

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

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

Tested on my NeXTstation slab.


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

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

Modified files:

Index: src/sys/arch/next68k/include/param.h
diff -u src/sys/arch/next68k/include/param.h:1.12 src/sys/arch/next68k/include/param.h:1.12.52.1
--- src/sys/arch/next68k/include/param.h:1.12	Fri Feb 10 17:35:48 2012
+++ src/sys/arch/next68k/include/param.h	Sun Feb 12 11:47:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.12 2012/02/10 17:35:48 para Exp $	*/
+/*	$NetBSD: param.h,v 1.12.52.1 2023/02/12 11:47:10 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #define	PGSHIFT		12		/* LOG2(NBPG) */
 #define	KERNBASE	0x	/* start of kernel virtual */
 
-#define	UPAGES		3  		/* pages of u-area */
+#define	UPAGES		2  		/* pages of u-area */
 
 #include 
 

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

Index: 

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

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

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

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

sys/arch/i386/conf/GENERIC: revision 1.1243

Enable options DISKLABEL_EI by default as amd64.

No particular comment no port-i386@:
https://mail-index.netbsd.org/port-i386/2022/12/02/msg004063.html


To generate a diff of this commit:
cvs rdiff -u -r1.1208.2.5 -r1.1208.2.6 src/sys/arch/i386/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/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1208.2.5 src/sys/arch/i386/conf/GENERIC:1.1208.2.6
--- src/sys/arch/i386/conf/GENERIC:1.1208.2.5	Tue Jul  7 10:29:06 2020
+++ src/sys/arch/i386/conf/GENERIC	Sun Feb 12 11:43:29 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1208.2.5 2020/07/07 10:29:06 martin Exp $
+# $NetBSD: GENERIC,v 1.1208.2.6 2023/02/12 11:43:29 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1208.2.5 $"
+#ident		"GENERIC-$Revision: 1.1208.2.6 $"
 
 maxusers	64		# estimated number of users
 
@@ -153,7 +153,7 @@ include "conf/filesystems.config"
 # File system options
 options 	QUOTA		# legacy UFS quotas
 options 	QUOTA2		# new, in-filesystem UFS quotas
-#options 	DISKLABEL_EI	# disklabel Endian Independent support
+options 	DISKLABEL_EI	# disklabel Endian Independent support
 options 	FFS_EI		# FFS Endian Independent support
 options 	WAPBL		# File system journaling support
 #options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental



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

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

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

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

sys/arch/i386/conf/GENERIC: revision 1.1243

Enable options DISKLABEL_EI by default as amd64.

No particular comment no port-i386@:
https://mail-index.netbsd.org/port-i386/2022/12/02/msg004063.html


To generate a diff of this commit:
cvs rdiff -u -r1.1208.2.5 -r1.1208.2.6 src/sys/arch/i386/conf/GENERIC

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



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

2023-02-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  8 16:42:12 UTC 2023

Modified Files:
src/sys/arch/sparc64/include [netbsd-9]: vmparam.h

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1588):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/sparc64/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/sparc64/include/vmparam.h
diff -u src/sys/arch/sparc64/include/vmparam.h:1.39 src/sys/arch/sparc64/include/vmparam.h:1.39.4.1
--- src/sys/arch/sparc64/include/vmparam.h:1.39	Mon Sep  3 16:29:28 2018
+++ src/sys/arch/sparc64/include/vmparam.h	Wed Feb  8 16:42:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.39 2018/09/03 16:29:28 riastradh Exp $ */
+/*	$NetBSD: vmparam.h,v 1.39.4.1 2023/02/08 16:42:12 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -168,8 +168,8 @@
  * User/kernel map constants.
  */
 #define VM_MIN_ADDRESS		((vaddr_t)0)
-#define VM_MAX_ADDRESS		((vaddr_t)-1)
-#define VM_MAXUSER_ADDRESS	((vaddr_t)-1)
+#define VM_MAX_ADDRESS		(((vaddr_t)(-1))&~PGOFSET)
+#define VM_MAXUSER_ADDRESS	VM_MAX_ADDRESS
 #define VM_MAXUSER_ADDRESS32	((vaddr_t)(0xL&~PGOFSET))
 
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)KERNBASE)



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

2023-02-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  8 16:42:12 UTC 2023

Modified Files:
src/sys/arch/sparc64/include [netbsd-9]: vmparam.h

Log Message:
Pull up following revision(s) (requested by hgutch in ticket #1588):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/sparc64/include/vmparam.h

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



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

2023-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb  6 16:51:00 UTC 2023

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

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

sys/arch/vax/vsa/smg.c: revision 1.62

Make sure to call wsfont_init(9) as other framebuffer drivers.

Otherwise wsfont_find(9) always fails and wsdisplay(4) is not attached.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.4.1 src/sys/arch/vax/vsa/smg.c

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



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

2023-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb  6 16:51:00 UTC 2023

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

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

sys/arch/vax/vsa/smg.c: revision 1.62

Make sure to call wsfont_init(9) as other framebuffer drivers.

Otherwise wsfont_find(9) always fails and wsdisplay(4) is not attached.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.4.1 src/sys/arch/vax/vsa/smg.c

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

Modified files:

Index: src/sys/arch/vax/vsa/smg.c
diff -u src/sys/arch/vax/vsa/smg.c:1.58 src/sys/arch/vax/vsa/smg.c:1.58.4.1
--- src/sys/arch/vax/vsa/smg.c:1.58	Thu Mar 14 23:49:38 2019
+++ src/sys/arch/vax/vsa/smg.c	Mon Feb  6 16:51:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $ */
+/*	$NetBSD: smg.c,v 1.58.4.1 2023/02/06 16:51:00 martin Exp $ */
 /*
  * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58.4.1 2023/02/06 16:51:00 martin Exp $");
 
 #include 
 #include 
@@ -241,6 +241,7 @@ smg_attach(device_t parent, device_t sel
 	callout_reset(_cursor_ch, hz / 2, smg_crsr_blink, NULL);
 	curcmd = CUR_CMD_HSHI;
 	WRITECUR(CUR_CMD, curcmd);
+	wsfont_init();
 	if ((fcookie = wsfont_find(NULL, 8, 15, 0, WSDISPLAY_FONTORDER_R2L,
 	WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP)) < 0) {
 		aprint_error_dev(self, "could not find 8x15 font\n");
@@ -591,6 +592,7 @@ smgcninit(struct consdev *cndev)
 	curscr = _conscreen;
 	wsdisplay_cnattach(_stdscreen, _conscreen, 0, 0, 0);
 	cn_tab->cn_pri = CN_INTERNAL;
+	wsfont_init();
 	if ((fcookie = wsfont_find(NULL, 8, 15, 0, WSDISPLAY_FONTORDER_R2L,
 	WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP)) < 0)
 	{



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

2023-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  1 19:00:53 UTC 2023

Modified Files:
src/sys/arch/vax/boot [netbsd-9]: Makefile.inc

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

sys/arch/vax/boot/Makefile.inc: revision 1.19

Make a vax bootloader work on 8MB VAXen.

64KB (0x80 - 0x7f) is not enough for the bootloader itself
and more spaces are required for heap on loading a kernel.

https://mail-index.netbsd.org/port-vax/2023/01/24/msg004149.html

"Go ahead" from ragge@.  Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.6.1 src/sys/arch/vax/boot/Makefile.inc

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

Modified files:

Index: src/sys/arch/vax/boot/Makefile.inc
diff -u src/sys/arch/vax/boot/Makefile.inc:1.18 src/sys/arch/vax/boot/Makefile.inc:1.18.6.1
--- src/sys/arch/vax/boot/Makefile.inc:1.18	Thu Mar 22 08:58:56 2018
+++ src/sys/arch/vax/boot/Makefile.inc	Wed Feb  1 19:00:53 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2018/03/22 08:58:56 ragge Exp $
+#	$NetBSD: Makefile.inc,v 1.18.6.1 2023/02/01 19:00:53 martin Exp $
 
 NOSSP=
 NOFORTIFY=
@@ -7,7 +7,7 @@ NODEBUG=
 
 .include 
 
-RELOC=0x7f
+RELOC=0x7d
 .PATH:	${.CURDIR}/../../vax ${.CURDIR}/../common
 
 CPPFLAGS+=-I.



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

2023-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  1 19:00:53 UTC 2023

Modified Files:
src/sys/arch/vax/boot [netbsd-9]: Makefile.inc

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

sys/arch/vax/boot/Makefile.inc: revision 1.19

Make a vax bootloader work on 8MB VAXen.

64KB (0x80 - 0x7f) is not enough for the bootloader itself
and more spaces are required for heap on loading a kernel.

https://mail-index.netbsd.org/port-vax/2023/01/24/msg004149.html

"Go ahead" from ragge@.  Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.6.1 src/sys/arch/vax/boot/Makefile.inc

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



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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

Modified files:

Index: src/sys/arch/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.64 src/sys/arch/next68k/dev/esp.c:1.64.18.1
--- src/sys/arch/next68k/dev/esp.c:1.64	Fri Mar 31 08:38:13 2017
+++ src/sys/arch/next68k/dev/esp.c	Wed Feb  1 18:56:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $	*/
+/*	$NetBSD: esp.c,v 1.64.18.1 2023/02/01 18:56:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64.18.1 2023/02/01 18:56:44 martin Exp $");
 
 #include 
 #include 
@@ -509,6 +509,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 			}
 #endif
 
+			mutex_exit(>sc_lock);	/* for nextdma intr */
 			while (!nextdma_finished(nsc)) {
 			/* esp_dma_isactive(sc)) { */
 NDTRACEIF (ndtrace_addc('w'));
@@ -602,7 +603,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 
 			}
 		out:
-			;
+			mutex_enter(>sc_lock);	/* for nextdma intr */
 
 #ifdef ESP_DEBUG
 /* 			esp_dma_nest--; */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:27:33 UTC 2023

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

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

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

match zen3 "cezanne" (ryzen 5000-series APU.)


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.2 -r1.9.2.3 src/sys/arch/x86/pci/amdzentemp.c

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 13:00:53 UTC 2023

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

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1574:

sys/arch/x86/include/specialreg.h   1.193-1.198

- Add CPUID Fn_0006 %eax bit 24 IA32_THERM_INTERRUPT MSR bit 25
  Hardware Feedback Notification support.
- Add CPUID Fn_0007 %ecx bit 29 ENQCMD.
- Add CPUID Fn_0007 %edx bit 1 SGX-KEYS.
- Add CPUID Fn_0007 %edx bit 5 UINTR(User INTeRrupts).
- Add CPUID Fn_0007 %edx bit 11 RTM_ALWAYS_ABORT.
- Add CPUID Fn_0007 %edx bit 22 AMX_BF16.
- Add CPUID Fn_0007 %edx bit 23 AVX512_FP16.
- Add CPUID Fn_0007 %edx bit 24 AMX_TILE.
- Add CPUID Fn_0007 %edx bit 25 AMX_INT8.
- Add CPUID Fn_0007 sub-leaf 1 %edx bit 18 CET_SSS.
- Add CPUID Fn_0007 sub-leaf 2 %edx definitions.
- Add CPUID Fn_000d sub-leaf 1 %eax bit 4 XFD.
- Add CPUID Fn_001d Tile Information.
- Add CPUID Fn_001e TMUL Information.
- Add CPUID Fn8000_0007 %eax RAS capabilities.
- Add CPUID Fn8000_0008 %ebx BTC_NO,
- Add cpuid Fn8000_000a x2AVIC, VNMI, IBSVIRT and ROGPT.
- Add CPUID Fn8000_001b Instruction-Based Sampling.
- Add CPUID Fn8000_001e Processor Topology Information.
- Add CPUID Fn8000_001f %eax RPMQUERY, VmplSSS, TscAuxVirt,
  VmgexitParam, VirtualTomMsr, IbsVirtGuest, SmtProtection,
  vsmCommPageMSR and NestedVirtSnpMsr.
- Add CPUID Fn8000_0021 AMD Extended Features Identification 2.
- Add CPUID Fn8000_0022 AMD Extended Performance Monitoring and Debug.
- Rename HW_FEEDBACK to HWI (Hardware Feedback Interface).
- Rename TSX_FORCE_ABORT to RTM_FORCE_ABORT.
- Modify comment. Both Intel and AMD support CPUID Fn000b.
- Modify comment. Hybrid Information -> Native Model ID Information.
- Use __BIT(). Add comment. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.11 -r1.150.2.12 src/sys/arch/x86/include/specialreg.h

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 13:00:53 UTC 2023

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

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1574:

sys/arch/x86/include/specialreg.h   1.193-1.198

- Add CPUID Fn_0006 %eax bit 24 IA32_THERM_INTERRUPT MSR bit 25
  Hardware Feedback Notification support.
- Add CPUID Fn_0007 %ecx bit 29 ENQCMD.
- Add CPUID Fn_0007 %edx bit 1 SGX-KEYS.
- Add CPUID Fn_0007 %edx bit 5 UINTR(User INTeRrupts).
- Add CPUID Fn_0007 %edx bit 11 RTM_ALWAYS_ABORT.
- Add CPUID Fn_0007 %edx bit 22 AMX_BF16.
- Add CPUID Fn_0007 %edx bit 23 AVX512_FP16.
- Add CPUID Fn_0007 %edx bit 24 AMX_TILE.
- Add CPUID Fn_0007 %edx bit 25 AMX_INT8.
- Add CPUID Fn_0007 sub-leaf 1 %edx bit 18 CET_SSS.
- Add CPUID Fn_0007 sub-leaf 2 %edx definitions.
- Add CPUID Fn_000d sub-leaf 1 %eax bit 4 XFD.
- Add CPUID Fn_001d Tile Information.
- Add CPUID Fn_001e TMUL Information.
- Add CPUID Fn8000_0007 %eax RAS capabilities.
- Add CPUID Fn8000_0008 %ebx BTC_NO,
- Add cpuid Fn8000_000a x2AVIC, VNMI, IBSVIRT and ROGPT.
- Add CPUID Fn8000_001b Instruction-Based Sampling.
- Add CPUID Fn8000_001e Processor Topology Information.
- Add CPUID Fn8000_001f %eax RPMQUERY, VmplSSS, TscAuxVirt,
  VmgexitParam, VirtualTomMsr, IbsVirtGuest, SmtProtection,
  vsmCommPageMSR and NestedVirtSnpMsr.
- Add CPUID Fn8000_0021 AMD Extended Features Identification 2.
- Add CPUID Fn8000_0022 AMD Extended Performance Monitoring and Debug.
- Rename HW_FEEDBACK to HWI (Hardware Feedback Interface).
- Rename TSX_FORCE_ABORT to RTM_FORCE_ABORT.
- Modify comment. Both Intel and AMD support CPUID Fn000b.
- Modify comment. Hybrid Information -> Native Model ID Information.
- Use __BIT(). Add comment. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.11 -r1.150.2.12 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.11 src/sys/arch/x86/include/specialreg.h:1.150.2.12
--- src/sys/arch/x86/include/specialreg.h:1.150.2.11	Sat Oct 15 10:08:40 2022
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 23 13:00:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.11 2022/10/15 10:08:40 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.12 2023/01/23 13:00:53 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
@@ -124,21 +124,21 @@
 /*
  * Extended Control Register XCR0
  */
-#define XCR0_X87	0x0001	/* x87 FPU/MMX state */
-#define XCR0_SSE	0x0002	/* SSE state */
-#define XCR0_YMM_Hi128	0x0004	/* AVX-256 (ymmn registers) */
-#define XCR0_BNDREGS	0x0008	/* Memory protection ext bounds */
-#define XCR0_BNDCSR	0x0010	/* Memory protection ext state */
-#define XCR0_Opmask	0x0020	/* AVX-512 Opmask */
-#define XCR0_ZMM_Hi256	0x0040	/* AVX-512 upper 256 bits low regs */
-#define XCR0_Hi16_ZMM	0x0080	/* AVX-512 512 bits upper registers */
-#define XCR0_PT		0x0100	/* Processor Trace state */
-#define XCR0_PKRU	0x0200	/* Protection Key state */
-#define XCR0_CET_U	0x0800	/* User CET state */
-#define XCR0_CET_S	0x1000	/* Kern CET state */
-#define XCR0_HDC	0x2000	/* Hardware Duty Cycle state */
-#define XCR0_LBR	0x8000	/* Last Branch Record */
-#define XCR0_HWP	0x0001	/* Hardware P-states */
+#define XCR0_X87	__BIT(0)	/* x87 FPU/MMX state */
+#define XCR0_SSE	__BIT(1)	/* SSE state */
+#define XCR0_YMM_Hi128	__BIT(2)	/* AVX-256 (ymmn registers) */
+#define XCR0_BNDREGS	__BIT(3)	/* Memory protection ext bounds */
+#define XCR0_BNDCSR	__BIT(4)	/* Memory protection ext state */
+#define XCR0_Opmask	__BIT(5)	/* AVX-512 Opmask */
+#define XCR0_ZMM_Hi256	__BIT(6)	/* AVX-512 upper 256 bits low regs */
+#define XCR0_Hi16_ZMM	__BIT(7)	/* AVX-512 512 bits upper registers */
+#define XCR0_PT		__BIT(8)	/* Processor Trace state */
+#define XCR0_PKRU	__BIT(9)	/* Protection Key state */
+#define XCR0_CET_U	__BIT(11)	/* User CET state */
+#define XCR0_CET_S	__BIT(12)	/* Kern CET state */
+#define XCR0_HDC	__BIT(13)	/* Hardware Duty Cycle state */
+#define XCR0_LBR	__BIT(15)	/* Last Branch Record */
+#define XCR0_HWP	__BIT(16)	/* Hardware P-states */
 
 #define XCR0_FLAGS1	"\20"		  \
 	"\1" "x87"	"\2" "SSE"	"\3" "AVX"	"\4" "BNDREGS"	  \
@@ -224,38 +224,38 @@
 #endif
 
 /* %ecx */
-#define CPUID2_SSE3	0x0001	/* Streaming SIMD Extensions 3 */
-#define CPUID2_PCLMULQDQ 0x0002	/* PCLMULQDQ instructions */
-#define CPUID2_DTES64	0x0004	/* 64-bit Debug Trace */
-#define CPUID2_MONITOR	0x0008	/* MONITOR/MWAIT instructions */
-#define CPUID2_DS_CPL	0x0010	/* CPL Qualified Debug Store */
-#define CPUID2_VMX	0x0020	/* Virtual Machine eXtensions */
-#define 

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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:27:33 UTC 2023

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

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

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

match zen3 "cezanne" (ryzen 5000-series APU.)


To generate a diff of this commit:
cvs rdiff -u -r1.9.2.2 -r1.9.2.3 src/sys/arch/x86/pci/amdzentemp.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9.2.2 src/sys/arch/x86/pci/amdzentemp.c:1.9.2.3
--- src/sys/arch/x86/pci/amdzentemp.c:1.9.2.2	Tue Oct 11 18:16:20 2022
+++ src/sys/arch/x86/pci/amdzentemp.c	Mon Jan 23 12:27:33 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdzentemp.c,v 1.9.2.2 2022/10/11 18:16:20 martin Exp $ */
+/*  $NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.2 2022/10/11 18:16:20 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9.2.3 2023/01/23 12:27:33 martin Exp $ ");
 
 #include 
 #include 
@@ -398,6 +398,7 @@ amdzentemp_probe_ccd_sensors19h(struct a
 	switch (model) {
 	case 0x00 ... 0x0f: /* Zen3 EPYC "Milan" */
 	case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */
+	case 0x50 ... 0x5f: /* Zen3 Ryzen "Cezanne" */
 		maxreg = 8;
 		break;
 	case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:23:53 UTC 2023

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.46

Add x2avic. Modify comment.


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

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



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

2023-01-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 23 12:23:53 UTC 2023

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

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

sys/arch/x86/x86/procfs_machdep.c: revision 1.46

Add x2avic. Modify comment.


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

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.6 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.7
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.6	Fri Sep 16 18:36:43 2022
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Jan 23 12:23:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.6 2022/09/16 18:36:43 martin Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.6 2022/09/16 18:36:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33.2.7 2023/01/23 12:23:53 martin Exp $");
 
 #include 
 #include 
@@ -171,7 +171,7 @@ static const char * const x86_features[]
 	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
 	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL,
 	"v_vmsave_vmload",
-	"vgif", NULL, NULL, NULL, "v_spec_ctrl", NULL, NULL, NULL,
+	"vgif", NULL, "x2avic", NULL, "v_spec_ctrl", NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
@@ -183,7 +183,7 @@ static const char * const x86_features[]
 	NULL, "cldemote", NULL, "movdiri",
 	"movdir64b", "enqcmd", "sgx_lc", NULL},
 
-	{ /* (17) 0x8007 ebx */
+	{ /* (17) AMD 0x8007 ebx */
 	"overflow_recov", "succor", NULL, "smca", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,



  1   2   3   4   >