CVS commit: src/sys/arch/alpha/pci

2024-04-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr  3 04:30:30 UTC 2024

Modified Files:
src/sys/arch/alpha/pci: irongate_pci.c

Log Message:
Add a missing barrier in irongate_conf_read0().


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

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



CVS commit: src/sys/arch/alpha/pci

2024-04-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr  3 04:30:30 UTC 2024

Modified Files:
src/sys/arch/alpha/pci: irongate_pci.c

Log Message:
Add a missing barrier in irongate_conf_read0().


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

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

Modified files:

Index: src/sys/arch/alpha/pci/irongate_pci.c
diff -u src/sys/arch/alpha/pci/irongate_pci.c:1.12 src/sys/arch/alpha/pci/irongate_pci.c:1.13
--- src/sys/arch/alpha/pci/irongate_pci.c:1.12	Fri Jun 25 03:45:59 2021
+++ src/sys/arch/alpha/pci/irongate_pci.c	Wed Apr  3 04:30:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $ */
+/* $NetBSD: irongate_pci.c,v 1.13 2024/04/03 04:30:30 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.13 2024/04/03 04:30:30 thorpej Exp $");
 
 #include 
 #include 
@@ -106,6 +106,7 @@ irongate_conf_read0(void *ipv, pcitag_t 
 	REGVAL(PCI_CONF_ADDR) = (CONFADDR_ENABLE | tag | (offset & 0xff));
 	alpha_mb();
 	data = REGVAL(PCI_CONF_DATA);
+	alpha_mb();
 	REGVAL(PCI_CONF_ADDR) = 0;
 	alpha_mb();
 	PCI_CONF_UNLOCK(s);



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:11:21 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: dec_6600.c
src/sys/arch/alpha/include: rpb.h

Log Message:
In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true.  This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/include/rpb.h

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



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:11:21 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: dec_6600.c
src/sys/arch/alpha/include: rpb.h

Log Message:
In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true.  This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/include/rpb.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/alpha/alpha/dec_6600.c
diff -u src/sys/arch/alpha/alpha/dec_6600.c:1.37 src/sys/arch/alpha/alpha/dec_6600.c:1.38
--- src/sys/arch/alpha/alpha/dec_6600.c:1.37	Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_6600.c	Sun Mar 31 19:11:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_6600.c,v 1.37 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.37 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $");
 
 #include 
 #include 
@@ -101,15 +101,36 @@ static const char *kgdb_devlist[] = {
 };
 #endif /* KGDB */
 
+static const struct alpha_variation_table dec_6600_variations[] = {
+	{ SV_ST_DP264, "AlphaPC DP264" },
+	{ SV_ST_CLIPPER, "AlphaServer ES40 (\"Clipper\")" },
+	{ SV_ST_GOLDRUSH, "AlphaServer DS20 (\"GoldRush\")" },
+	{ SV_ST_WEBBRICK, "AlphaServer DS10 (\"WebBrick\")" },
+	{ SV_ST_SHARK, "AlphaServer DS20L (\"Shark\")" },
+	{ 0, NULL },
+};
+
+static const struct alpha_variation_table dec_titan_variations[] = {
+	{ 0, NULL },
+};
+
 void
 dec_6600_init(void)
 {
+	uint64_t variation;
 
-	platform.family = "6600";
+	platform.family = (hwrpb->rpb_type == ST_DEC_TITAN) ? "Titan"
+			: "6600";
 
 	if ((platform.model = alpha_dsr_sysname()) == NULL) {
-		/* XXX Don't know the system variations, yet. */
-		platform.model = alpha_unknown_sysname();
+		const struct alpha_variation_table *vartab =
+		(hwrpb->rpb_type == ST_DEC_TITAN) ? dec_titan_variations
+		  : dec_6600_variations;
+		variation = hwrpb->rpb_variation & SV_ST_MASK;
+		if ((platform.model = alpha_variation_name(variation,
+			   vartab)) == NULL) {
+			platform.model = alpha_unknown_sysname();
+		}
 	}
 
 	platform.iobus = "tsc";
@@ -203,6 +224,37 @@ dec_6600_device_register(device_t dev, v
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
+	/*
+	 * First section: Deal with system-specific quirks.
+	 */
+
+	if ((hwrpb->rpb_variation & SV_ST_MASK) == SV_ST_WEBBRICK) {
+		/*
+		 * DMA on the on-board ALI IDE controller is not
+		 * working correctly; disable it for now to let
+		 * the systems at least hobble along.
+		 *
+		 * N.B. There's only one Pchip on a DS10, do there
+		 * is not need to determine which hose we have here.
+		 *
+		 * XXX This is meant to be temporary until we can find
+		 * XXX and fix the issue with bus-master DMA.
+		 */
+		if (device_is_a(parent, "pci") && device_is_a(dev, "aceride")) {
+			struct pci_attach_args *pa = aux;
+
+			if (pa->pa_bus == 0 && pa->pa_device == 13 &&
+			pa->pa_function == 0) {
+prop_dictionary_set_bool(device_properties(dev),
+"pciide-disable-dma", true);
+			}
+		}
+	}
+
+	/*
+	 * Second section: Boot device detection.
+	 */
+
 	if (b == NULL || found)
 		return;
 

Index: src/sys/arch/alpha/include/rpb.h
diff -u src/sys/arch/alpha/include/rpb.h:1.44 src/sys/arch/alpha/include/rpb.h:1.45
--- src/sys/arch/alpha/include/rpb.h:1.44	Sat Oct  3 17:33:23 2020
+++ src/sys/arch/alpha/include/rpb.h	Sun Mar 31 19:11:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: rpb.h,v 1.44 2020/10/03 17:33:23 thorpej Exp $ */
+/* $NetBSD: rpb.h,v 1.45 2024/03/31 19:11:21 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -185,6 +185,23 @@ struct rpb {
  */
 #define	SV_ST_MIATA_1_5		0x4c00	/* Miata 1.5 */
 
+/*
+ * System types for the Tsunami family.
+ * XXX These are not very complete!
+ */
+#define	SV_ST_DP264		0x0400	/* AlphaPC DP264 */
+#define	SV_ST_WARHOL		0x0800
+#define	SV_ST_WINDJAMMER	0x0c00
+#define	SV_ST_MONET		0x1000
+#define	SV_ST_CLIPPER		0x1400	/* AlphaServer ES40 */
+#define	SV_ST_GOLDRUSH		0x1800	/* AlphaServer DS20 */
+#define	SV_ST_WEBBRICK		0x1c00	/* AlphaServer DS10 */
+#define	SV_ST_CATAMARAN		0x2000
+#define	SV_ST_BRISBANE		0x2400
+#define	SV_ST_MALBOURNE		0x2800
+#define	SV_ST_FLYINGCLIPPER	0x2c00
+#define	SV_ST_SHARK		0x3000	/* AlphaServer DS20L */
+
 	uint64_t	rpb_variation;		/*  58 */
 
 	

CVS commit: src/sys/arch/alpha/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:06:31 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c
dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c
dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c
dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c
dec_kn300.c dec_kn8ae.c

Log Message:
Always call platform.device_register(), even if bootdev_data is NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \
src/sys/arch/alpha/alpha/dec_kn8ae.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.32 src/sys/arch/alpha/alpha/api_up1000.c:1.33
--- src/sys/arch/alpha/alpha/api_up1000.c:1.32	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/alpha/api_up1000.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -34,7 +34,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ api_up1000_device_register(device_t dev,
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
-	if (found)
+	if (b == NULL || found)
 		return;
 
 	if (!initted) {

Index: src/sys/arch/alpha/alpha/autoconf.c
diff -u src/sys/arch/alpha/alpha/autoconf.c:1.58 src/sys/arch/alpha/alpha/autoconf.c:1.59
--- src/sys/arch/alpha/alpha/autoconf.c:1.58	Fri Jul  9 01:29:20 2021
+++ src/sys/arch/alpha/alpha/autoconf.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $ */
+/* $NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $");
 
 #include "pci.h"
 
@@ -324,13 +324,6 @@ device_register(device_t dev, void *aux)
 	if (parent != NULL && device_is_a(parent, "pci"))
 		device_pci_register(dev, aux);
 #endif
-
-	if (bootdev_data == NULL) {
-		/*
-		 * There is no hope.
-		 */
-		return;
-	}
 	if (platform.device_register)
 		(*platform.device_register)(dev, aux);
 }

Index: src/sys/arch/alpha/alpha/dec_1000a.c
diff -u src/sys/arch/alpha/alpha/dec_1000a.c:1.34 src/sys/arch/alpha/alpha/dec_1000a.c:1.35
--- src/sys/arch/alpha/alpha/dec_1000a.c:1.34	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/alpha/dec_1000a.c	Sun Mar 31 19:06:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $");
 
 #include 
 #include 
@@ -254,7 +254,7 @@ dec_1000a_device_register(device_t dev, 
 	struct bootdev_data *b = bootdev_data;
 	device_t parent = device_parent(dev);
 
-	if (found)
+	if (b == NULL || found)
 		return;
 
 	if (!initted) {

Index: src/sys/arch/alpha/alpha/dec_2000_300.c
diff -u src/sys/arch/alpha/alpha/dec_2000_300.c:1.21 src/sys/arch/alpha/alpha/dec_2000_300.c:1.22
--- src/sys/arch/alpha/alpha/dec_2000_300.c:1.21	Mon 

CVS commit: src/sys/arch/alpha/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 19:06:31 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c
dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c
dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c
dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c
dec_kn300.c dec_kn8ae.c

Log Message:
Always call platform.device_register(), even if bootdev_data is NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \
src/sys/arch/alpha/alpha/dec_kn8ae.c

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



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 17:13:29 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/alpha/include: cpu.h

Log Message:
Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/include/cpu.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.378 src/sys/arch/alpha/alpha/machdep.c:1.379
--- src/sys/arch/alpha/alpha/machdep.c:1.378	Tue Mar  5 14:15:28 2024
+++ src/sys/arch/alpha/alpha/machdep.c	Sun Mar 31 17:13:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.378 2024/03/05 14:15:28 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.379 2024/03/31 17:13:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.378 2024/03/05 14:15:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.379 2024/03/31 17:13:29 thorpej Exp $");
 
 #include 
 #include 
@@ -1652,6 +1652,16 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   CTLTYPE_INT, "fp_complete_debug", NULL,
 		   NULL, 0, _fp_complete_debug, 0,
 		   CTL_MACHDEP, CPU_FP_COMPLETE_DEBUG, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT,
+		   CTLTYPE_QUAD, "rpb_type", NULL,
+		   NULL, 0, >rpb_type, 0,
+		   CTL_MACHDEP, CPU_RPB_TYPE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT,
+		   CTLTYPE_QUAD, "rpb_variation", NULL,
+		   NULL, 0, >rpb_variation, 0,
+		   CTL_MACHDEP, CPU_RPB_VARIATION, CTL_EOL);
 }
 
 /*

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.105 src/sys/arch/alpha/include/cpu.h:1.106
--- src/sys/arch/alpha/include/cpu.h:1.105	Wed Nov 22 01:56:14 2023
+++ src/sys/arch/alpha/include/cpu.h	Sun Mar 31 17:13:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.105 2023/11/22 01:56:14 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.106 2024/03/31 17:13:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -241,6 +241,8 @@ void	cpu_signotify(struct lwp *);
 #define	CPU_CCTR		8	/* int: using CC timecounter */
 #define	CPU_IS_QEMU		9	/* int: running under Qemu */
 #define	CPU_FP_COMPLETE_DEBUG	10	/* int: enable FP completion debug */
+#define	CPU_RPB_TYPE		11	/* quad: system type (from RPB) */
+#define	CPU_RPB_VARIATION	12	/* quad: system variation (from RPB) */
 
 
 #ifdef _KERNEL



CVS commit: src/sys/arch/alpha

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 17:13:29 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/alpha/include: cpu.h

Log Message:
Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/include/cpu.h

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



CVS commit: src/sys/arch/alpha

2024-03-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 13:37:35 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/tlsb: tlsb.c tlsbvar.h

Log Message:
Tidy up TLSB autoconfiguration just a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/tlsb/tlsbvar.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/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.420 src/sys/arch/alpha/conf/GENERIC:1.421
--- src/sys/arch/alpha/conf/GENERIC:1.420	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/GENERIC	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.420 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: GENERIC,v 1.421 2024/03/06 13:37:35 thorpej Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.420 $"
+ident		"GENERIC-$Revision: 1.421 $"
 
 maxusers 32
 
@@ -191,9 +191,9 @@ qemu*	at	mainbus?
 
 # TurboLaser bus support and devices
 tlsb*	at	mainbus?
-gbus*	at	tlsb? node ? offset ?
-tlsbmem* at	tlsb? node ? offset ?
-kft*	at	tlsb? node ? offset ?
+gbus*	at	tlsb? node ?
+tlsbmem* at	tlsb? node ?
+kft*	at	tlsb? node ?
 
 # Gbus Devices
 mcclock* at	gbus? offset ?

Index: src/sys/arch/alpha/conf/INSTALL
diff -u src/sys/arch/alpha/conf/INSTALL:1.119 src/sys/arch/alpha/conf/INSTALL:1.120
--- src/sys/arch/alpha/conf/INSTALL:1.119	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/INSTALL	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.119 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: INSTALL,v 1.120 2024/03/06 13:37:35 thorpej Exp $
 #
 # Alpha INSTALL kernel.
 
@@ -92,9 +92,9 @@ qemu*	at	mainbus?
 
 # TurboLaser bus support and devices
 tlsb*	at	mainbus?
-gbus*	at	tlsb? node ? offset ?
-tlsbmem* at	tlsb? node ? offset ?
-kft*	at	tlsb? node ? offset ?
+gbus*	at	tlsb? node ?
+tlsbmem* at	tlsb? node ?
+kft*	at	tlsb? node ?
 
 # Gbus Devices
 mcclock* at	gbus? offset ?

Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.197 src/sys/arch/alpha/conf/files.alpha:1.198
--- src/sys/arch/alpha/conf/files.alpha:1.197	Wed Mar  6 05:33:09 2024
+++ src/sys/arch/alpha/conf/files.alpha	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.197 2024/03/06 05:33:09 thorpej Exp $
+# $NetBSD: files.alpha,v 1.198 2024/03/06 13:37:35 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -85,7 +85,7 @@ file	dev/md_root.c			memory_disk_hooks
 # TurboLaser Bus Support
 #
 
-device	tlsb { node = -1, offset = -1 }
+device	tlsb { node = -1 }
 attach	tlsb at mainbus
 file	arch/alpha/tlsb/tlsb.c		tlsb & dec_kn8ae
 

Index: src/sys/arch/alpha/tlsb/tlsb.c
diff -u src/sys/arch/alpha/tlsb/tlsb.c:1.41 src/sys/arch/alpha/tlsb/tlsb.c:1.42
--- src/sys/arch/alpha/tlsb/tlsb.c:1.41	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/alpha/tlsb/tlsb.c	Wed Mar  6 13:37:35 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $ */
+/* $NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $ */
 /*
  * Copyright (c) 1997 by Matthew Jacob
  * NASA AMES Research Center.
@@ -39,7 +39,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -70,7 +70,7 @@ CFATTACH_DECL_NEW(tlsb, 0,
 extern struct cfdriver tlsb_cd;
 
 static int	tlsbprint(void *, const char *);
-static const char *tlsb_node_type_str(uint32_t);
+static const char *tlsb_node_type_str(uint32_t, char *, size_t);
 
 /*
  * There can be only one TurboLaser, and we'll overload it
@@ -87,13 +87,15 @@ static int
 tlsbprint(void *aux, const char *pnp)
 {
 	struct tlsb_dev_attach_args *tap = aux;
+	char buf[64];
 
 	if (pnp)
 		aprint_normal("%s at %s node %d",
-		tlsb_node_type_str(tap->ta_dtype), pnp, tap->ta_node);
+		tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)),
+		pnp, tap->ta_node);
 	else
 		aprint_normal(" node %d: %s", tap->ta_node,
-		tlsb_node_type_str(tap->ta_dtype));
+		tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)));
 
 	return (UNCONF);
 }
@@ -124,7 +126,9 @@ tlsbattach(device_t parent, device_t sel
 	struct tlsb_dev_attach_args ta;
 	uint32_t tldev;
 	int node;
+	int ionodes = 0;
 	int locs[TLSBCF_NLOCS];
+	char buf[64];
 
 	printf("\n");
 
@@ -158,9 +162,11 @@ tlsbattach(device_t parent, device_t sel
 		 * 

CVS commit: src/sys/arch/alpha

2024-03-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 13:37:35 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/tlsb: tlsb.c tlsbvar.h

Log Message:
Tidy up TLSB autoconfiguration just a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/tlsb/tlsbvar.h

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



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:34:11 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module.  The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/gbus/mcclock_gbus.c

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



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:34:11 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
Alpha systems based on the "Laser" and "TurboLaser" system architecture
have an interesting feature: the RTC and console UART are present on each
CPU module, but only those peripherals on the "primary" CPU module matter,
because each CPU's module's periperals are mapped to the same physical
address, but are only accessible by that CPU module.  The firmware selects
a primary CPU to boot the system, and that CPU's RTC and UART are the
system RTC and console, respectively.

To handle this, on systems where it's needed, we wrap the RTC gettime/settime
calls and, if not running on the primary CPU already, cross-call to the primary
to perform the RTC access.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/gbus/mcclock_gbus.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/mcclock.c
diff -u src/sys/arch/alpha/alpha/mcclock.c:1.22 src/sys/arch/alpha/alpha/mcclock.c:1.23
--- src/sys/arch/alpha/alpha/mcclock.c:1.22	Wed Mar  6 06:30:48 2024
+++ src/sys/arch/alpha/alpha/mcclock.c	Wed Mar  6 07:34:11 2024
@@ -1,4 +1,33 @@
-/* $NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $ */
+/* $NetBSD: mcclock.c,v 1.23 2024/03/06 07:34:11 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,9 +58,10 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.23 2024/03/06 07:34:11 thorpej Exp $");
 
 #include "opt_clock_compat_osf1.h"
+#include "opt_multiprocessor.h"
 
 #include 
 #include 
@@ -40,6 +70,9 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 
 #include 
 #include 
 #include 
+#if defined(MULTIPROCESSOR)
+#include 
+#endif
 
 #include 
 
@@ -64,18 +97,95 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 
 #define UNIX_YEAR_OFFSET 0
 #endif
 
-
 static void mcclock_set_pcc_freq(struct mc146818_softc *);
 static void mcclock_init(void *);
 
+#if defined(MULTIPROCESSOR)
+struct mcclock_trampoline_arg {
+	todr_chip_handle_t	handle;	/* IN */
+	struct clock_ymdhms	*dt;	/* IN */
+	int			rv;	/* OUT */
+};
+
+static void
+mcclock_trampoline(void *arg1, void *arg2)
+{
+	int (*func)(todr_chip_handle_t, struct clock_ymdhms *) = arg1;
+	struct mcclock_trampoline_arg *arg = arg2;
+
+	arg->rv = (*func)(arg->handle, arg->dt);
+}
+
+static int
+mcclock_bounce(int (*func)(todr_chip_handle_t, struct clock_ymdhms *),
+struct mcclock_trampoline_arg *arg)
+{
+	/*
+	 * If we're not on the primary CPU, then we need to make
+	 * a cross-call to the primary to access the clock registers.
+	 * But we do a little work to avoid even calling into the
+	 * cross-call code if we can avoid it.
+	 */
+	int bound = curlwp_bind();
+
+	if (CPU_IS_PRIMARY(curcpu())) {
+		mcclock_trampoline(func, arg);
+		curlwp_bindx(bound);
+	} else {
+		curlwp_bindx(bound);
+		uint64_t token = xc_unicast(0, mcclock_trampoline,
+		func, arg, _info_primary);
+		xc_wait(token);
+	}
+	return arg->rv;
+}
+
+static int

CVS commit: src/sys/arch/alpha/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:22:45 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/alpha/alpha/cpu.c

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



CVS commit: src/sys/arch/alpha/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 07:22:45 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/alpha/alpha/cpu.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/cpu.c
diff -u src/sys/arch/alpha/alpha/cpu.c:1.107 src/sys/arch/alpha/alpha/cpu.c:1.108
--- src/sys/arch/alpha/alpha/cpu.c:1.107	Sun May 22 11:27:33 2022
+++ src/sys/arch/alpha/alpha/cpu.c	Wed Mar  6 07:22:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.107 2022/05/22 11:27:33 andvar Exp $ */
+/* $NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2022/05/22 11:27:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -82,7 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10
 #include 
 
 struct cpu_info cpu_info_primary __cacheline_aligned = {
-	.ci_curlwp = 
+	.ci_curlwp = ,
+	.ci_flags  = CPUF_PRIMARY|CPUF_RUNNING,
 };
 struct cpu_info *cpu_info_list __read_mostly = _info_primary;
 
@@ -450,7 +451,8 @@ cpuattach(device_t parent, device_t self
 	if (primary) {
 		cpu_announce_extensions(ci);
 #if defined(MULTIPROCESSOR)
-		ci->ci_flags |= CPUF_PRIMARY|CPUF_RUNNING;
+		KASSERT(ci->ci_flags & CPUF_PRIMARY);
+		KASSERT(ci->ci_flags & CPUF_RUNNING);
 		atomic_or_ulong(_booted, (1UL << ma->ma_slot));
 		atomic_or_ulong(_running, (1UL << ma->ma_slot));
 #endif /* MULTIPROCESSOR */



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 06:30:49 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c
src/sys/arch/alpha/isa: mcclock_isa.c
src/sys/arch/alpha/jensenio: mcclock_jensenio.c
src/sys/arch/alpha/tc: mcclock_ioasic.c

Log Message:
Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/isa/mcclock_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/jensenio/mcclock_jensenio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/tc/mcclock_ioasic.c

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



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 06:30:49 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: mcclock.c mcclockvar.h
src/sys/arch/alpha/gbus: mcclock_gbus.c
src/sys/arch/alpha/isa: mcclock_isa.c
src/sys/arch/alpha/jensenio: mcclock_jensenio.c
src/sys/arch/alpha/tc: mcclock_ioasic.c

Log Message:
Wrap the mcclock driver's mc146818_softc inside a new mcclock_softc.
This commit represents no functional change, but forms the basis for
a future functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/mcclock.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/mcclockvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/isa/mcclock_isa.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/jensenio/mcclock_jensenio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/tc/mcclock_ioasic.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/mcclock.c
diff -u src/sys/arch/alpha/alpha/mcclock.c:1.21 src/sys/arch/alpha/alpha/mcclock.c:1.22
--- src/sys/arch/alpha/alpha/mcclock.c:1.21	Thu Oct  1 07:21:36 2020
+++ src/sys/arch/alpha/alpha/mcclock.c	Wed Mar  6 06:30:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $ */
+/* $NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.22 2024/03/06 06:30:48 thorpej Exp $");
 
 #include "opt_clock_compat_osf1.h"
 
@@ -69,8 +69,9 @@ static void mcclock_set_pcc_freq(struct 
 static void mcclock_init(void *);
 
 void
-mcclock_attach(struct mc146818_softc *sc)
+mcclock_attach(struct mcclock_softc *msc)
 {
+	struct mc146818_softc *sc = >sc_mc146818;
 
 	sc->sc_year0 = 1900 + UNIX_YEAR_OFFSET;
 	sc->sc_flag = 0;	/* BINARY, 24HR */

Index: src/sys/arch/alpha/alpha/mcclockvar.h
diff -u src/sys/arch/alpha/alpha/mcclockvar.h:1.5 src/sys/arch/alpha/alpha/mcclockvar.h:1.6
--- src/sys/arch/alpha/alpha/mcclockvar.h:1.5	Sat Jul 21 11:59:56 2007
+++ src/sys/arch/alpha/alpha/mcclockvar.h	Wed Mar  6 06:30:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclockvar.h,v 1.5 2007/07/21 11:59:56 tsutsui Exp $ */
+/* $NetBSD: mcclockvar.h,v 1.6 2024/03/06 06:30:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -27,4 +27,13 @@
  * rights to redistribute these changes.
  */
 
-void mcclock_attach(struct mc146818_softc *);
+#ifndef _ALPHA_ALPHA_MCCLOCKVAR_H_
+#define	_ALPHA_ALPHA_MCCLOCKVAR_H_
+
+struct mcclock_softc {
+	struct mc146818_softc	sc_mc146818;
+};
+
+void	mcclock_attach(struct mcclock_softc *);
+
+#endif /* _ALPHA_ALPHA_MCCLOCKVAR_H_ */

Index: src/sys/arch/alpha/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.4
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3	Wed Mar  6 05:44:44 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Wed Mar  6 06:30:49 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.4 2024/03/06 06:30:49 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.4 2024/03/06 06:30:49 thorpej Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 static int	mcclock_gbus_match(device_t, cfdata_t, void *);
 static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mc146818_softc),
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_softc),
 mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
 static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
@@ -74,7 +74,8 @@ mcclock_gbus_match(device_t parent, cfda
 static void
 mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mc146818_softc *sc = device_private(self);
+	struct mcclock_softc *msc = device_private(self);
+	struct mc146818_softc *sc = >sc_mc146818;
 	struct gbus_attach_args *ga = aux;
 
 	sc->sc_dev = self;
@@ -88,7 +89,7 @@ mcclock_gbus_attach(device_t parent, dev
 	sc->sc_mcread  = mcclock_gbus_read;
 	sc->sc_mcwrite = mcclock_gbus_write;
 
-	mcclock_attach(sc);
+	mcclock_attach(msc);
 }
 
 static void

Index: src/sys/arch/alpha/isa/mcclock_isa.c
diff -u src/sys/arch/alpha/isa/mcclock_isa.c:1.21 src/sys/arch/alpha/isa/mcclock_isa.c:1.22
--- src/sys/arch/alpha/isa/mcclock_isa.c:1.21	Fri May  7 16:58:33 2021
+++ 

CVS commit: src/sys/arch/alpha/gbus

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:44:44 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
bus_space-ify.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/gbus/mcclock_gbus.c

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

Modified files:

Index: src/sys/arch/alpha/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.3
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2	Sat Mar  2 22:58:29 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Wed Mar  6 05:44:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.3 2024/03/06 05:44:44 thorpej Exp $");
 
 #include 
 #include 
@@ -43,8 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 
 #include 
 
-#include 		/* XXX */
-
 #include 
 
 #include 
@@ -54,27 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
 
 #include "ioconf.h"
 
-#define	KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
-/*
- * Registers are 64 bytes apart (and 1 byte wide)
- */
-#define	REGSHIFT	6
-
-struct mcclock_gbus_softc {
-	struct mc146818_softc	sc_mc146818;
-	unsigned long regbase;
-};
-
 static int	mcclock_gbus_match(device_t, cfdata_t, void *);
 static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_gbus_softc),
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mc146818_softc),
 mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
 static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
 static u_int	mcclock_gbus_read(struct mc146818_softc *, u_int);
 
-
 static int
 mcclock_gbus_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -88,14 +74,17 @@ mcclock_gbus_match(device_t parent, cfda
 static void
 mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mcclock_gbus_softc *tsc = device_private(self);
+	struct mc146818_softc *sc = device_private(self);
 	struct gbus_attach_args *ga = aux;
-	struct mc146818_softc *sc = >sc_mc146818;
-
-	/* XXX Should be bus.h'd, so we can accommodate the kn7aa. */
-	tsc->regbase = TLSB_GBUS_BASE + ga->ga_offset;
 
 	sc->sc_dev = self;
+	sc->sc_bst = ga->ga_iot;
+
+	if (bus_space_map(sc->sc_bst, ga->ga_offset, MC_NREGS+MC_NVRAM_SIZE,
+			  0, >sc_bsh) != 0) {
+		panic("mcclock_gbus_attach: couldn't map clock I/O space");
+	}
+
 	sc->sc_mcread  = mcclock_gbus_read;
 	sc->sc_mcwrite = mcclock_gbus_write;
 
@@ -105,19 +94,11 @@ mcclock_gbus_attach(device_t parent, dev
 static void
 mcclock_gbus_write(struct mc146818_softc *sc, u_int reg, u_int val)
 {
-	struct mcclock_gbus_softc *tsc = (void *)sc;
-	unsigned char *ptr = (unsigned char *)
-		KV(tsc->regbase + (reg << REGSHIFT));
-
-	*ptr = val;
+	bus_space_write_1(sc->sc_bst, sc->sc_bsh, reg, (uint8_t)val);
 }
 
 static u_int
 mcclock_gbus_read(struct mc146818_softc *sc, u_int reg)
 {
-	struct mcclock_gbus_softc *tsc = (void *)sc;
-	unsigned char *ptr = (unsigned char *)
-		KV(tsc->regbase + (reg << REGSHIFT));
-
-	return *ptr;
+	return bus_space_read_1(sc->sc_bst, sc->sc_bsh, reg);
 }



CVS commit: src/sys/arch/alpha/gbus

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:44:44 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
bus_space-ify.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/gbus/mcclock_gbus.c

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



CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:33:09 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/gbus: gbus.c gbusvar.h
Added Files:
src/sys/arch/alpha/gbus: gbus_io.c

Log Message:
Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus_io.c

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

Modified files:

Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.196 src/sys/arch/alpha/conf/files.alpha:1.197
--- src/sys/arch/alpha/conf/files.alpha:1.196	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/conf/files.alpha	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.196 2024/03/02 20:15:33 thorpej Exp $
+# $NetBSD: files.alpha,v 1.197 2024/03/06 05:33:09 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -104,6 +104,7 @@ file	arch/alpha/tlsb/tlsbmem.c	tlsbmem
 device	gbus { offset = -1 }
 attach	gbus at tlsb
 file	arch/alpha/gbus/gbus.c		gbus
+file	arch/alpha/gbus/gbus_io.c	gbus
 
 #
 # MCBUS support

Index: src/sys/arch/alpha/gbus/gbus.c
diff -u src/sys/arch/alpha/gbus/gbus.c:1.1 src/sys/arch/alpha/gbus/gbus.c:1.2
--- src/sys/arch/alpha/gbus/gbus.c:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/gbus.c	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: gbus.c,v 1.2 2024/03/06 05:33:09 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -37,7 +37,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.2 2024/03/06 05:33:09 thorpej Exp $");
 
 #include 
 #include 
@@ -70,10 +70,10 @@ CFATTACH_DECL_NEW(gbus, sizeof(struct gb
 static int	gbusprint(void *, const char *);
 
 static const struct gbus_attach_args gbus_children[] = {
-	{ "zsc",	GBUS_DUART0_OFFSET },
-	{ "zsc",	GBUS_DUART1_OFFSET },
-	{ "mcclock",	GBUS_CLOCK_OFFSET },
-	{ NULL,		0 },
+	{ "zsc",	NULL,	GBUS_DUART0_OFFSET },
+	{ "zsc",	NULL,	GBUS_DUART1_OFFSET },
+	{ "mcclock",	NULL,	GBUS_CLOCK_OFFSET },
+	{ NULL,		NULL,	0 },
 };
 
 static int
@@ -113,6 +113,7 @@ gbusattach(device_t parent, device_t sel
 	struct gbus_softc *sc = device_private(self);
 	struct tlsb_dev_attach_args *ta = aux;
 	const struct gbus_attach_args *ga;
+	bus_space_tag_t iot = gbus_io_init(TLSB_GBUS_BASE);
 	int locs[GBUSCF_NLOCS];
 
 	aprint_normal("\n");
@@ -123,6 +124,7 @@ gbusattach(device_t parent, device_t sel
 	/* Attach the children. */
 	for (ga = gbus_children; ga->ga_name != NULL; ga++) {
 		struct gbus_attach_args gaa = *ga;
+		gaa.ga_iot = iot;
 		locs[GBUSCF_OFFSET] = gaa.ga_offset;
 		config_found(self, , gbusprint,
 		CFARGS(.submatch = config_stdsubmatch,
Index: src/sys/arch/alpha/gbus/gbusvar.h
diff -u src/sys/arch/alpha/gbus/gbusvar.h:1.1 src/sys/arch/alpha/gbus/gbusvar.h:1.2
--- src/sys/arch/alpha/gbus/gbusvar.h:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/gbusvar.h	Wed Mar  6 05:33:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: gbusvar.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: gbusvar.h,v 1.2 2024/03/06 05:33:09 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,6 +30,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _ALPHA_GBUS_GBUSVAR_H_
+#define	_ALPHA_GBUS_GBUSVAR_H_
+
 /*
  * Autoconfiguration definitions for the Gbus found on TurboLaser CPU modules.
  */
@@ -37,6 +40,11 @@
 #include 
 
 struct gbus_attach_args {
-	const char *ga_name;		/* name of device */
-	bus_addr_t  ga_offset;		/* offset from Gbus base */
+	const char *	ga_name;	/* name of device */
+	bus_space_tag_t	ga_iot;		/* I/O space tag */
+	bus_addr_t	ga_offset;	/* offset from Gbus base */
 };
+
+bus_space_tag_t	gbus_io_init(paddr_t);
+
+#endif /* _ALPHA_GBUS_GBUSVAR_H_ */

Added files:

Index: src/sys/arch/alpha/gbus/gbus_io.c
diff -u /dev/null src/sys/arch/alpha/gbus/gbus_io.c:1.1
--- /dev/null	Wed Mar  6 05:33:10 2024
+++ src/sys/arch/alpha/gbus/gbus_io.c	Wed Mar  6 05:33:09 2024
@@ -0,0 +1,177 @@
+/* $NetBSD: gbus_io.c,v 1.1 2024/03/06 05:33:09 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the 

CVS commit: src/sys/arch/alpha

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Mar  6 05:33:09 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/gbus: gbus.c gbusvar.h
Added Files:
src/sys/arch/alpha/gbus: gbus_io.c

Log Message:
Add a bus space implementation for the Gbus, the general 8-bit bus present
on Laser / TurboLaser CPU modules.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus_io.c

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



CVS commit: src/sys/arch/alpha/alpha

2024-03-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  3 19:56:30 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: prom.c

Log Message:
prom_uses_prom_console() needs to consider ST_DEC_7000, as well.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/prom.c

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



CVS commit: src/sys/arch/alpha/alpha

2024-03-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  3 19:56:30 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: prom.c

Log Message:
prom_uses_prom_console() needs to consider ST_DEC_7000, as well.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/prom.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/prom.c
diff -u src/sys/arch/alpha/alpha/prom.c:1.58 src/sys/arch/alpha/alpha/prom.c:1.59
--- src/sys/arch/alpha/alpha/prom.c:1.58	Sat Oct  3 17:31:46 2020
+++ src/sys/arch/alpha/alpha/prom.c	Sun Mar  3 19:56:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.58 2020/10/03 17:31:46 thorpej Exp $ */
+/* $NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@@ -27,7 +27,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.58 2020/10/03 17:31:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -89,7 +89,7 @@ bool
 prom_uses_prom_console(void)
 {
 #ifdef _PROM_MAY_USE_PROM_CONSOLE
-	return (cputype == ST_DEC_21000);
+	return (cputype == ST_DEC_7000 || cputype == ST_DEC_21000);
 #else
 	return false;
 #endif



CVS commit: src/sys/arch/alpha/gbus

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 22:58:29 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
tlsb -> gbus.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/mcclock_gbus.c

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



CVS commit: src/sys/arch/alpha/gbus

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 22:58:29 UTC 2024

Modified Files:
src/sys/arch/alpha/gbus: mcclock_gbus.c

Log Message:
tlsb -> gbus.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/gbus/mcclock_gbus.c

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

Modified files:

Index: src/sys/arch/alpha/gbus/mcclock_gbus.c
diff -u src/sys/arch/alpha/gbus/mcclock_gbus.c:1.1 src/sys/arch/alpha/gbus/mcclock_gbus.c:1.2
--- src/sys/arch/alpha/gbus/mcclock_gbus.c:1.1	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/gbus/mcclock_gbus.c	Sat Mar  2 22:58:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mcclock_gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+/* $NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcclock_gbus.c,v 1.2 2024/03/02 22:58:29 thorpej Exp $");
 
 #include 
 #include 
@@ -60,23 +60,23 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_gbus
  */
 #define	REGSHIFT	6
 
-struct mcclock_tlsb_softc {
+struct mcclock_gbus_softc {
 	struct mc146818_softc	sc_mc146818;
 	unsigned long regbase;
 };
 
-static int	mcclock_tlsb_match(device_t, cfdata_t, void *);
-static void	mcclock_tlsb_attach(device_t, device_t, void *);
+static int	mcclock_gbus_match(device_t, cfdata_t, void *);
+static void	mcclock_gbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_tlsb_softc),
-mcclock_tlsb_match, mcclock_tlsb_attach, NULL, NULL);
+CFATTACH_DECL_NEW(mcclock_gbus, sizeof(struct mcclock_gbus_softc),
+mcclock_gbus_match, mcclock_gbus_attach, NULL, NULL);
 
-static void	mcclock_tlsb_write(struct mc146818_softc *, u_int, u_int);
-static u_int	mcclock_tlsb_read(struct mc146818_softc *, u_int);
+static void	mcclock_gbus_write(struct mc146818_softc *, u_int, u_int);
+static u_int	mcclock_gbus_read(struct mc146818_softc *, u_int);
 
 
 static int
-mcclock_tlsb_match(device_t parent, cfdata_t cf, void *aux)
+mcclock_gbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct gbus_attach_args *ga = aux;
 
@@ -86,9 +86,9 @@ mcclock_tlsb_match(device_t parent, cfda
 }
 
 static void
-mcclock_tlsb_attach(device_t parent, device_t self, void *aux)
+mcclock_gbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mcclock_tlsb_softc *tsc = device_private(self);
+	struct mcclock_gbus_softc *tsc = device_private(self);
 	struct gbus_attach_args *ga = aux;
 	struct mc146818_softc *sc = >sc_mc146818;
 
@@ -96,16 +96,16 @@ mcclock_tlsb_attach(device_t parent, dev
 	tsc->regbase = TLSB_GBUS_BASE + ga->ga_offset;
 
 	sc->sc_dev = self;
-	sc->sc_mcread  = mcclock_tlsb_read;
-	sc->sc_mcwrite = mcclock_tlsb_write;
+	sc->sc_mcread  = mcclock_gbus_read;
+	sc->sc_mcwrite = mcclock_gbus_write;
 
 	mcclock_attach(sc);
 }
 
 static void
-mcclock_tlsb_write(struct mc146818_softc *sc, u_int reg, u_int val)
+mcclock_gbus_write(struct mc146818_softc *sc, u_int reg, u_int val)
 {
-	struct mcclock_tlsb_softc *tsc = (void *)sc;
+	struct mcclock_gbus_softc *tsc = (void *)sc;
 	unsigned char *ptr = (unsigned char *)
 		KV(tsc->regbase + (reg << REGSHIFT));
 
@@ -113,9 +113,9 @@ mcclock_tlsb_write(struct mc146818_softc
 }
 
 static u_int
-mcclock_tlsb_read(struct mc146818_softc *sc, u_int reg)
+mcclock_gbus_read(struct mc146818_softc *sc, u_int reg)
 {
-	struct mcclock_tlsb_softc *tsc = (void *)sc;
+	struct mcclock_gbus_softc *tsc = (void *)sc;
 	unsigned char *ptr = (unsigned char *)
 		KV(tsc->regbase + (reg << REGSHIFT));
 



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 20:15:33 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: cpuconf.c
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/include: prom.h
Added Files:
src/sys/arch/alpha/alpha: dec_kn7aa.c

Log Message:
Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 1.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/cpuconf.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/alpha/dec_kn7aa.c
cvs rdiff -u -r1.419 -r1.420 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/include/prom.h

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



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 20:15:33 UTC 2024

Modified Files:
src/sys/arch/alpha/alpha: cpuconf.c
src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha
src/sys/arch/alpha/include: prom.h
Added Files:
src/sys/arch/alpha/alpha: dec_kn7aa.c

Log Message:
Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 1.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/cpuconf.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/alpha/dec_kn7aa.c
cvs rdiff -u -r1.419 -r1.420 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/alpha/conf/INSTALL
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/include/prom.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/alpha/alpha/cpuconf.c
diff -u src/sys/arch/alpha/alpha/cpuconf.c:1.37 src/sys/arch/alpha/alpha/cpuconf.c:1.38
--- src/sys/arch/alpha/alpha/cpuconf.c:1.37	Mon Apr  8 00:47:21 2019
+++ src/sys/arch/alpha/alpha/cpuconf.c	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuconf.c,v 1.37 2019/04/08 00:47:21 thorpej Exp $ */
+/* $NetBSD: cpuconf.c,v 1.38 2024/03/02 20:15:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 1.37 2019/04/08 00:47:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 1.38 2024/03/02 20:15:33 thorpej Exp $");
 
 #include 
 #include 
@@ -68,6 +68,13 @@ __KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 
 #include 
 #include 
 
+#include "opt_dec_kn7aa.h"
+#ifdef DEC_KN7AA
+extern void dec_kn7aa_init(void);
+#else
+#define	dec_kn7aa_init		platform_not_configured
+#endif
+
 #include "opt_dec_3000_500.h"
 #ifdef DEC_3000_500
 extern void dec_3000_500_init(void);
@@ -208,7 +215,7 @@ extern void dec_2000_300_init(void);
 static const struct cpuinit cpuinit[] = {
 	cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
 	cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
-	cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
+	cpu_init(ST_DEC_7000, dec_kn7aa_init, "DEC_KN7AA"),
 	cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
 	cpu_init(ST_DEC_2000_300, dec_2000_300_init, "DEC_2000_300"),
 	cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),

Index: src/sys/arch/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.419 src/sys/arch/alpha/conf/GENERIC:1.420
--- src/sys/arch/alpha/conf/GENERIC:1.419	Sun Dec 17 18:48:53 2023
+++ src/sys/arch/alpha/conf/GENERIC	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.419 2023/12/17 18:48:53 andvar Exp $
+# $NetBSD: GENERIC,v 1.420 2024/03/02 20:15:33 thorpej Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.419 $"
+ident		"GENERIC-$Revision: 1.420 $"
 
 maxusers 32
 
@@ -34,6 +34,7 @@ options 	DEC_AXPPCI_33	# NoName:	AXPpci3
 options 	DEC_EB164	# EB164:	AlphaPC 164
 options 	DEC_EB64PLUS	# EB64+:	AlphaPC 64, etc.
 options 	DEC_KN20AA	# KN20AA:	AlphaStation 500 and 600
+options 	DEC_KN7AA	# KN7AA:	DEC 7000 and 1
 options 	DEC_KN8AE	# KN8AE:	AlphaServer 8200 and 8400
 options 	DEC_KN300	# KN300:	AlphaServer 4100 and 1200
 options 	DEC_550		# Miata:	Digital Personal Workstation

Index: src/sys/arch/alpha/conf/INSTALL
diff -u src/sys/arch/alpha/conf/INSTALL:1.118 src/sys/arch/alpha/conf/INSTALL:1.119
--- src/sys/arch/alpha/conf/INSTALL:1.118	Fri Jul 23 14:38:58 2021
+++ src/sys/arch/alpha/conf/INSTALL	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.118 2021/07/23 14:38:58 thorpej Exp $
+# $NetBSD: INSTALL,v 1.119 2024/03/02 20:15:33 thorpej Exp $
 #
 # Alpha INSTALL kernel.
 
@@ -29,6 +29,7 @@ options 	DEC_AXPPCI_33	# NoName:	AXPpci3
 options 	DEC_EB164	# EB164:	AlphaPC 164
 options 	DEC_EB64PLUS	# EB64+:	AlphaPC 64, etc.
 options 	DEC_KN20AA	# KN20AA:	AlphaStation 500 and 600
+options 	DEC_KN7AA	# KN7AA:	DEC 7000 and 1
 options 	DEC_KN8AE	# KN8AE:	AlphaServer 8200 and 8400
 options 	DEC_KN300	# KN300:	AlphaServer 4100 and 1200
 options 	DEC_550		# Miata:	Digital Personal Workstation

Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.195 src/sys/arch/alpha/conf/files.alpha:1.196
--- src/sys/arch/alpha/conf/files.alpha:1.195	Sat Mar  2 19:57:57 2024
+++ src/sys/arch/alpha/conf/files.alpha	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.195 2024/03/02 19:57:57 thorpej Exp $
+# $NetBSD: 

CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 19:57:58 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
Added Files:
src/sys/arch/alpha/gbus: gbus.c gbusreg.h gbusvar.h mcclock_gbus.c
Removed Files:
src/sys/arch/alpha/tlsb: gbus.c gbusreg.h gbusvar.h mcclock_tlsb.c

Log Message:
Shuffle GBus-related files into their own directory in preparation for
other GBus attachments.  No functional change here; just minimal editing
to reflect path differences after moving the files.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusreg.h src/sys/arch/alpha/gbus/gbusvar.h \
src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.25 -r0 src/sys/arch/alpha/tlsb/gbus.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/alpha/tlsb/gbusreg.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/alpha/tlsb/gbusvar.h
cvs rdiff -u -r1.18 -r0 src/sys/arch/alpha/tlsb/mcclock_tlsb.c

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

Modified files:

Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.194 src/sys/arch/alpha/conf/files.alpha:1.195
--- src/sys/arch/alpha/conf/files.alpha:1.194	Wed Oct 21 13:31:50 2020
+++ src/sys/arch/alpha/conf/files.alpha	Sat Mar  2 19:57:57 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.194 2020/10/21 13:31:50 christos Exp $
+# $NetBSD: files.alpha,v 1.195 2024/03/02 19:57:57 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -96,9 +96,13 @@ device	tlsbmem
 attach	tlsbmem at tlsb
 file	arch/alpha/tlsb/tlsbmem.c	tlsbmem
 
+#
+# GBus support
+#
+
 device	gbus { offset = -1 }
 attach	gbus at tlsb
-file	arch/alpha/tlsb/gbus.c		gbus
+file	arch/alpha/gbus/gbus.c		gbus
 
 #
 # MCBUS support
@@ -316,7 +320,6 @@ attach	fdc at sableio with fdc_sableio
 file	arch/alpha/sableio/fdc_sableio.c	fdc_sableio
 
 # CPU support files
-file	arch/alpha/alpha/dec_2000_300.c	dec_2000_300
 file	arch/alpha/pci/pci_2100_a50.c	dec_2100_a50
 file	arch/alpha/pci/pci_2100_a500.c	dec_2100_a500 | dec_2100a_a500
 file	arch/alpha/pci/pci_up1000.c	api_up1000
@@ -358,12 +361,12 @@ file	arch/alpha/pci/sio_pic.c	sio | pceb
 device	mcclock: mc146818
 attach	mcclock at ioasic with mcclock_ioasic
 attach	mcclock at isa with mcclock_isa
-attach	mcclock at gbus with mcclock_tlsb
+attach	mcclock at gbus with mcclock_gbus
 attach	mcclock at jensenio with mcclock_jensenio
 file	arch/alpha/alpha/mcclock.c	mcclock
 file	arch/alpha/tc/mcclock_ioasic.c	mcclock_ioasic
 file	arch/alpha/isa/mcclock_isa.c	mcclock_isa
-file	arch/alpha/tlsb/mcclock_tlsb.c	mcclock_tlsb
+file	arch/alpha/gbus/mcclock_gbus.c	mcclock_gbus
 file	arch/alpha/jensenio/mcclock_jensenio.c	mcclock_jensenio
 
 
@@ -401,6 +404,7 @@ file	dev/bus_dma/bus_dmamem_common.c
 file	arch/alpha/alpha/promcons.c
 
 # CPU support
+file	arch/alpha/alpha/dec_2000_300.c		dec_2000_300
 file	arch/alpha/alpha/dec_2100_a50.c		dec_2100_a50
 file	arch/alpha/alpha/dec_2100_a500.c	dec_2100_a500 | dec_2100a_a500
 file	arch/alpha/alpha/dec_3000_300.c		dec_3000_300

Added files:

Index: src/sys/arch/alpha/gbus/gbus.c
diff -u /dev/null src/sys/arch/alpha/gbus/gbus.c:1.1
--- /dev/null	Sat Mar  2 19:57:58 2024
+++ src/sys/arch/alpha/gbus/gbus.c	Sat Mar  2 19:57:57 2024
@@ -0,0 +1,131 @@
+/* $NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1997 by Matthew Jacob
+ * NASA AMES Research Center.
+ * 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 immediately at the beginning of the file, without modification,
+ *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.
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  2 19:57:58 UTC 2024

Modified Files:
src/sys/arch/alpha/conf: files.alpha
Added Files:
src/sys/arch/alpha/gbus: gbus.c gbusreg.h gbusvar.h mcclock_gbus.c
Removed Files:
src/sys/arch/alpha/tlsb: gbus.c gbusreg.h gbusvar.h mcclock_tlsb.c

Log Message:
Shuffle GBus-related files into their own directory in preparation for
other GBus attachments.  No functional change here; just minimal editing
to reflect path differences after moving the files.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/gbus/gbus.c \
src/sys/arch/alpha/gbus/gbusreg.h src/sys/arch/alpha/gbus/gbusvar.h \
src/sys/arch/alpha/gbus/mcclock_gbus.c
cvs rdiff -u -r1.25 -r0 src/sys/arch/alpha/tlsb/gbus.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/alpha/tlsb/gbusreg.h
cvs rdiff -u -r1.3 -r0 src/sys/arch/alpha/tlsb/gbusvar.h
cvs rdiff -u -r1.18 -r0 src/sys/arch/alpha/tlsb/mcclock_tlsb.c

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



CVS commit: src/sys/arch/alpha/alpha

2023-12-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 30 23:07:42 UTC 2023

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

Log Message:
pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(),
as it is designed to wrap from 1023->0 during the normal course of use.
However, when setting up the initial kernel page tables, if we have a
large enough config that we end up with more than L2 PT page, we rely
on being able to index > 1023 into the adjacent PT pages to initialize
those entries.

Fixes a MM fault panic during early boot on larger memory configs
(reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB
DS25).  I've successfully booted at 16GB config in Qemu with this fix.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.307 src/sys/arch/alpha/alpha/pmap.c:1.308
--- src/sys/arch/alpha/alpha/pmap.c:1.307	Sat Apr  9 23:38:31 2022
+++ src/sys/arch/alpha/alpha/pmap.c	Sat Dec 30 23:07:42 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.307 2022/04/09 23:38:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.308 2023/12/30 23:07:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.307 2022/04/09 23:38:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.308 2023/12/30 23:07:42 thorpej Exp $");
 
 #include 
 #include 
@@ -1204,13 +1204,15 @@ static bool	vtophys_internal(vaddr_t, pa
 	l1pte_ = pmap_l1pte(kernel_lev1map, va);			\
 	if (pmap_pte_v(l1pte_) == 0) {	\
 		printf("kernel level 1 PTE not valid, va 0x%lx "	\
-		"(line %d)\n", (va), __LINE__);			\
+		"(line %d) pte=%p *pte=0x%016lx\n", (va), __LINE__,	\
+		l1pte_, *l1pte_);	\
 		panic("PMAP_KERNEL_PTE");\
 	}\
 	l2pte_ = pmap_l2pte(kernel_lev1map, va, l1pte_);		\
 	if (pmap_pte_v(l2pte_) == 0) {	\
 		printf("kernel level 2 PTE not valid, va 0x%lx "	\
-		"(line %d)\n", (va), __LINE__);			\
+		"(line %d) pte=%p *pte=0x%016lx\n", (va), __LINE__,	\
+		l2pte_, *l2pte_);	\
 		panic("PMAP_KERNEL_PTE");\
 	}\
 	pmap_l3pte(kernel_lev1map, va, l2pte_);\
@@ -1358,8 +1360,19 @@ pmap_bootstrap(paddr_t ptaddr, u_int max
 		pte = (ALPHA_K0SEG_TO_PHYS(((vaddr_t)lev3map) +
 		(i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT;
 		pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED;
-		lev2map[l2pte_index(VM_MIN_KERNEL_ADDRESS+
-		(i*PAGE_SIZE*NPTEPG))] = pte;
+		/*
+		 * No need to use l2pte_index() here; it's equivalent
+		 * to just indexing with our loop variable i, but will
+		 * fall over if we end up with more than 1 L2 PT page.
+		 *
+		 * In other words:
+		 *
+		 *	l2pte_index(VM_MIN_KERNEL_ADDRESS +
+		 *	(i*PAGE_SIZE*NPTEPG))
+		 *
+		 * ...is the same as 'i' so long as i stays below 1024.
+		 */
+		lev2map[i] = pte;
 	}
 
 	/* Initialize the pmap_growkernel_lock. */



CVS commit: src/sys/arch/alpha/alpha

2023-12-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 30 23:07:42 UTC 2023

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

Log Message:
pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(),
as it is designed to wrap from 1023->0 during the normal course of use.
However, when setting up the initial kernel page tables, if we have a
large enough config that we end up with more than L2 PT page, we rely
on being able to index > 1023 into the adjacent PT pages to initialize
those entries.

Fixes a MM fault panic during early boot on larger memory configs
(reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB
DS25).  I've successfully booted at 16GB config in Qemu with this fix.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/arch/alpha/alpha/pmap.c

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



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

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 18:48:53 UTC 2023

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

Log Message:
s/keyboad/keyboard/ in wsmux description comment.


To generate a diff of this commit:
cvs rdiff -u -r1.418 -r1.419 src/sys/arch/alpha/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/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.418 src/sys/arch/alpha/conf/GENERIC:1.419
--- src/sys/arch/alpha/conf/GENERIC:1.418	Thu Feb  9 14:09:47 2023
+++ src/sys/arch/alpha/conf/GENERIC	Sun Dec 17 18:48:53 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.418 2023/02/09 14:09:47 abs Exp $
+# $NetBSD: GENERIC,v 1.419 2023/12/17 18:48:53 andvar Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.418 $"
+ident		"GENERIC-$Revision: 1.419 $"
 
 maxusers 32
 
@@ -728,7 +728,7 @@ pseudo-device	vcoda			# coda minicache <
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	wsfont
-pseudo-device	wsmux			# mouse and keyboad multiplexing
+pseudo-device	wsmux			# mouse and keyboard multiplexing
 pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	lockstat		# lock profiling
 pseudo-device	bcsp			# BlueCore Serial Protocol



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

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 18:48:53 UTC 2023

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

Log Message:
s/keyboad/keyboard/ in wsmux description comment.


To generate a diff of this commit:
cvs rdiff -u -r1.418 -r1.419 src/sys/arch/alpha/conf/GENERIC

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



CVS commit: src/sys/arch/alpha/pci

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec  6 01:46:34 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: pci_bwx_bus_io_chipdep.c
pci_bwx_bus_mem_chipdep.c pci_swiz_bus_io_chipdep.c

Log Message:
bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c

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

Modified files:

Index: src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.23 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.24
--- src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c:1.23	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.24 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.24 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -486,7 +486,7 @@ __C(CHIP,_io_alloc)(
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG

Index: src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.30
--- src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c:1.29	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.30 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.30 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -467,7 +467,7 @@ __C(CHIP,_mem_alloc)(
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG

Index: src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
diff -u src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.45
--- src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c:1.44	Mon Dec  4 00:32:10 2023
+++ src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c	Wed Dec  6 01:46:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $ */
+/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.45 2023/12/06 01:46:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.45 2023/12/06 01:46:34 thorpej Exp $");
 
 #include 
 
@@ -573,7 +573,7 @@ __C(CHIP,_io_alloc)(void *v, bus_addr_t 
 			boundary,		/* nocross */
 			rstart,		/* minaddr */
 			rend,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			);
 	if (error) {
 #ifdef EXTENT_DEBUG



CVS commit: src/sys/arch/alpha/pci

2023-12-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec  6 01:46:34 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: pci_bwx_bus_io_chipdep.c
pci_bwx_bus_mem_chipdep.c pci_swiz_bus_io_chipdep.c

Log Message:
bus_space_alloc() -- vmem(9) requires an allocation stragegy flag, so
make sure to pass one.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c

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



CVS commit: src/sys/arch/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.31 

CVS commit: src/sys/arch/alpha

2023-12-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec  4 00:32:10 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c dec_1000a.c dec_2000_300.c
dec_2100_a50.c dec_2100_a500.c dec_550.c dec_6600.c
dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c
dec_eb66.c dec_kn20aa.c
src/sys/arch/alpha/jensenio: jensenio.c jensenio_bus_intio.c
jensenio_bus_io.c jensenio_bus_mem.c jenseniovar.h
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecsvar.h cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c ciavar.h dwlpx_bus_io.c
dwlpx_bus_mem.c dwlpxvar.h irongate.c irongate_bus_io.c
irongate_bus_mem.c irongatevar.h lca.c lca_bus_io.c lca_bus_mem.c
lcavar.h mcpcia.c mcpcia_bus_io.c mcpcia_bus_mem.c mcpciavar.h
pci_bwx_bus_io_chipdep.c pci_bwx_bus_mem_chipdep.c
pci_swiz_bus_io_chipdep.c pci_swiz_bus_mem_chipdep.c tsc.c
tsp_bus_io.c tsp_bus_mem.c tsvar.h ttwoga.c ttwoga_bus_io.c
ttwoga_bus_mem.c ttwogavar.h

Log Message:
Convert the Alpha port's bus_space back-end to manage address space
with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_550.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/jensenio/jensenio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c \
src/sys/arch/alpha/jensenio/jenseniovar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c \
src/sys/arch/alpha/pci/lcavar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecsvar.h \
src/sys/arch/alpha/pci/dwlpxvar.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c \
src/sys/arch/alpha/pci/mcpciavar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_io.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/ciavar.h \
src/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongatevar.h \
src/sys/arch/alpha/pci/ttwogavar.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/tsvar.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.c

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



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:58:02 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Changes to let the Alpha DDB code build in user-space for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.41 src/sys/arch/alpha/alpha/db_interface.c:1.42
--- src/sys/arch/alpha/alpha/db_interface.c:1.41	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Wed Nov 22 01:58:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.42 2023/11/22 01:58:02 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.42 2023/11/22 01:58:02 thorpej Exp $");
 
 #include 
 #include 
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -79,7 +80,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 
-
 #if 0
 extern char *trap_type[];
 extern int trap_types;
@@ -159,10 +159,13 @@ db_alpha_regop(const struct db_variable 
 	unsigned long zeroval = 0;
 	struct trapframe *f = NULL;
 
+#ifdef _KERNEL			/* XXX ?? */
 	if (vp->modif != NULL && *vp->modif == 'u') {
 		if (curlwp != NULL)
 			f = curlwp->l_md.md_tf;
-	} else	f = DDB_REGS;
+	} else
+#endif /* _KERNEL */
+		f = DDB_REGS;
 	tfaddr = f == NULL ?  : >tf_regs[(u_long)vp->valuep];
 	switch (opcode) {
 	case DB_VAR_GET:
@@ -174,12 +177,16 @@ db_alpha_regop(const struct db_variable 
 		break;
 
 	default:
+#ifdef _KERNEL
 		panic("db_alpha_regop: unknown op %d", opcode);
+#endif
+		break;
 	}
 
 	return (0);
 }
 
+#ifdef _KERNEL
 /*
  * ddb_trap - field a kernel trap
  */
@@ -269,6 +276,7 @@ cpu_Debugger(void)
 
 	__asm volatile("call_pal 0x81");		/* bugchk */
 }
+#endif /* _KERNEL */
 
 /*
  * Alpha-specific ddb commands:
@@ -372,6 +380,7 @@ db_register_value(db_regs_t *regs, int r
 	return (regs->tf_regs[reg_to_frame[regno]]);
 }
 
+#ifdef _KERNEL
 /*
  * Support functions for software single-step.
  */
@@ -576,6 +585,7 @@ db_branch_taken(int ins, db_addr_t pc, d
 
 	return (newpc);
 }
+#endif /* _KERNEL */
 
 unsigned long
 db_alpha_read_saved_reg(unsigned long *regp)
@@ -605,6 +615,9 @@ db_alpha_nlist db_alpha_nl[] = {
 	DB_ALPHA_SYM(SYM_XentRestart, XentRestart),
 	DB_ALPHA_SYM(SYM_exception_return, exception_return),
 	DB_ALPHA_SYM(SYM_alpha_kthread_backstop, alpha_kthread_backstop),
+#ifndef _KERNEL
+	DB_ALPHA_SYM(SYM_dumppcb, dumppcb),
+#endif /* _KERNEL */
 	DB_ALPHA_SYM_EOL
 };
 

Index: src/sys/arch/alpha/include/db_machdep.h
diff -u src/sys/arch/alpha/include/db_machdep.h:1.22 src/sys/arch/alpha/include/db_machdep.h:1.23
--- src/sys/arch/alpha/include/db_machdep.h:1.22	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/include/db_machdep.h	Wed Nov 22 01:58:02 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.22 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_machdep.h,v 1.23 2023/11/22 01:58:02 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -38,6 +38,8 @@
 #include 
 #include 
 
+#include 
+
 typedef	vaddr_t		db_addr_t;	/* address - unsigned */
 #define	DDB_EXPR_FMT	"l"		/* expression is long */
 typedef	long		db_expr_t;	/* expression - signed */
@@ -195,8 +197,14 @@ typedef long		kgdb_reg_t;
 #define	SYM_XentRestart			6
 #define	SYM_exception_return		7
 #define	SYM_alpha_kthread_backstop	8
+#ifdef _KERNEL
 #define	SYM___eol			(SYM_alpha_kthread_backstop + 1)
+#else
+#define	SYM_dumppcb			9
+#define	SYM___eol			(SYM_dumppcb + 1)
+#endif /* _KERNEL */
 
+#ifdef _KERNEL
 struct db_alpha_nlist {
 	vaddr_t		n_value;
 };
@@ -205,6 +213,14 @@ typedef struct db_alpha_nlist db_alpha_n
 
 #define	DB_ALPHA_SYM(i, x)	[(i)] = { .n_value = (vaddr_t)&(x) }
 #define	DB_ALPHA_SYM_EOL	[SYM___eol] = { .n_value = 0 }
+#else
+#include 
+
+typedef struct nlist db_alpha_nlist;
+
+#define	DB_ALPHA_SYM(i, x)	[(i)] = { .n_name = __STRING(x) }
+#define	DB_ALPHA_SYM_EOL	[SYM___eol] = { .n_name = NULL }
+#endif /* _KERNEL */
 
 bool		db_alpha_sym_is_trap(db_addr_t);
 bool		db_alpha_sym_is_backstop(db_addr_t);



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:58:02 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Changes to let the Alpha DDB code build in user-space for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/include/db_machdep.h

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



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:56:14 UTC 2023

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

Log Message:
If not _KERNEL, include  to make sure we have offsetof().


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/include/cpu.h

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



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 01:56:14 UTC 2023

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

Log Message:
If not _KERNEL, include  to make sure we have offsetof().


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/include/cpu.h

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

Modified files:

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.104 src/sys/arch/alpha/include/cpu.h:1.105
--- src/sys/arch/alpha/include/cpu.h:1.104	Sat Aug 14 17:51:18 2021
+++ src/sys/arch/alpha/include/cpu.h	Wed Nov 22 01:56:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.104 2021/08/14 17:51:18 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.105 2023/11/22 01:56:14 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -89,6 +89,10 @@
 #include 
 #include 
 
+#ifndef _KERNEL
+#include 
+#endif /* ! _KERNEL */
+
 /*
  * Machine check information.
  */



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:27:41 UTC 2023

Modified Files:
src/sys/arch/alpha/include: alpha_instruction.h

Log Message:
Expose alpha_print_instruction_context to not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/include/alpha_instruction.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/alpha/include/alpha_instruction.h
diff -u src/sys/arch/alpha/include/alpha_instruction.h:1.1 src/sys/arch/alpha/include/alpha_instruction.h:1.2
--- src/sys/arch/alpha/include/alpha_instruction.h:1.1	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/include/alpha_instruction.h	Tue Nov 21 22:27:41 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_instruction.h,v 1.1 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: alpha_instruction.h,v 1.2 2023/11/21 22:27:41 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -746,7 +746,6 @@ typedef union {
 #define	op_cvtgd_su	0x5ad
 #define	op_cvtgqg_sv	0x5af
 
-#ifdef _KERNEL
 struct alpha_print_instruction_context {
 	unsigned long pc;	/* address of insn */
 	alpha_instruction insn;	/* instruction bits */
@@ -755,6 +754,7 @@ struct alpha_print_instruction_context {
 	size_t	cursor;		/* current next output location */
 };
 
+#ifdef _KERNEL
 int	alpha_print_instruction(struct alpha_print_instruction_context *);
 #endif /* _KERNEL */
 



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

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:27:41 UTC 2023

Modified Files:
src/sys/arch/alpha/include: alpha_instruction.h

Log Message:
Expose alpha_print_instruction_context to not-_KERNEL.


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

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



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:25:16 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c

Log Message:
pal_opname(): Make the static buffer for unknown PALcode ops large enough
to hold all possible values.
alpha_print_instruction(): Make this private if not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_disasm.c
diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.19 src/sys/arch/alpha/alpha/db_disasm.c:1.20
--- src/sys/arch/alpha/alpha/db_disasm.c:1.19	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/alpha/db_disasm.c	Tue Nov 21 22:25:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,7 +48,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ static const struct tbl pal_op_tbl[] = {
 static const char *
 pal_opname(int op)
 {
-	static char unk[8];
+	static char unk[11];
 	int i;
 
 	for (i = 0; pal_op_tbl[i].name != NULL; i++) {
@@ -199,7 +199,7 @@ pal_opname(int op)
 			return (pal_op_tbl[i].name);
 	}
 
-	snprintf(unk, sizeof(unk), "0x%x", op);
+	snprintf(unk, sizeof(unk), "0x%08x", op);
 	return (unk);
 }
 
@@ -813,6 +813,9 @@ insn_printf(struct alpha_print_instructi
  * next instruction.
  */
 
+#ifndef _KERNEL
+static
+#endif
 int
 alpha_print_instruction(struct alpha_print_instruction_context *ctx)
 {



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:25:16 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c

Log Message:
pal_opname(): Make the static buffer for unknown PALcode ops large enough
to hold all possible values.
alpha_print_instruction(): Make this private if not-_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.c

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



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:19:13 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c db_interface.c db_trace.c
fp_complete.c patch.c trap.c
Added Files:
src/sys/arch/alpha/include: alpha_instruction.h
Removed Files:
src/sys/arch/alpha/alpha: db_instruction.h

Log Message:
Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/db_disasm.c
cvs rdiff -u -r1.13 -r0 src/sys/arch/alpha/alpha/db_instruction.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/fp_complete.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/alpha/patch.c
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/alpha/alpha/trap.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/include/alpha_instruction.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/alpha/alpha/db_disasm.c
diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.18 src/sys/arch/alpha/alpha/db_disasm.c:1.19
--- src/sys/arch/alpha/alpha/db_disasm.c:1.18	Mon Jun 21 02:10:46 2021
+++ src/sys/arch/alpha/alpha/db_disasm.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -48,13 +48,13 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.40 src/sys/arch/alpha/alpha/db_interface.c:1.41
--- src/sys/arch/alpha/alpha/db_interface.c:1.40	Tue Nov 21 21:53:06 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.38 src/sys/arch/alpha/alpha/db_trace.c:1.39
--- src/sys/arch/alpha/alpha/db_trace.c:1.38	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.39 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.39 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 

Index: src/sys/arch/alpha/alpha/fp_complete.c
diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.30 src/sys/arch/alpha/alpha/fp_complete.c:1.31
--- src/sys/arch/alpha/alpha/fp_complete.c:1.30	Sun May 22 11:27:33 2022
+++ src/sys/arch/alpha/alpha/fp_complete.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.30 2022/05/22 11:27:33 andvar Exp $ */
+/* $NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -37,7 +37,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.30 2022/05/22 11:27:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: fp_complete.
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 

Index: src/sys/arch/alpha/alpha/patch.c
diff -u src/sys/arch/alpha/alpha/patch.c:1.7 src/sys/arch/alpha/alpha/patch.c:1.8
--- src/sys/arch/alpha/alpha/patch.c:1.7	Tue Jul 13 01:59:10 2021
+++ src/sys/arch/alpha/alpha/patch.c	Tue Nov 21 22:19:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.7 2021/07/13 01:59:10 thorpej Exp $	*/
+/*	$NetBSD: patch.c,v 1.8 2023/11/21 22:19:12 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, 

CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 22:19:13 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_disasm.c db_interface.c db_trace.c
fp_complete.c patch.c trap.c
Added Files:
src/sys/arch/alpha/include: alpha_instruction.h
Removed Files:
src/sys/arch/alpha/alpha: db_instruction.h

Log Message:
Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/db_disasm.c
cvs rdiff -u -r1.13 -r0 src/sys/arch/alpha/alpha/db_instruction.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/fp_complete.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/alpha/patch.c
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/alpha/alpha/trap.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/include/alpha_instruction.h

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



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:53:06 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c

Log Message:
Ensure that all fields of db_regs[] are initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/db_interface.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.39 src/sys/arch/alpha/alpha/db_interface.c:1.40
--- src/sys/arch/alpha/alpha/db_interface.c:1.39	Tue Nov 21 21:23:56 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 21:53:06 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $");
 
 #include 
 #include 
@@ -105,45 +105,53 @@ static int db_alpha_regop(const struct d
 
 #define	dbreg(xx)	((long *)(xx))
 
+#define	DBREG(n, r)		\
+	{	.name = __STRING(n),\
+		.valuep = ((long *)(r)),			\
+		.fcn = db_alpha_regop,\
+		.modif = NULL, }
+
 const struct db_variable db_regs[] = {
-	{	"v0",	dbreg(FRAME_V0),	db_alpha_regop	},
-	{	"t0",	dbreg(FRAME_T0),	db_alpha_regop	},
-	{	"t1",	dbreg(FRAME_T1),	db_alpha_regop	},
-	{	"t2",	dbreg(FRAME_T2),	db_alpha_regop	},
-	{	"t3",	dbreg(FRAME_T3),	db_alpha_regop	},
-	{	"t4",	dbreg(FRAME_T4),	db_alpha_regop	},
-	{	"t5",	dbreg(FRAME_T5),	db_alpha_regop	},
-	{	"t6",	dbreg(FRAME_T6),	db_alpha_regop	},
-	{	"t7",	dbreg(FRAME_T7),	db_alpha_regop	},
-	{	"s0",	dbreg(FRAME_S0),	db_alpha_regop	},
-	{	"s1",	dbreg(FRAME_S1),	db_alpha_regop	},
-	{	"s2",	dbreg(FRAME_S2),	db_alpha_regop	},
-	{	"s3",	dbreg(FRAME_S3),	db_alpha_regop	},
-	{	"s4",	dbreg(FRAME_S4),	db_alpha_regop	},
-	{	"s5",	dbreg(FRAME_S5),	db_alpha_regop	},
-	{	"s6",	dbreg(FRAME_S6),	db_alpha_regop	},
-	{	"a0",	dbreg(FRAME_A0),	db_alpha_regop	},
-	{	"a1",	dbreg(FRAME_A1),	db_alpha_regop	},
-	{	"a2",	dbreg(FRAME_A2),	db_alpha_regop	},
-	{	"a3",	dbreg(FRAME_A3),	db_alpha_regop	},
-	{	"a4",	dbreg(FRAME_A4),	db_alpha_regop	},
-	{	"a5",	dbreg(FRAME_A5),	db_alpha_regop	},
-	{	"t8",	dbreg(FRAME_T8),	db_alpha_regop	},
-	{	"t9",	dbreg(FRAME_T9),	db_alpha_regop	},
-	{	"t10",	dbreg(FRAME_T10),	db_alpha_regop	},
-	{	"t11",	dbreg(FRAME_T11),	db_alpha_regop	},
-	{	"ra",	dbreg(FRAME_RA),	db_alpha_regop	},
-	{	"t12",	dbreg(FRAME_T12),	db_alpha_regop	},
-	{	"at",	dbreg(FRAME_AT),	db_alpha_regop	},
-	{	"gp",	dbreg(FRAME_GP),	db_alpha_regop	},
-	{	"sp",	dbreg(FRAME_SP),	db_alpha_regop	},
-	{	"pc",	dbreg(FRAME_PC),	db_alpha_regop	},
-	{	"ps",	dbreg(FRAME_PS),	db_alpha_regop	},
-	{	"ai",	dbreg(FRAME_T11),	db_alpha_regop	},
-	{	"pv",	dbreg(FRAME_T12),	db_alpha_regop	},
+	DBREG(v0,	FRAME_V0),
+	DBREG(t0,	FRAME_T0),
+	DBREG(t1,	FRAME_T1),
+	DBREG(t2,	FRAME_T2),
+	DBREG(t3,	FRAME_T3),
+	DBREG(t4,	FRAME_T4),
+	DBREG(t5,	FRAME_T5),
+	DBREG(t6,	FRAME_T6),
+	DBREG(t7,	FRAME_T7),
+	DBREG(s0,	FRAME_S0),
+	DBREG(s1,	FRAME_S1),
+	DBREG(s2,	FRAME_S2),
+	DBREG(s3,	FRAME_S3),
+	DBREG(s4,	FRAME_S4),
+	DBREG(s5,	FRAME_S5),
+	DBREG(s6,	FRAME_S6),
+	DBREG(a0,	FRAME_A0),
+	DBREG(a1,	FRAME_A1),
+	DBREG(a2,	FRAME_A2),
+	DBREG(a3,	FRAME_A3),
+	DBREG(a4,	FRAME_A4),
+	DBREG(a5,	FRAME_A5),
+	DBREG(t8,	FRAME_T8),
+	DBREG(t9,	FRAME_T9),
+	DBREG(t10,	FRAME_T10),
+	DBREG(t11,	FRAME_T11),
+	DBREG(ra,	FRAME_RA),
+	DBREG(t12,	FRAME_T12),
+	DBREG(at,	FRAME_AT),
+	DBREG(gp,	FRAME_GP),
+	DBREG(sp,	FRAME_SP),
+	DBREG(pc,	FRAME_PC),
+	DBREG(ps,	FRAME_PS),
+	DBREG(ai,	FRAME_T11),
+	DBREG(pv,	FRAME_T12),
 };
 const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
+#undef DBREG
+
 static int
 db_alpha_regop(const struct db_variable *vp, db_expr_t *val, int opcode)
 {



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:53:06 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c

Log Message:
Ensure that all fields of db_regs[] are initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/db_interface.c

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



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:23:56 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Adjust proc/lwp access for user-space (crash(8)).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/include/db_machdep.h

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



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 21:23:56 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Adjust proc/lwp access for user-space (crash(8)).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.38 src/sys/arch/alpha/alpha/db_interface.c:1.39
--- src/sys/arch/alpha/alpha/db_interface.c:1.38	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -54,7 +54,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $");
 
 #include 
 #include 
@@ -569,6 +569,21 @@ db_branch_taken(int ins, db_addr_t pc, d
 	return (newpc);
 }
 
+unsigned long
+db_alpha_read_saved_reg(unsigned long *regp)
+{
+	unsigned long reg;
+
+	db_read_bytes((db_addr_t)regp, sizeof(reg), (char *));
+	return reg;
+}
+
+unsigned long
+db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
+{
+	return db_alpha_read_saved_reg(>tf_regs[regno]);
+}
+
 /*
  * Alpha special symbol handling.
  */

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.37 src/sys/arch/alpha/alpha/db_trace.c:1.38
--- src/sys/arch/alpha/alpha/db_trace.c:1.37	Tue Nov 21 20:40:24 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.38 2023/11/21 21:23:56 thorpej Exp $");
 
 #include 
 #include 
@@ -138,16 +138,6 @@ decode_syscall(int number, void (*pr)(co
 	(*pr)(" (%d)", number);
 }
 
-static unsigned long
-db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
-{
-	unsigned long reg;
-
-	db_read_bytes((db_addr_t)>tf_regs[regno], sizeof(reg),
-	(char *));
-	return reg;
-}
-
 void
 db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
 const char *modif, void (*pr)(const char *, ...))
@@ -191,15 +181,27 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
+#ifdef _KERNEL
 		struct proc *p = NULL;
 		struct lwp *l = NULL;
+#else
+		struct proc pstore, *p = 
+		struct lwp lstore, *l = 
+#endif /* _KERNEL */
 
 		if (trace_thread) {
 			if (lwpaddr) {
+#ifdef _KERNEL
 l = (struct lwp *)addr;
 p = l->l_proc;
+#else
+db_read_bytes(addr, sizeof(*l), (char *)l);
+db_read_bytes((db_addr_t)l->l_proc,
+sizeof(*p), (char *)p);
+#endif /* _KERNEL */
 (*pr)("trace: pid %d ", p->p_pid);
 			} else {
+#ifdef _KERNEL
 (*pr)("trace: pid %d ", (int)addr);
 p = proc_find_raw(addr);
 if (p == NULL) {
@@ -208,11 +210,15 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 }
 l = LIST_FIRST(>p_lwps);
 KASSERT(l != NULL);
+#else
+(*pr)("no proc_find_raw() in crash\n");
+return;
+#endif /* _KERNEL */
 			}
 			(*pr)("lid %d ", l->l_lid);
 			pcbp = lwp_getpcb(l);
-			addr = (db_expr_t)pcbp->pcb_hw.apcb_ksp;
-			callpc = pcbp->pcb_context[7];
+			addr = db_alpha_read_saved_reg(>pcb_hw.apcb_ksp);
+			callpc = db_alpha_read_saved_reg(>pcb_context[7]);
 			(*pr)("at 0x%lx\n", addr);
 		} else if (have_ra) {
 			callpc = ra;

Index: src/sys/arch/alpha/include/db_machdep.h
diff -u src/sys/arch/alpha/include/db_machdep.h:1.21 src/sys/arch/alpha/include/db_machdep.h:1.22
--- src/sys/arch/alpha/include/db_machdep.h:1.21	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/include/db_machdep.h	Tue Nov 21 21:23:56 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.21 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_machdep.h,v 1.22 2023/11/21 21:23:56 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
@@ -211,6 +211,9 @@ bool		db_alpha_sym_is_backstop(db_addr_t
 bool		db_alpha_sym_is_syscall(db_addr_t);
 const char *	db_alpha_trapsym_description(db_addr_t);
 
+unsigned long	db_alpha_read_saved_reg(unsigned long *);
+unsigned long	db_alpha_tf_reg(struct 

CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:40:24 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Reduce db_trace.c's exposure to proc/lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/db_trace.c

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



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:40:24 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Reduce db_trace.c's exposure to proc/lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/db_trace.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.36 src/sys/arch/alpha/alpha/db_trace.c:1.37
--- src/sys/arch/alpha/alpha/db_trace.c:1.36	Tue Nov 21 20:29:47 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 20:40:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $");
 
 #include 
 #include 
@@ -133,9 +133,8 @@ do {	\
 }
 
 static void
-decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...))
+decode_syscall(int number, void (*pr)(const char *, ...))
 {
-
 	(*pr)(" (%d)", number);
 }
 
@@ -175,8 +174,6 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 	struct trapframe *tf;
 	bool ra_from_tf;
 	u_long last_ipl = ~0L;
-	struct proc *p = NULL;
-	struct lwp *l = NULL;
 	char c;
 	bool trace_thread = false;
 	bool lwpaddr = false;
@@ -188,13 +185,15 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 	}
 
 	if (!have_addr) {
-		p = curproc;
 		addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
 		tf = (struct trapframe *)addr;
 		callpc = db_alpha_tf_reg(tf, FRAME_PC);
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
+		struct proc *p = NULL;
+		struct lwp *l = NULL;
+
 		if (trace_thread) {
 			if (lwpaddr) {
 l = (struct lwp *)addr;
@@ -293,7 +292,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			tfps = db_alpha_tf_reg(tf, FRAME_PS);
 			if (db_alpha_sym_is_syscall(symval)) {
 decode_syscall(db_alpha_tf_reg(tf, FRAME_V0),
-p, pr);
+pr);
 			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:29:47 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
decode_prologue(): Make pc a db_addr_t, not a db_expr_t.
db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/db_trace.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.35 src/sys/arch/alpha/alpha/db_trace.c:1.36
--- src/sys/arch/alpha/alpha/db_trace.c:1.35	Tue Nov 21 19:59:07 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 20:29:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $");
 
 #include 
 #include 
@@ -71,7 +71,7 @@ decode_prologue(db_addr_t callpc, db_add
 {
 	long signed_immediate;
 	alpha_instruction ins;
-	db_expr_t pc;
+	db_addr_t pc;
 
 	pi->pi_regmask = 0;
 	pi->pi_frame_size = 0;
@@ -297,8 +297,9 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;
-if (symval != (vaddr_t))
+if (! db_alpha_sym_is_syscall(symval)) {
 	(*pr)(" (from ipl %ld)", last_ipl);
+}
 			}
 			(*pr)(" ---\n");
 			if (tfps & ALPHA_PSL_USERMODE) {



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 20:29:47 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
decode_prologue(): Make pc a db_addr_t, not a db_expr_t.
db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/db_trace.c

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



CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 19:59:07 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_interface.c
diff -u src/sys/arch/alpha/alpha/db_interface.c:1.37 src/sys/arch/alpha/alpha/db_interface.c:1.38
--- src/sys/arch/alpha/alpha/db_interface.c:1.37	Wed Oct 26 23:38:05 2022
+++ src/sys/arch/alpha/alpha/db_interface.c	Tue Nov 21 19:59:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $ */
+/* $NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -47,12 +47,14 @@
  *	NASA Ames Research Center
  */
 
+#ifdef _KERNEL_OPT
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
+#endif
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.38 2023/11/21 19:59:07 thorpej Exp $");
 
 #include 
 #include 
@@ -566,3 +568,72 @@ db_branch_taken(int ins, db_addr_t pc, d
 
 	return (newpc);
 }
+
+/*
+ * Alpha special symbol handling.
+ */
+db_alpha_nlist db_alpha_nl[] = {
+	DB_ALPHA_SYM(SYM_XentArith, XentArith),
+	DB_ALPHA_SYM(SYM_XentIF, XentIF),
+	DB_ALPHA_SYM(SYM_XentInt, XentInt),
+	DB_ALPHA_SYM(SYM_XentMM, XentMM),
+	DB_ALPHA_SYM(SYM_XentSys, XentSys),
+	DB_ALPHA_SYM(SYM_XentUna, XentUna),
+	DB_ALPHA_SYM(SYM_XentRestart, XentRestart),
+	DB_ALPHA_SYM(SYM_exception_return, exception_return),
+	DB_ALPHA_SYM(SYM_alpha_kthread_backstop, alpha_kthread_backstop),
+	DB_ALPHA_SYM_EOL
+};
+
+static int
+db_alpha_nlist_lookup(db_addr_t addr)
+{
+	int i;
+
+	for (i = 0; i < SYM___eol; i++) {
+		if (db_alpha_nl[i].n_value == addr) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+bool
+db_alpha_sym_is_trap(db_addr_t addr)
+{
+	int i = db_alpha_nlist_lookup(addr);
+	return i >= SYM_XentArith && i <= SYM_exception_return;
+}
+
+bool
+db_alpha_sym_is_backstop(db_addr_t addr)
+{
+	return db_alpha_nlist_lookup(addr) == SYM_alpha_kthread_backstop;
+}
+
+bool
+db_alpha_sym_is_syscall(db_addr_t addr)
+{
+	return db_alpha_nlist_lookup(addr) == SYM_XentSys;
+}
+
+const char *
+db_alpha_trapsym_description(db_addr_t addr)
+{
+	static const char * const trap_descriptions[] = {
+	[SYM_XentArith]		=	"arithmetic trap",
+	[SYM_XentIF]		=	"instruction fault",
+	[SYM_XentInt]		=	"interrupt",
+	[SYM_XentMM]		=	"memory management fault",
+	[SYM_XentSys]		=	"syscall",
+	[SYM_XentUna]		=	"unaligned access fault",
+	[SYM_XentRestart]	=	"console restart",
+	[SYM_exception_return]	=	"(exception return)",
+	};
+
+	int i = db_alpha_nlist_lookup(addr);
+	if (i >= SYM_XentArith && i <= SYM_exception_return) {
+		return trap_descriptions[i];
+	}
+	return "??? trap ???";
+}

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.34 src/sys/arch/alpha/alpha/db_trace.c:1.35
--- src/sys/arch/alpha/alpha/db_trace.c:1.34	Tue Nov 21 18:57:29 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 19:59:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $");
 
 #include 
 #include 
@@ -62,39 +62,6 @@ struct prologue_info {
 };
 
 /*
- * We use several symbols to take special action:
- *
- *	Trap vectors, which use a different (fixed-size) stack frame:
- *
- *		XentArith
- *		XentIF
- *		XentInt
- *		XentMM
- *		XentSys
- *		XentUna
- */
-
-static struct special_symbol {
-	vaddr_t ss_val;
-	const char *ss_note;
-} special_symbols[] = {
-	{ (vaddr_t),		"arithmetic trap" },
-	{ (vaddr_t),		"instruction fault" },
-	{ (vaddr_t),		"interrupt" },
-	{ (vaddr_t),		"memory management fault" },
-	{ (vaddr_t),		"syscall" },
-	{ (vaddr_t),		"unaligned access fault" },
-	{ (vaddr_t),	"console restart" },
-
-	/*
-	 * We'll not know what trap we took, but we'll find the
-	 * trap frame, at least...
-	 */
-	{ (vaddr_t)_return,	"(exception return)" },
-	{ 0 }
-};
-
-/*
  * Decode the function prologue for the function we're in, and note
  * which registers are stored 

CVS commit: src/sys/arch/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 19:59:07 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_interface.c db_trace.c
src/sys/arch/alpha/include: db_machdep.h

Log Message:
Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/db_trace.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/include/db_machdep.h

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



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 18:57:29 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Don't access insns or frame values directly; use db_read_bytes().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/db_trace.c

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



CVS commit: src/sys/arch/alpha/alpha

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 18:57:29 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Don't access insns or frame values directly; use db_read_bytes().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/db_trace.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.33 src/sys/arch/alpha/alpha/db_trace.c:1.34
--- src/sys/arch/alpha/alpha/db_trace.c:1.33	Tue Nov 21 14:35:01 2023
+++ src/sys/arch/alpha/alpha/db_trace.c	Tue Nov 21 18:57:29 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.33 2023/11/21 14:35:01 riastradh Exp $ */
+/* $NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.33 2023/11/21 14:35:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $");
 
 #include 
 #include 
@@ -117,7 +117,7 @@ do {	\
 } while (0)
 
 	for (pc = func; pc < callpc; pc += sizeof(alpha_instruction)) {
-		ins.bits = *(unsigned int *)pc;
+		db_read_bytes(pc, sizeof(ins.bits), (char *));
 
 		if (ins.mem_format.opcode == op_lda &&
 		ins.mem_format.ra == 30 &&
@@ -199,6 +199,16 @@ db_alpha_trap_is_syscall(vaddr_t v)
 	return v == (vaddr_t)
 }
 
+static unsigned long
+db_alpha_tf_reg(struct trapframe *tf, unsigned int regno)
+{
+	unsigned long reg;
+
+	db_read_bytes((db_addr_t)>tf_regs[regno], sizeof(reg),
+	(char *));
+	return reg;
+}
+
 static void
 decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...))
 {
@@ -248,7 +258,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 		p = curproc;
 		addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
 		tf = (struct trapframe *)addr;
-		callpc = tf->tf_regs[FRAME_PC];
+		callpc = db_alpha_tf_reg(tf, FRAME_PC);
 		frame = (db_addr_t)tf + FRAME_SIZE * 8;
 		ra_from_tf = true;
 	} else {
@@ -347,9 +357,11 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 
 			(*pr)("--- %s", db_alpha_trap_description(symval));
 
-			tfps = tf->tf_regs[FRAME_PS];
-			if (db_alpha_trap_is_syscall(symval))
-decode_syscall(tf->tf_regs[FRAME_V0], p, pr);
+			tfps = db_alpha_tf_reg(tf, FRAME_PS);
+			if (db_alpha_trap_is_syscall(symval)) {
+decode_syscall(db_alpha_tf_reg(tf, FRAME_V0),
+p, pr);
+			}
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;
 if (symval != (vaddr_t))
@@ -360,7 +372,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 (*pr)("--- user mode ---\n");
 break;	/* Terminate search.  */
 			}
-			callpc = tf->tf_regs[FRAME_PC];
+			callpc = db_alpha_tf_reg(tf, FRAME_PC);
 			frame = (db_addr_t)tf + FRAME_SIZE * 8;
 			ra_from_tf = true;
 			continue;
@@ -380,14 +392,19 @@ db_stack_trace_print_ra(db_expr_t ra, bo
 			 * in a leaf call).  If not, we've found the
 			 * root of the call graph.
 			 */
-			if (ra_from_tf)
-callpc = tf->tf_regs[FRAME_RA];
-			else {
+			if (ra_from_tf) {
+callpc = db_alpha_tf_reg(tf, FRAME_RA);
+			} else {
 (*pr)("--- root of call graph ---\n");
 break;
 			}
-		} else
-			callpc = *(u_long *)(frame + pi.pi_reg_offset[26]);
+		} else {
+			unsigned long reg;
+
+			db_read_bytes(frame + pi.pi_reg_offset[26],
+			sizeof(reg), (char *));
+			callpc = reg;
+		}
 		frame += pi.pi_frame_size;
 		ra_from_tf = false;
 	}



CVS commit: src/sys/arch/alpha/common

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 17:52:51 UTC 2023

Modified Files:
src/sys/arch/alpha/common: shared_intr.c

Log Message:
Don't open-code tailq access.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/common/shared_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/alpha/common/shared_intr.c
diff -u src/sys/arch/alpha/common/shared_intr.c:1.29 src/sys/arch/alpha/common/shared_intr.c:1.30
--- src/sys/arch/alpha/common/shared_intr.c:1.29	Sun Jul  4 22:36:43 2021
+++ src/sys/arch/alpha/common/shared_intr.c	Tue Nov 21 17:52:51 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $ */
+/* $NetBSD: shared_intr.c,v 1.30 2023/11/21 17:52:51 thorpej Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.30 2023/11/21 17:52:51 thorpej Exp $");
 
 #include 
 #include 
@@ -122,14 +122,11 @@ int
 alpha_shared_intr_dispatch(struct alpha_shared_intr *intr, unsigned int num)
 {
 	struct alpha_shared_intrhand *ih;
-	int rv, handled;
+	int rv = 0;
 
 	atomic_add_long([num].intr_evcnt.ev_count, 1);
 
-	ih = intr[num].intr_q.tqh_first;
-	handled = 0;
-	while (ih != NULL) {
-
+	TAILQ_FOREACH(ih, [num].intr_q, ih_q) {
 		/*
 		 * The handler returns one of three values:
 		 *   0:	This interrupt wasn't for me.
@@ -137,14 +134,10 @@ alpha_shared_intr_dispatch(struct alpha_
 		 *  -1: This interrupt might have been for me, but I can't say
 		 *  for sure.
 		 */
-
-		rv = (*ih->ih_fn)(ih->ih_arg);
-
-		handled = handled || (rv != 0);
-		ih = ih->ih_q.tqe_next;
+		rv |= (*ih->ih_fn)(ih->ih_arg);
 	}
 
-	return (handled);
+	return (rv ? 1 : 0);
 }
 
 static int
@@ -246,7 +239,7 @@ alpha_shared_intr_link(struct alpha_shar
 			break;
 	case IST_PULSE:
 		if (type != IST_NONE) {
-			if (intr[num].intr_q.tqh_first == NULL) {
+			if (TAILQ_FIRST([num].intr_q) == NULL) {
 printf("alpha_shared_intr_establish: %s irq %d: warning: using %s on %s\n",
 basename, num, intr_typename(type),
 intr_typename(intr[num].intr_sharetype));
@@ -321,15 +314,16 @@ int
 alpha_shared_intr_isactive(struct alpha_shared_intr *intr, unsigned int num)
 {
 
-	return (intr[num].intr_q.tqh_first != NULL);
+	return TAILQ_FIRST([num].intr_q) != NULL;
 }
 
 int
 alpha_shared_intr_firstactive(struct alpha_shared_intr *intr, unsigned int num)
 {
+	struct alpha_shared_intrhand *ih;
 
-	return (intr[num].intr_q.tqh_first != NULL &&
-		intr[num].intr_q.tqh_first->ih_q.tqe_next == NULL);
+	return (ih = TAILQ_FIRST([num].intr_q)) != NULL &&
+	   TAILQ_NEXT(ih, ih_q) == NULL;
 }
 
 void



CVS commit: src/sys/arch/alpha/common

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Nov 21 17:52:51 UTC 2023

Modified Files:
src/sys/arch/alpha/common: shared_intr.c

Log Message:
Don't open-code tailq access.


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

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



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

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 19 20:01:48 UTC 2023

Modified Files:
src/sys/arch/alpha/conf: GENERIC.QEMU

Log Message:
Add some VirtIO devies.  virtio-scsi and virtio-rng are tested a bit,
virtio-blk does not work, virtio-net not yet tested.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/conf/GENERIC.QEMU

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/conf/GENERIC.QEMU
diff -u src/sys/arch/alpha/conf/GENERIC.QEMU:1.1 src/sys/arch/alpha/conf/GENERIC.QEMU:1.2
--- src/sys/arch/alpha/conf/GENERIC.QEMU:1.1	Sun May 23 01:34:17 2021
+++ src/sys/arch/alpha/conf/GENERIC.QEMU	Sun Nov 19 20:01:48 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.QEMU,v 1.1 2021/05/23 01:34:17 thorpej Exp $
+# $NetBSD: GENERIC.QEMU,v 1.2 2023/11/19 20:01:48 thorpej Exp $
 #
 # Generic Alpha kernel specifically configured for Qemu.
 
@@ -8,3 +8,12 @@ include	"arch/alpha/conf/GENERIC"
 # because Qemu does not load the symbol table when loading the
 # kernel.
 makeoptions	COPY_SYMTAB=1
+
+# Virtio devices
+virtio*	at pci? dev ? function ?	# Virtio PCI device
+#viomb*	at virtio?			# Virtio memory balloon device
+ld*	at virtio?			# Virtio disk device
+vioif*	at virtio?			# Virtio network device
+viornd*	at virtio?			# Virtio entropy device
+vioscsi* at virtio?			# Virtio SCSI device
+#vio9p*	at virtio?			# Virtio 9P device



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

2023-11-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 19 20:01:48 UTC 2023

Modified Files:
src/sys/arch/alpha/conf: GENERIC.QEMU

Log Message:
Add some VirtIO devies.  virtio-scsi and virtio-rng are tested a bit,
virtio-blk does not work, virtio-net not yet tested.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/alpha/conf/GENERIC.QEMU

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



CVS commit: src/sys/arch/alpha/alpha

2023-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  3 03:07:36 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: machdep.c

Log Message:
alpha: Add support for bootflags [xX] to enable debug messages.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.375 src/sys/arch/alpha/alpha/machdep.c:1.376
--- src/sys/arch/alpha/alpha/machdep.c:1.375	Thu Jul 22 01:39:18 2021
+++ src/sys/arch/alpha/alpha/machdep.c	Thu Aug  3 03:07:35 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.375 2021/07/22 01:39:18 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.376 2023/08/03 03:07:35 rin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.375 2021/07/22 01:39:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.376 2023/08/03 03:07:35 rin Exp $");
 
 #include 
 #include 
@@ -797,6 +797,11 @@ nobootinfo:
 			boothowto |= AB_VERBOSE;
 			break;
 
+		case 'x': /* debug messages */
+		case 'X':
+			boothowto |= AB_DEBUG;
+			break;
+
 		case '-':
 			/*
 			 * Just ignore this.  It's not required, but it's



CVS commit: src/sys/arch/alpha/alpha

2023-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  3 03:07:36 UTC 2023

Modified Files:
src/sys/arch/alpha/alpha: machdep.c

Log Message:
alpha: Add support for bootflags [xX] to enable debug messages.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/arch/alpha/alpha/machdep.c

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



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

2023-02-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 23 14:55:10 UTC 2023

Modified Files:
src/sys/arch/alpha/include: asm.h

Log Message:
alpha: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

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


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/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/alpha/include/asm.h
diff -u src/sys/arch/alpha/include/asm.h:1.44 src/sys/arch/alpha/include/asm.h:1.45
--- src/sys/arch/alpha/include/asm.h:1.44	Fri Sep  4 03:53:12 2020
+++ src/sys/arch/alpha/include/asm.h	Thu Feb 23 14:55:10 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.44 2020/09/04 03:53:12 thorpej Exp $ */
+/* $NetBSD: asm.h,v 1.45 2023/02/23 14:55:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -669,10 +669,30 @@ label:	ASCIZ msg;		\
 #define	GET_CURLWP			\
 	call_pal PAL_OSF1_rdval
 
+/*
+ * 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.
+ */
 #define	SET_CURLWP(r)			\
 	ldq	v0, L_CPU(r)	;	\
 	mov	r, a0		;	\
+	wmb	/* store-before-store XXX patch out if !MP? */	;	\
 	stq	r, CPU_INFO_CURLWP(v0);	\
+	mb	/* store-before-load XXX patch out if !MP? */	;	\
 	call_pal PAL_OSF1_wrval
 
 #else	/* if not MULTIPROCESSOR... */



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

2023-02-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 23 14:55:10 UTC 2023

Modified Files:
src/sys/arch/alpha/include: asm.h

Log Message:
alpha: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

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


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/include/asm.h

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



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jul 21 01:52:28 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Rename functions in previous in preparation for future changes.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/db_trace.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.31 src/sys/arch/alpha/alpha/db_trace.c:1.32
--- src/sys/arch/alpha/alpha/db_trace.c:1.31	Wed Jul 20 17:03:10 2022
+++ src/sys/arch/alpha/alpha/db_trace.c	Thu Jul 21 01:52:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $ */
+/* $NetBSD: db_trace.c,v 1.32 2022/07/21 01:52:28 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.32 2022/07/21 01:52:28 thorpej Exp $");
 
 #include 
 #include 
@@ -166,7 +166,7 @@ do {	\
 }
 
 static bool
-sym_is_trapsymbol(vaddr_t v)
+db_alpha_sym_is_trapsymbol(vaddr_t v)
 {
 	int i;
 
@@ -177,13 +177,13 @@ sym_is_trapsymbol(vaddr_t v)
 }
 
 static bool
-sym_is_backstop(vaddr_t v)
+db_alpha_sym_is_backstop(vaddr_t v)
 {
 	return v == (vaddr_t)_kthread_backstop;
 }
 
 static const char *
-trap_description(vaddr_t v)
+db_alpha_trap_description(vaddr_t v)
 {
 	int i;
 
@@ -194,7 +194,7 @@ trap_description(vaddr_t v)
 }
 
 static bool
-trap_is_syscall(vaddr_t v)
+db_alpha_trap_is_syscall(vaddr_t v)
 {
 	return v == (vaddr_t)
 }
@@ -288,7 +288,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		 * backstop, then we are at the root of the call
 		 * graph.
 		 */
-		if (sym_is_backstop(symval)) {
+		if (db_alpha_sym_is_backstop(symval)) {
 			(*pr)("--- kernel thread backstop ---\n");
 			break;
 		}
@@ -328,13 +328,13 @@ db_stack_trace_print(db_expr_t addr, boo
 		 * If we are in a trap vector, frame points to a
 		 * trapframe.
 		 */
-		if (sym_is_trapsymbol(symval)) {
+		if (db_alpha_sym_is_trapsymbol(symval)) {
 			tf = (struct trapframe *)frame;
 
-			(*pr)("--- %s", trap_description(symval));
+			(*pr)("--- %s", db_alpha_trap_description(symval));
 
 			tfps = tf->tf_regs[FRAME_PS];
-			if (trap_is_syscall(symval))
+			if (db_alpha_trap_is_syscall(symval))
 decode_syscall(tf->tf_regs[FRAME_V0], p, pr);
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jul 21 01:52:28 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Rename functions in previous in preparation for future changes.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/db_trace.c

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



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 18:25:10 UTC 2022

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

Log Message:
Fix a couple of nits with savectx():
- Note that this function is only used by dumpsys().
- Don't safe the PS word; there isn't actually a spot for it in the PCB.
- Don't bother returning anything; savectx() is declared void.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/alpha/alpha/locore.s

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

Modified files:

Index: src/sys/arch/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.141 src/sys/arch/alpha/alpha/locore.s:1.142
--- src/sys/arch/alpha/alpha/locore.s:1.141	Thu Jul 22 15:48:40 2021
+++ src/sys/arch/alpha/alpha/locore.s	Wed Jul 20 18:25:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $");
 
 #include "assym.h"
 
@@ -651,13 +651,10 @@ LEAF(restorefpstate, 1)
  * sanely be used for curlwp iff cpu_switchto won't be called again, e.g.
  * if called from boot().)
  *
+ * N.B. this is actually only used by dumpsys().
+ *
  * Arguments:
  *	a0	'struct pcb *' of the process that needs its context saved
- *
- * Return:
- *	v0	0.  (note that for child processes, it seems
- *		like savectx() returns 1, because the return address
- *		in the PCB is set to the return address from savectx().)
  */
 
 LEAF(savectx, 1)
@@ -672,10 +669,6 @@ LEAF(savectx, 1)
 	stq	s5, PCB_CONTEXT+(5 * 8)(a0)
 	stq	s6, PCB_CONTEXT+(6 * 8)(a0)
 	stq	ra, PCB_CONTEXT+(7 * 8)(a0)	/* store ra */
-	call_pal PAL_OSF1_rdps			/* NOTE: doesn't kill a0 */
-	stq	v0, PCB_CONTEXT+(8 * 8)(a0)	/* store ps, for ipl */
-
-	mov	zero, v0
 	RET
 	END(savectx)
 



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 18:25:10 UTC 2022

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

Log Message:
Fix a couple of nits with savectx():
- Note that this function is only used by dumpsys().
- Don't safe the PS word; there isn't actually a spot for it in the PCB.
- Don't bother returning anything; savectx() is declared void.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/alpha/alpha/locore.s

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



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 17:03:11 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Localize direct refernces to kernel symbols into functions.  NFC.


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

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

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.30 src/sys/arch/alpha/alpha/db_trace.c:1.31
--- src/sys/arch/alpha/alpha/db_trace.c:1.30	Sat Jul 24 21:31:32 2021
+++ src/sys/arch/alpha/alpha/db_trace.c	Wed Jul 20 17:03:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.30 2021/07/24 21:31:32 andvar Exp $ */
+/* $NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.30 2021/07/24 21:31:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $");
 
 #include 
 #include 
@@ -165,15 +165,38 @@ do {	\
 	}
 }
 
-static int
+static bool
 sym_is_trapsymbol(vaddr_t v)
 {
 	int i;
 
 	for (i = 0; special_symbols[i].ss_val != 0; ++i)
 		if (v == special_symbols[i].ss_val)
-			return 1;
-	return 0;
+			return true;
+	return false;
+}
+
+static bool
+sym_is_backstop(vaddr_t v)
+{
+	return v == (vaddr_t)_kthread_backstop;
+}
+
+static const char *
+trap_description(vaddr_t v)
+{
+	int i;
+
+	for (i = 0; special_symbols[i].ss_val != 0; ++i)
+		if (v == special_symbols[i].ss_val)
+			return special_symbols[i].ss_note;
+	return "(? trap ?)";
+}
+
+static bool
+trap_is_syscall(vaddr_t v)
+{
+	return v == (vaddr_t)
 }
 
 static void
@@ -191,7 +214,6 @@ db_stack_trace_print(db_expr_t addr, boo
 	struct prologue_info pi;
 	db_expr_t diff;
 	db_sym_t sym;
-	int i;
 	u_long tfps;
 	const char *symname;
 	struct pcb *pcbp;
@@ -266,7 +288,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		 * backstop, then we are at the root of the call
 		 * graph.
 		 */
-		if (symval == (vaddr_t)_kthread_backstop) {
+		if (sym_is_backstop(symval)) {
 			(*pr)("--- kernel thread backstop ---\n");
 			break;
 		}
@@ -309,13 +331,10 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (sym_is_trapsymbol(symval)) {
 			tf = (struct trapframe *)frame;
 
-			for (i = 0; special_symbols[i].ss_val != 0; ++i)
-if (symval == special_symbols[i].ss_val)
-	(*pr)("--- %s",
-	special_symbols[i].ss_note);
+			(*pr)("--- %s", trap_description(symval));
 
 			tfps = tf->tf_regs[FRAME_PS];
-			if (symval == (vaddr_t))
+			if (trap_is_syscall(symval))
 decode_syscall(tf->tf_regs[FRAME_V0], p, pr);
 			if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
 last_ipl = tfps & ALPHA_PSL_IPL_MASK;



CVS commit: src/sys/arch/alpha/alpha

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 17:03:11 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: db_trace.c

Log Message:
Localize direct refernces to kernel symbols into functions.  NFC.


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

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



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

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 15:52:47 UTC 2022

Modified Files:
src/sys/arch/alpha/include: alpha_cpu.h

Log Message:
Make alpha_wmb() actually a WMB rather than an MB (all uses of
alpha_wmb() have been audited and fixed-up as necessary).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/include/alpha_cpu.h

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

Modified files:

Index: src/sys/arch/alpha/include/alpha_cpu.h
diff -u src/sys/arch/alpha/include/alpha_cpu.h:1.55 src/sys/arch/alpha/include/alpha_cpu.h:1.56
--- src/sys/arch/alpha/include/alpha_cpu.h:1.55	Tue Nov  2 11:26:03 2021
+++ src/sys/arch/alpha/include/alpha_cpu.h	Wed Jul 20 15:52:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_cpu.h,v 1.55 2021/11/02 11:26:03 ryo Exp $ */
+/* $NetBSD: alpha_cpu.h,v 1.56 2022/07/20 15:52:47 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -377,7 +377,7 @@ alpha_rpcc(void)
 }
 
 #define	alpha_mb()	__asm volatile("mb" : : : "memory")
-#define	alpha_wmb()	__asm volatile("mb" : : : "memory")	/* XXX */
+#define	alpha_wmb()	__asm volatile("wmb" : : : "memory")
 
 #if defined(_KERNEL) || defined(_STANDALONE)
 



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

2022-07-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jul 20 15:52:47 UTC 2022

Modified Files:
src/sys/arch/alpha/include: alpha_cpu.h

Log Message:
Make alpha_wmb() actually a WMB rather than an MB (all uses of
alpha_wmb() have been audited and fixed-up as necessary).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/include/alpha_cpu.h

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



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

2022-07-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 19 22:04:14 UTC 2022

Modified Files:
src/sys/arch/alpha/include: pmap.h

Log Message:
alpha: Fix missing includes in pmap.h.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/alpha/include/pmap.h

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

Modified files:

Index: src/sys/arch/alpha/include/pmap.h
diff -u src/sys/arch/alpha/include/pmap.h:1.98 src/sys/arch/alpha/include/pmap.h:1.99
--- src/sys/arch/alpha/include/pmap.h:1.98	Mon May 31 17:22:44 2021
+++ src/sys/arch/alpha/include/pmap.h	Tue Jul 19 22:04:14 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.98 2021/05/31 17:22:44 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.99 2022/07/19 22:04:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -110,6 +110,9 @@
 #include "opt_multiprocessor.h"
 #endif
 
+#include 
+#include 
+
 #include 
 #include 
 



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

2022-07-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 19 22:04:14 UTC 2022

Modified Files:
src/sys/arch/alpha/include: pmap.h

Log Message:
alpha: Fix missing includes in pmap.h.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/alpha/include/pmap.h

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



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

2022-06-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Jun  3 17:04:54 UTC 2022

Modified Files:
src/sys/arch/alpha/include: cfbreg.h

Log Message:
remove reference to gatekeeper.dec.com ftp.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/include/cfbreg.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/alpha/include/cfbreg.h
diff -u src/sys/arch/alpha/include/cfbreg.h:1.3 src/sys/arch/alpha/include/cfbreg.h:1.4
--- src/sys/arch/alpha/include/cfbreg.h:1.3	Thu Jun 22 16:46:52 2017
+++ src/sys/arch/alpha/include/cfbreg.h	Fri Jun  3 17:04:54 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cfbreg.h,v 1.3 2017/06/22 16:46:52 flxd Exp $ */
+/* $NetBSD: cfbreg.h,v 1.4 2022/06/03 17:04:54 andvar Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -30,7 +30,7 @@
 /*
  * Color Frame Buffer definitions, from:
  * ``PMAG-BA TURBOchannel Color Frame Buffer Functional Specification
- * (Revision 1.2)'', availalable via anonymous FTP from gatekeeper.dec.com.
+ * (Revision 1.2)''.
  *
  * All definitions are in "dense" TURBOchannel space.
  */



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

2022-06-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Jun  3 17:04:54 UTC 2022

Modified Files:
src/sys/arch/alpha/include: cfbreg.h

Log Message:
remove reference to gatekeeper.dec.com ftp.


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

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



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:42:56 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: ipifuncs.c

Log Message:
alpha: Convert ipifuncs.c to membar_release/acquire.

No semantic change is possible because all of these membars are just
mb on alpha -- change just makes the intent clearer.  (Only
membar_producer is weaker, wmb.)


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/alpha/alpha/ipifuncs.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/ipifuncs.c
diff -u src/sys/arch/alpha/alpha/ipifuncs.c:1.54 src/sys/arch/alpha/alpha/ipifuncs.c:1.55
--- src/sys/arch/alpha/alpha/ipifuncs.c:1.54	Sat Oct 10 03:05:04 2020
+++ src/sys/arch/alpha/alpha/ipifuncs.c	Sat Apr  9 23:42:56 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.54 2020/10/10 03:05:04 thorpej Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.55 2022/04/09 23:42:56 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.54 2020/10/10 03:05:04 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.55 2022/04/09 23:42:56 riastradh Exp $");
 
 /*
  * Interprocessor interrupt handlers.
@@ -127,10 +127,12 @@ alpha_ipi_process(struct cpu_info *ci, s
 
 	while ((pending_ipis = atomic_swap_ulong(>ci_ipis, 0)) != 0) {
 		/*
-		 * Ensure the atomic swap is globally visible before
-		 * we do any of the work.
+		 * Ensure everything prior to setting ci_ipis in
+		 * alpha_send_ipi happens-before everything after
+		 * reading ci_ipis here so we're not working on stale
+		 * inputs.
 		 */
-		membar_enter();
+		membar_acquire();
 
 		sc->sc_evcnt_ipi.ev_count++;
 
@@ -159,7 +161,7 @@ alpha_send_ipi(u_long const cpu_id, u_lo
 	 * alpha_send_ipi() have completed before informing
 	 * the CPU of the work we are asking it to do.
 	 */
-	membar_exit();
+	membar_release();
 	atomic_or_ulong(_info[cpu_id]->ci_ipis, ipimask);
 
 	/*



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:42:56 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: ipifuncs.c

Log Message:
alpha: Convert ipifuncs.c to membar_release/acquire.

No semantic change is possible because all of these membars are just
mb on alpha -- change just makes the intent clearer.  (Only
membar_producer is weaker, wmb.)


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/alpha/alpha/ipifuncs.c

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



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:39:18 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Convert cpu_iccb_send from membar_exit to membar_release.

XXX Maybe this should really use alpha_mb, since it's not writing to
normal MI-type memory so technically the membr_* semantics doesn't
apply?


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/alpha/cpu.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/cpu.c
diff -u src/sys/arch/alpha/alpha/cpu.c:1.105 src/sys/arch/alpha/alpha/cpu.c:1.106
--- src/sys/arch/alpha/alpha/cpu.c:1.105	Sun Feb 27 14:17:10 2022
+++ src/sys/arch/alpha/alpha/cpu.c	Sat Apr  9 23:39:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.106 2022/04/09 23:39:18 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2022/04/09 23:39:18 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -887,7 +887,7 @@ cpu_iccb_send(long cpu_id, const char *m
 	 */
 	strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg);
 	pcsp->pcs_iccb.iccb_rxlen = strlen(msg);
-	membar_exit();
+	membar_release();
 	atomic_or_ulong(>rpb_rxrdy, cpumask);
 
 	/* Wait for the message to be received. */



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:39:18 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Convert cpu_iccb_send from membar_exit to membar_release.

XXX Maybe this should really use alpha_mb, since it's not writing to
normal MI-type memory so technically the membr_* semantics doesn't
apply?


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/alpha/alpha/cpu.c

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



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:36:22 UTC 2022

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

Log Message:
alpha: Omit needless membar in pmap_reference.

If the pmap is published enough for us to obtain a reference to it
then there's no membar needed.  If it's not then something else is
wrong and we can't use pmap_reference here anyway.  Membars are
needed only on the destruction side to make sure all use, by any
thread, happens-before all freeing in the last user thread.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.305 src/sys/arch/alpha/alpha/pmap.c:1.306
--- src/sys/arch/alpha/alpha/pmap.c:1.305	Sat Mar 12 15:32:31 2022
+++ src/sys/arch/alpha/alpha/pmap.c	Sat Apr  9 23:36:22 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.305 2022/03/12 15:32:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.305 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 riastradh Exp $");
 
 #include 
 #include 
@@ -1706,7 +1706,6 @@ pmap_reference(pmap_t pmap)
 
 	newcount = atomic_inc_uint_nv(>pm_count);
 	KASSERT(newcount != 0);
-	PMAP_MP(membar_enter());
 }
 
 /*



CVS commit: src/sys/arch/alpha/alpha

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:36:22 UTC 2022

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

Log Message:
alpha: Omit needless membar in pmap_reference.

If the pmap is published enough for us to obtain a reference to it
then there's no membar needed.  If it's not then something else is
wrong and we can't use pmap_reference here anyway.  Membars are
needed only on the destruction side to make sure all use, by any
thread, happens-before all freeing in the last user thread.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/arch/alpha/alpha/pmap.c

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



CVS commit: src/sys/arch/alpha/alpha

2022-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  5 04:33:36 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: clock.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/alpha/alpha/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/alpha/alpha/clock.c
diff -u src/sys/arch/alpha/alpha/clock.c:1.46 src/sys/arch/alpha/alpha/clock.c:1.47
--- src/sys/arch/alpha/alpha/clock.c:1.46	Sat Oct 10 03:05:04 2020
+++ src/sys/arch/alpha/alpha/clock.c	Tue Apr  5 04:33:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.46 2020/10/10 03:05:04 thorpej Exp $ */
+/* $NetBSD: clock.c,v 1.47 2022/04/05 04:33:36 skrll Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.46 2020/10/10 03:05:04 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.47 2022/04/05 04:33:36 skrll Exp $");
 
 #include 
 #include 
@@ -110,7 +110,7 @@ cpu_initclocks(void)
 	 * Initialize PCC timecounter, unless we're running in Qemu
 	 * (we will use a different timecounter in that case).
 	 */
-	if (! alpha_is_qemu) {
+	if (!alpha_is_qemu) {
 		const uint64_t pcc_freq = cpu_frequency(curcpu());
 		cc_init(NULL, pcc_freq, "PCC", PCC_QUAL);
 		alpha_use_cctr = 1;



CVS commit: src/sys/arch/alpha/alpha

2022-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  5 04:33:36 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: clock.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/alpha/alpha/clock.c

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



CVS commit: src/sys/arch/alpha/alpha

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:17:10 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Fix placement of membar for sending ICCB message.

While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway.  So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/alpha/cpu.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/cpu.c
diff -u src/sys/arch/alpha/alpha/cpu.c:1.104 src/sys/arch/alpha/alpha/cpu.c:1.105
--- src/sys/arch/alpha/alpha/cpu.c:1.104	Wed May  5 03:54:16 2021
+++ src/sys/arch/alpha/alpha/cpu.c	Sun Feb 27 14:17:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -882,12 +882,13 @@ cpu_iccb_send(long cpu_id, const char *m
 
 	/*
 	 * Copy the message into the ICCB, and tell the secondary console
-	 * that it's there.
+	 * that it's there.  Ensure the buffer is initialized before we
+	 * set the rxrdy bits, as a store-release.
 	 */
 	strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg);
 	pcsp->pcs_iccb.iccb_rxlen = strlen(msg);
+	membar_exit();
 	atomic_or_ulong(>rpb_rxrdy, cpumask);
-	membar_sync();
 
 	/* Wait for the message to be received. */
 	for (timeout = 1; timeout != 0; timeout--) {



CVS commit: src/sys/arch/alpha/alpha

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:17:10 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Fix placement of membar for sending ICCB message.

While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway.  So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/alpha/cpu.c

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



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

2022-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 13 13:42:30 UTC 2022

Modified Files:
src/sys/arch/alpha/include: lock.h

Log Message:
alpha: __cpu_simple_lock audit.

Add missing "cc" and "memory" asm clobbers to the compiler can't
reorder memory access around these.  The necessary memory barrier
instructions, mb, already appear in all the right places.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/include/lock.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/alpha/include/lock.h
diff -u src/sys/arch/alpha/include/lock.h:1.32 src/sys/arch/alpha/include/lock.h:1.33
--- src/sys/arch/alpha/include/lock.h:1.32	Sat Feb 12 17:17:53 2022
+++ src/sys/arch/alpha/include/lock.h	Sun Feb 13 13:42:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.32 2022/02/12 17:17:53 riastradh Exp $ */
+/* $NetBSD: lock.h,v 1.33 2022/02/13 13:42:30 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@ __cpu_simple_lock(__cpu_simple_lock_t *a
 		"	# END __cpu_simple_lock\n"
 		: "=" (t0), "=m" (*alp)
 		: "i" (__SIMPLELOCK_LOCKED), "m" (*alp)
-		: "memory");
+		: "cc", "memory");
 }
 
 static __inline int
@@ -126,7 +126,7 @@ __cpu_simple_lock_try(__cpu_simple_lock_
 		"	# END __cpu_simple_lock_try"
 		: "=" (t0), "=r" (v0), "=m" (*alp)
 		: "i" (__SIMPLELOCK_LOCKED), "m" (*alp)
-		: "memory");
+		: "cc", "memory");
 
 	return (v0 != 0);
 }
@@ -140,7 +140,9 @@ __cpu_simple_unlock(__cpu_simple_lock_t 
 		"	mb			\n"
 		"	stl	$31, %0		\n"
 		"	# END __cpu_simple_unlock"
-		: "=m" (*alp));
+		: "=m" (*alp)
+		: /* no inputs */
+		: "memory");
 }
 
 #if defined(MULTIPROCESSOR)



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

2022-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 13 13:42:30 UTC 2022

Modified Files:
src/sys/arch/alpha/include: lock.h

Log Message:
alpha: __cpu_simple_lock audit.

Add missing "cc" and "memory" asm clobbers to the compiler can't
reorder memory access around these.  The necessary memory barrier
instructions, mb, already appear in all the right places.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/include/lock.h

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



CVS commit: src/sys/arch/alpha/alpha

2021-12-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Dec  9 21:13:18 UTC 2021

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

Log Message:
Few typos slipped in the last review, fixing them.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/arch/alpha/alpha/pmap.c

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



CVS commit: src/sys/arch/alpha/alpha

2021-12-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Dec  9 21:13:18 UTC 2021

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

Log Message:
Few typos slipped in the last review, fixing them.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.303 src/sys/arch/alpha/alpha/pmap.c:1.304
--- src/sys/arch/alpha/alpha/pmap.c:1.303	Sun Sep 19 20:43:46 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Thu Dec  9 21:13:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $ */
+/* $NetBSD: pmap.c,v 1.304 2021/12/09 21:13:18 andvar Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.304 2021/12/09 21:13:18 andvar Exp $");
 
 #include 
 #include 
@@ -2106,7 +2106,7 @@ pmap_enter_l2pt_delref(pmap_t const pmap
 	/*
 	 * PALcode may have tried to service a TLB miss with
 	 * this L2 PTE, so we need to make sure we don't actually
-	 * free the PT page untl we've shot down any TLB entries
+	 * free the PT page until we've shot down any TLB entries
 	 * for this VPT index.
 	 */
 
@@ -3810,7 +3810,7 @@ pmap_l2pt_delref(pmap_t pmap, pt_entry_t
 			"0x%lx\n", pmap_pte_pa(l1pte));
 #endif
 		/*
-		 * You can pass NULL if you know the last refrence won't
+		 * You can pass NULL if you know the last reference won't
 		 * be dropped.
 		 */
 		KASSERT(tlbctx != NULL);
@@ -3870,7 +3870,7 @@ pmap_asn_alloc(pmap_t const pmap, struct
 	KASSERT(pmap->pm_percpu[ci->ci_cpuid].pmc_lev1map != kernel_lev1map);
 	KASSERT(kpreempt_disabled());
 
-	/* No work to do if the the CPU does not implement ASNs. */
+	/* No work to do if the CPU does not implement ASNs. */
 	if (pmap_max_asn == 0)
 		return 0;
 



CVS commit: src/sys/arch/alpha/pci

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:31:06 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: ttwogareg.h

Log Message:
s/exchage/exchange/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwogareg.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/alpha/pci/ttwogareg.h
diff -u src/sys/arch/alpha/pci/ttwogareg.h:1.4 src/sys/arch/alpha/pci/ttwogareg.h:1.5
--- src/sys/arch/alpha/pci/ttwogareg.h:1.4	Mon Feb  6 02:14:15 2012
+++ src/sys/arch/alpha/pci/ttwogareg.h	Sun Dec  5 04:31:06 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ttwogareg.h,v 1.4 2012/02/06 02:14:15 matt Exp $ */
+/* $NetBSD: ttwogareg.h,v 1.5 2021/12/05 04:31:06 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -189,7 +189,7 @@ extern bus_addr_t ttwoga_gamma_cbus_bias
 #define	IOCSR_ENTLBEC	0x0080UL	/* enable TLB error check */
 #define	IOCSR_ENCCMDA	0x0100UL	/* enable CXACK check */
 	/*		0x0200UL	   must be zero */
-#define	IOCSR_ENXXCHG	0x0400UL	/* EV5 excl. exchage enable */
+#define	IOCSR_ENXXCHG	0x0400UL	/* EV5 excl. exchange enable */
 	/*		0x0800UL	   must be zero */
 #define	IOCSR_CAWWP0	0x1000UL	/* CBUS c/a wr. wrong parity */
 #define	IOCSR_CAWWP2	0x2000UL	/* CBUS c/a wr. wrong parity */



CVS commit: src/sys/arch/alpha/pci

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:31:06 UTC 2021

Modified Files:
src/sys/arch/alpha/pci: ttwogareg.h

Log Message:
s/exchage/exchange/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/pci/ttwogareg.h

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



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

2021-10-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Oct 29 01:49:26 UTC 2021

Modified Files:
src/sys/arch/alpha/include: signal.h

Log Message:
Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/include/signal.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/alpha/include/signal.h
diff -u src/sys/arch/alpha/include/signal.h:1.18 src/sys/arch/alpha/include/signal.h:1.19
--- src/sys/arch/alpha/include/signal.h:1.18	Tue Oct 26 16:16:34 2021
+++ src/sys/arch/alpha/include/signal.h	Fri Oct 29 01:49:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: signal.h,v 1.18 2021/10/26 16:16:34 christos Exp $ */
+/* $NetBSD: signal.h,v 1.19 2021/10/29 01:49:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -32,6 +32,8 @@
 
 #include 
 
+#define	__HAVE_STRUCT_SIGCONTEXT
+
 typedef long	sig_atomic_t;
 
 #ifdef _KERNEL_OPT
@@ -66,7 +68,6 @@ struct sigcontext13 {
 #endif /* _KERNEL && COMPAT_13 */
 
 #if defined(_LIBC) || (defined(_KERNEL) && defined(COMPAT_16))
-#define	__HAVE_STRUCT_SIGCONTEXT
 struct sigcontext {
 	long	sc_onstack;		/* sigstack state to restore */
 	long	__sc_mask13;		/* signal mask to restore (old style) */



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

2021-10-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Oct 29 01:49:26 UTC 2021

Modified Files:
src/sys/arch/alpha/include: signal.h

Log Message:
Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/include/signal.h

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



CVS commit: src/sys/arch/alpha

2021-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 25 20:16:17 UTC 2021

Modified Files:
src/sys/arch/alpha/eisa: eisa_machdep.c
src/sys/arch/alpha/include: eisa_machdep.h

Log Message:
Make all of the EISA chipset functions call through real functions,
rather the macros.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/eisa/eisa_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/eisa_machdep.h

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

Modified files:

Index: src/sys/arch/alpha/eisa/eisa_machdep.c
diff -u src/sys/arch/alpha/eisa/eisa_machdep.c:1.13 src/sys/arch/alpha/eisa/eisa_machdep.c:1.14
--- src/sys/arch/alpha/eisa/eisa_machdep.c:1.13	Wed Nov 18 02:04:29 2020
+++ src/sys/arch/alpha/eisa/eisa_machdep.c	Sat Sep 25 20:16:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: eisa_machdep.c,v 1.13 2020/11/18 02:04:29 thorpej Exp $ */
+/* $NetBSD: eisa_machdep.c,v 1.14 2021/09/25 20:16:17 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.13 2020/11/18 02:04:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.14 2021/09/25 20:16:17 thorpej Exp $");
 
 #include 
 #include 
@@ -45,6 +45,51 @@ __KERNEL_RCSID(0, "$NetBSD: eisa_machdep
 #include 
 #include 
 
+void
+eisa_attach_hook(device_t parent, device_t self,
+struct eisabus_attach_args *eba)
+{
+	eba->eba_ec->ec_attach_hook(parent, self, eba);
+}
+
+int
+eisa_maxslots(eisa_chipset_tag_t ec)
+{
+	return ec->ec_maxslots(ec->ec_v);
+}
+
+int
+eisa_intr_map(eisa_chipset_tag_t ec, u_int irq, eisa_intr_handle_t *ihp)
+{
+	return ec->ec_intr_map(ec->ec_v, irq, ihp);
+}
+
+const char *
+eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih, char *buf,
+size_t len)
+{
+	return ec->ec_intr_string(ec->ec_v, ih, buf, len);
+}
+
+const struct evcnt *
+eisa_intr_evcnt(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
+{
+	return ec->ec_intr_evcnt(ec->ec_v, ih);
+}
+
+void *
+eisa_intr_establish(eisa_chipset_tag_t ec, eisa_intr_handle_t ih,
+int type, int level, int (*func)(void *), void *arg)
+{
+	return ec->ec_intr_establish(ec->ec_v, ih, type, level, func, arg);
+}
+
+void
+eisa_intr_disestablish(eisa_chipset_tag_t ec, void *cookie)
+{
+	return ec->ec_intr_disestablish(ec->ec_v, cookie);
+}
+
 #define	EISA_SLOT_HEADER_SIZE	31
 #define	EISA_SLOT_INFO_OFFSET	20
 

Index: src/sys/arch/alpha/include/eisa_machdep.h
diff -u src/sys/arch/alpha/include/eisa_machdep.h:1.12 src/sys/arch/alpha/include/eisa_machdep.h:1.13
--- src/sys/arch/alpha/include/eisa_machdep.h:1.12	Sat Mar 29 19:28:25 2014
+++ src/sys/arch/alpha/include/eisa_machdep.h	Sat Sep 25 20:16:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: eisa_machdep.h,v 1.12 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: eisa_machdep.h,v 1.13 2021/09/25 20:16:17 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -51,29 +51,25 @@ struct alpha_eisa_chipset {
 /*
  * Functions provided to machine-independent EISA code.
  */
-#define	eisa_attach_hook(p, s, a)	\
-(*(a)->eba_ec->ec_attach_hook)((p), (s), (a))
-#define	eisa_maxslots(c)		\
-(*(c)->ec_maxslots)((c)->ec_v)
-#define	eisa_intr_map(c, i, hp)		\
-(*(c)->ec_intr_map)((c)->ec_v, (i), (hp))
-#define	eisa_intr_string(c, h, buf, len)\
-(*(c)->ec_intr_string)((c)->ec_v, (h), (buf), (len))
-#define	eisa_intr_evcnt(c, h)		\
-(*(c)->ec_intr_evcnt)((c)->ec_v, (h))
-#define	eisa_intr_establish(c, h, t, l, f, a)\
-(*(c)->ec_intr_establish)((c)->ec_v, (h), (t), (l), (f), (a))
-#define	eisa_intr_disestablish(c, h)	\
-(*(c)->ec_intr_disestablish)((c)->ec_v, (h))
-
-int	eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int,
-	struct eisa_cfg_mem *);
-int	eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int,
-	struct eisa_cfg_irq *);
-int	eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int,
-	struct eisa_cfg_dma *);
-int	eisa_conf_read_io(eisa_chipset_tag_t, int, int, int,
-	struct eisa_cfg_io *);
+void		eisa_attach_hook(device_t, device_t,
+		struct eisabus_attach_args *);
+int		eisa_maxslots(eisa_chipset_tag_t);
+int		eisa_intr_map(eisa_chipset_tag_t, u_int, eisa_intr_handle_t *);
+const char *	eisa_intr_string(eisa_chipset_tag_t, eisa_intr_handle_t,
+		char *, size_t);
+const struct evcnt *eisa_intr_evcnt(eisa_chipset_tag_t, eisa_intr_handle_t);
+void *		eisa_intr_establish(eisa_chipset_tag_t, eisa_intr_handle_t,
+		int, int, int (*)(void *), void *);
+void		eisa_intr_disestablish(eisa_chipset_tag_t, void *);
+
+int		eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int,
+		struct eisa_cfg_mem *);
+int		eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int,
+		struct eisa_cfg_irq *);
+int		eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int,
+		struct eisa_cfg_dma *);
+int		eisa_conf_read_io(eisa_chipset_tag_t, 

CVS commit: src/sys/arch/alpha

2021-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Sep 25 20:16:17 UTC 2021

Modified Files:
src/sys/arch/alpha/eisa: eisa_machdep.c
src/sys/arch/alpha/include: eisa_machdep.h

Log Message:
Make all of the EISA chipset functions call through real functions,
rather the macros.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/eisa/eisa_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/eisa_machdep.h

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



CVS commit: src/sys/arch/alpha/alpha

2021-09-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 19 20:43:46 UTC 2021

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

Log Message:
review and fix rest of the typos in alpha pmap.c.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/arch/alpha/alpha/pmap.c

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



CVS commit: src/sys/arch/alpha/alpha

2021-09-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 19 20:43:46 UTC 2021

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

Log Message:
review and fix rest of the typos in alpha pmap.c.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.302 src/sys/arch/alpha/alpha/pmap.c:1.303
--- src/sys/arch/alpha/alpha/pmap.c:1.302	Sun Sep 19 10:34:07 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Sun Sep 19 20:43:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.302 2021/09/19 10:34:07 andvar Exp $ */
+/* $NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.302 2021/09/19 10:34:07 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $");
 
 #include 
 #include 
@@ -544,7 +544,7 @@ pmap_pvlist_free(struct pmap_pvlist * co
  * Some things that add complexity:
  *
  * ==> ASNs. A CPU may have valid TLB entries for other than the current
- * address spaace.  We can only invalidate TLB entries for the current
+ * address space.  We can only invalidate TLB entries for the current
  * address space, so when asked to invalidate a VA for the non-current
  * pmap on a given CPU, we simply invalidate the ASN for that pmap,CPU
  * tuple so that new one is allocated on the next activation on that
@@ -587,7 +587,7 @@ pmap_pvlist_free(struct pmap_pvlist * co
  * global bitmap off CPUs to be notified, and then send the IPIs to
  * each victim.  While the other CPUs are in-flight, we then perform
  * any invalidations necessary on the local CPU.  Once that is done,
- * we then wait the the global context pointer to be cleared, which
+ * we then wait the global context pointer to be cleared, which
  * will be done by the final remote CPU to complete their work. This
  * method reduces cache line contention during processing.
  *
@@ -597,7 +597,7 @@ pmap_pvlist_free(struct pmap_pvlist * co
  * CPU might hold for the respective recursive VPT mappings.  This must
  * be done whenever an L1 or L2 PTE is invalidated.  Until these VPT
  * translations are invalidated, the PT pages must not be reused.  For
- * this reason, we keep a list of freed PT pages in the context stucture
+ * this reason, we keep a list of freed PT pages in the context structure
  * and drain them off once all invalidations are complete.
  *
  * NOTE: The value of TLB_CTX_MAXVA is tuned to accommodate the UBC
@@ -3635,7 +3635,7 @@ pmap_l1pt_ctor(void *arg, void *object, 
 /*
  * pmap_l1pt_alloc:
  *
- *	Page alloctaor for L1 PT pages.
+ *	Page allocator for L1 PT pages.
  */
 static void *
 pmap_l1pt_alloc(struct pool *pp, int flags)



  1   2   3   4   5   6   7   8   9   >