CVS commit: src/sys/dev/usb

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 25 01:33:04 UTC 2024

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

Log Message:
Add a match quirk to prevent matching any interface on SiPEED FPGA
development boards (e.g. Tang Nano 9K).  The FT2232s on these boards
are wired up only for JTAG.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.c

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

Modified files:

Index: src/sys/dev/usb/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.78 src/sys/dev/usb/uftdi.c:1.79
--- src/sys/dev/usb/uftdi.c:1.78	Wed Apr 17 02:34:45 2024
+++ src/sys/dev/usb/uftdi.c	Thu Apr 25 01:33:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -229,7 +229,19 @@ static const struct uftdi_match_quirk_en
 	  .vendor_str	= "SecuringHardware.com",
 	  .product_str	= "Tigard V1.1",
 	  .match_ret	= UMATCH_NONE,
-	}
+	},
+	/*
+	 * The SiPEED Tang Nano 9K (and other SiPEED Tang FPGA development
+	 * boards) have an FT2232 on-board, wired up only for JTAG.
+	 */
+	{
+	  .vendor_id	= USB_VENDOR_FTDI,
+	  .product_id	= USB_PRODUCT_FTDI_SERIAL_2232C,
+	  .iface_no	= -1,
+	  .vendor_str	= "SIPEED",
+	  .product_str	= "JTAG Debugger",
+	  .match_ret	= UMATCH_NONE,
+	},
 };
 
 static int
@@ -243,7 +255,7 @@ uftdi_quirk_match(struct usbif_attach_ar
 		q = _match_quirks[i];
 		if (uiaa->uiaa_vendor != q->vendor_id ||
 		uiaa->uiaa_product != q->product_id ||
-		uiaa->uiaa_ifaceno != q->iface_no) {
+		(q->iface_no != -1 && uiaa->uiaa_ifaceno != q->iface_no)) {
 			continue;
 		}
 		if (q->vendor_str != NULL &&



CVS commit: src/sys/dev/usb

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 25 01:33:04 UTC 2024

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

Log Message:
Add a match quirk to prevent matching any interface on SiPEED FPGA
development boards (e.g. Tang Nano 9K).  The FT2232s on these boards
are wired up only for JTAG.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.c

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



CVS commit: src/sys/dev/goldfish

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 14:41:13 UTC 2024

Modified Files:
src/sys/dev/goldfish: gfpic.c

Log Message:
Remove a superflouous printf().


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

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

Modified files:

Index: src/sys/dev/goldfish/gfpic.c
diff -u src/sys/dev/goldfish/gfpic.c:1.1 src/sys/dev/goldfish/gfpic.c:1.2
--- src/sys/dev/goldfish/gfpic.c:1.1	Tue Jan  2 07:27:51 2024
+++ src/sys/dev/goldfish/gfpic.c	Wed Apr 24 14:41:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $	*/
+/*	$NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $	*/
 
 /*- 
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.1 2024/01/02 07:27:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gfpic.c,v 1.2 2024/04/24 14:41:13 thorpej Exp $");
 
 #include 
 #include 
@@ -79,8 +79,6 @@ gfpic_enable(struct gfpic_softc *sc, int
 	KASSERT(pirq >= 0);
 	KASSERT(pirq <= 31);
 
-	device_printf(sc->sc_dev, "enabling IRQ %d (0x%08x)\n",
-	pirq, (1U << pirq));
 	REG_WRITE(sc, GFPIC_ENABLE, (1U << pirq));
 }
 



CVS commit: src/sys/dev/goldfish

2024-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 14:41:13 UTC 2024

Modified Files:
src/sys/dev/goldfish: gfpic.c

Log Message:
Remove a superflouous printf().


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

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



CVS commit: src/sys/kern

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:08:03 UTC 2024

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

Log Message:
vmem_init(): Ensure that the quantum is a power of 2, and that if private
tags are being used, they are added to the arena before the first span is
added.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/subr_vmem.c

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



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

Modified Files:
src/sys/dev/pci: btvmeii.c

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.c

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

Modified files:

Index: src/sys/dev/pci/btvmeii.c
diff -u src/sys/dev/pci/btvmeii.c:1.27 src/sys/dev/pci/btvmeii.c:1.28
--- src/sys/dev/pci/btvmeii.c:1.27	Tue Dec  5 15:58:32 2023
+++ src/sys/dev/pci/btvmeii.c	Wed Apr 24 02:31:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $ */
+/* $NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $");
 
 #include 
 #include 
@@ -328,7 +328,7 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm
 			0,			/* boundary */
 			VMEM_ADDR_MIN,		/* minaddr */
 			VMEM_ADDR_MAX,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			)) {
 		sc->windowused[wnd] = 0;
 		return (ENOMEM);



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

Modified Files:
src/sys/dev/pci: btvmeii.c

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.c

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



CVS commit: src/sys/dev/vme

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:27:33 UTC 2024

Modified Files:
src/sys/dev/vme: vme.c

Log Message:
_vme_space_get(): Use VM_BESTFIT.


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

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



CVS commit: src/sys/dev/vme

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:27:33 UTC 2024

Modified Files:
src/sys/dev/vme: vme.c

Log Message:
_vme_space_get(): Use VM_BESTFIT.


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

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

Modified files:

Index: src/sys/dev/vme/vme.c
diff -u src/sys/dev/vme/vme.c:1.30 src/sys/dev/vme/vme.c:1.31
--- src/sys/dev/vme/vme.c:1.30	Mon Dec  4 01:49:29 2023
+++ src/sys/dev/vme/vme.c	Wed Apr 24 02:27:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $ */
+/* $NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 thorpej Exp $");
 
 #include 
 #include 
@@ -336,7 +336,7 @@ _vme_space_get(struct vmebus_softc *sc, 
 			  0,			/* nocross */
 			  VMEM_ADDR_MIN,	/* minaddr */
 			  VMEM_ADDR_MAX,	/* maxaddr */
-			  VM_NOSLEEP,
+			  VM_BESTFIT | VM_NOSLEEP,
 			  );
 	if (!res)
 		*addr = help;



CVS commit: src/sys/kern

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:08:03 UTC 2024

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

Log Message:
vmem_init(): Ensure that the quantum is a power of 2, and that if private
tags are being used, they are added to the arena before the first span is
added.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/kern/subr_vmem.c

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

Modified files:

Index: src/sys/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.115 src/sys/kern/subr_vmem.c:1.116
--- src/sys/kern/subr_vmem.c:1.115	Sun Dec  3 19:34:08 2023
+++ src/sys/kern/subr_vmem.c	Wed Apr 24 02:08:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.116 2024/04/24 02:08:03 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.115 2023/12/03 19:34:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.116 2024/04/24 02:08:03 thorpej Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -971,6 +971,14 @@ vmem_init(vmem_t *vm, const char *name,
 	KASSERT((flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
 	KASSERT((~flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
 	KASSERT(quantum > 0);
+	KASSERT(powerof2(quantum));
+
+	/*
+	 * If private tags are going to be used, they must
+	 * be added to the arena before the first span is
+	 * added.
+	 */
+	KASSERT((flags & VM_PRIVTAGS) == 0 || size == 0);
 
 #if defined(_KERNEL)
 	/* XXX: SMP, we get called early... */



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/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

Modified Files:
src/sys/dev/pci: pciide_common.c

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.c

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

Modified files:

Index: src/sys/dev/pci/pciide_common.c
diff -u src/sys/dev/pci/pciide_common.c:1.70 src/sys/dev/pci/pciide_common.c:1.71
--- src/sys/dev/pci/pciide_common.c:1.70	Mon Nov 20 21:59:38 2023
+++ src/sys/dev/pci/pciide_common.c	Sun Mar 31 18:59:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $	*/
+/*	$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $	*/
 
 
 /*
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $");
 
 #include 
 
@@ -484,6 +484,16 @@ pciide_mapreg_dma(struct pciide_softc *s
 			aprint_verbose(
 			", but unused (forced off by config file)");
 			sc->sc_dma_ok = 0;
+		} else {
+			bool disable;
+
+			if (prop_dictionary_get_bool(
+			device_properties(sc->sc_wdcdev.sc_atac.atac_dev),
+			"pciide-disable-dma", ) && disable) {
+aprint_verbose(
+", but unused (disabled by platform)");
+sc->sc_dma_ok = 0;
+			}
 		}
 		break;
 



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

Modified Files:
src/sys/dev/pci: pciide_common.c

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.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

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 16:47:55 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-minipro

Log Message:
Add an example devpubd hook that looks for Minipro-compatible EEPROM
programmers and sets the access permissions to 0660.


To generate a diff of this commit:
cvs rdiff -u -r1.1337 -r1.1338 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-minipro
cvs rdiff -u -r1.2 -r1.3 src/share/examples/devpubd/hooks/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1337 src/distrib/sets/lists/base/mi:1.1338
--- src/distrib/sets/lists/base/mi:1.1337	Sat Mar 30 06:42:10 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 16:47:55 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1337 2024/03/30 06:42:10 thorpej Exp $
+# $NetBSD: mi,v 1.1338 2024/03/30 16:47:55 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2488,6 +2488,7 @@
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ugen-perms-minipro base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ugen-perms-tigard	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples

Index: src/share/examples/devpubd/hooks/Makefile
diff -u src/share/examples/devpubd/hooks/Makefile:1.2 src/share/examples/devpubd/hooks/Makefile:1.3
--- src/share/examples/devpubd/hooks/Makefile:1.2	Sat Mar 30 06:42:10 2024
+++ src/share/examples/devpubd/hooks/Makefile	Sat Mar 30 16:47:55 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2024/03/30 06:42:10 thorpej Exp $
+#	$NetBSD: Makefile,v 1.3 2024/03/30 16:47:55 thorpej Exp $
 
 NOOBJ=	# defined
 
@@ -6,6 +6,7 @@ NOOBJ=	# defined
 
 .if ${MKSHARE} != "no"
 FILES=	99-ucom-symlinks
+FILES+=	99-ugen-perms-minipro
 FILES+=	99-ugen-perms-tigard
 FILESDIR=/usr/share/examples/devpubd/hooks
 .endif

Added files:

Index: src/share/examples/devpubd/hooks/99-ugen-perms-minipro
diff -u /dev/null src/share/examples/devpubd/hooks/99-ugen-perms-minipro:1.1
--- /dev/null	Sat Mar 30 16:47:55 2024
+++ src/share/examples/devpubd/hooks/99-ugen-perms-minipro	Sat Mar 30 16:47:55 2024
@@ -0,0 +1,144 @@
+#!/bin/sh -x
+#
+# $NetBSD: 99-ugen-perms-minipro,v 1.1 2024/03/30 16:47:55 thorpej Exp $
+#
+# Look for a "Minipro" (https://gitlab.com/DavidGriffith/minipro) compatible
+# EEPROM programmer and change change the permissions to 0660.
+#
+# Written by Jason R. Thorpe, March 2024.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+orig_perms=0600
+new_perms=0660
+
+orig_group=wheel
+new_group=wheel
+
+device_name=minipro
+
+is_target_device()
+{
+	local vendor_string
+	local product_string
+	local vendor_id
+	local product_id
+
+	#
+	# TL866A/TL866CS programmers have:
+	#
+	#	VID = 0x04d8 (1240)	# Microchip
+	#	PID = 0xe11c (57628)	# probably some PIC microcontroller
+	#
+	# XXX It's probably better to match on vendor-string / product-string
+	# in this case because of the use of the generic Microchip VID.
+	#
+	# The XGecu-branded TL866II+ devices have:
+	#
+	#	vendor-string="Xingong Electronicg Co.."
+	#	product-string="Xingong XGecu USB Prog.. Device"
+	#
+	# ...but they also have seemingly unique VID/PID (not the
+	# generic Microchip VID the older TL866A/CS programmers have):
+	#
+	#	VID = 0xa466 (42086)
+	#	PID = 0x0a53 (2643)
+	#
+	# XXX Add the XGecu T48 programmer info here.
+	#
+
+	vendor_string="$(drvctl -p $1 vendor-string)"
+	product_string="$(drvctl -p $1 product-string)"
+	vendor_id="$(drvctl -p $1 vendor-id)"
+	product_id="$(drvctl -p $1 product-id)"
+
+	#
+	# TL866A / TL866CS
+	#
+	if [ x"$vendor_id" = x"1240" -a \
+	 x"$product_id" = x"57628" ]; then
+		echo "yes"
+		return;
+	fi
+
+	#
+	# TL866II+
+	#
+	if [ x"$vendor_id" = x"42086" -a \
+	 x"$product_id" = x"2643" ]; then
+		echo "yes"
+		return
+	fi
+
+	echo "no"
+}
+
+set_permissions()
+{
+	if [ x$(is_target_device $1) = xyes ]; then
+		chgrp $new_group /dev/"${2}".*
+		chmod $new_perms /dev/"${2}".*
+		#
+		# We need to create a symlink here to remember
+		# the ugen device node that was used, since we
+		# can't recover it from the device name that
+		# comes from the kernel later because we get the
+		# event *after* the device is gone, and 

CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 16:47:55 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-minipro

Log Message:
Add an example devpubd hook that looks for Minipro-compatible EEPROM
programmers and sets the access permissions to 0660.


To generate a diff of this commit:
cvs rdiff -u -r1.1337 -r1.1338 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-minipro
cvs rdiff -u -r1.2 -r1.3 src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:42:10 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-tigard

Log Message:
Add an example devpubd hook that detects the generic USB interface
portion of a Tigard debug board and changes the permissions of the
appropriate /dev/ugenN.* nodes to allow access without superuser
permissions, suitable for using e.g. openocd with the device.

This example can be easily modified to support other generic USB devices
that have user-space drivers where running as the superuser is not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-tigard
cvs rdiff -u -r1.1 -r1.2 src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:42:10 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/share/examples/devpubd/hooks: Makefile
Added Files:
src/share/examples/devpubd/hooks: 99-ugen-perms-tigard

Log Message:
Add an example devpubd hook that detects the generic USB interface
portion of a Tigard debug board and changes the permissions of the
appropriate /dev/ugenN.* nodes to allow access without superuser
permissions, suitable for using e.g. openocd with the device.

This example can be easily modified to support other generic USB devices
that have user-space drivers where running as the superuser is not desired.


To generate a diff of this commit:
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ugen-perms-tigard
cvs rdiff -u -r1.1 -r1.2 src/share/examples/devpubd/hooks/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1336 src/distrib/sets/lists/base/mi:1.1337
--- src/distrib/sets/lists/base/mi:1.1336	Sat Mar 30 06:29:01 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:42:10 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1336 2024/03/30 06:29:01 thorpej Exp $
+# $NetBSD: mi,v 1.1337 2024/03/30 06:42:10 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2488,6 +2488,7 @@
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ugen-perms-tigard	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Index: src/share/examples/devpubd/hooks/Makefile
diff -u src/share/examples/devpubd/hooks/Makefile:1.1 src/share/examples/devpubd/hooks/Makefile:1.2
--- src/share/examples/devpubd/hooks/Makefile:1.1	Sat Mar 30 06:29:01 2024
+++ src/share/examples/devpubd/hooks/Makefile	Sat Mar 30 06:42:10 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2024/03/30 06:29:01 thorpej Exp $
+#	$NetBSD: Makefile,v 1.2 2024/03/30 06:42:10 thorpej Exp $
 
 NOOBJ=	# defined
 
@@ -6,6 +6,7 @@ NOOBJ=	# defined
 
 .if ${MKSHARE} != "no"
 FILES=	99-ucom-symlinks
+FILES+=	99-ugen-perms-tigard
 FILESDIR=/usr/share/examples/devpubd/hooks
 .endif
 

Added files:

Index: src/share/examples/devpubd/hooks/99-ugen-perms-tigard
diff -u /dev/null src/share/examples/devpubd/hooks/99-ugen-perms-tigard:1.1
--- /dev/null	Sat Mar 30 06:42:10 2024
+++ src/share/examples/devpubd/hooks/99-ugen-perms-tigard	Sat Mar 30 06:42:10 2024
@@ -0,0 +1,105 @@
+#!/bin/sh -
+#
+# $NetBSD: 99-ugen-perms-tigard,v 1.1 2024/03/30 06:42:10 thorpej Exp $
+#
+# Look for a Tigard (https://github.com/tigard-tools/tigard) debug
+# board and change the permissions to 0660.
+#
+# Written by Jason R. Thorpe, March 2024.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+orig_perms=0600
+new_perms=0660
+
+orig_group=wheel
+new_group=wheel
+
+device_name=tigard
+
+is_target_device()
+{
+	local vendor_string
+	local product_string
+
+	vendor_string="$(drvctl -p $1 vendor-string)"
+	product_string="$(drvctl -p $1 product-string)"
+
+	if [ x"$vendor_string" = x"SecuringHardware.com" -a \
+	 x"$product_string" = x"Tigard V1.1" ]; then
+		echo "yes"
+		return
+	fi
+
+	echo "no"
+}
+
+set_permissions()
+{
+	if [ x$(is_target_device $1) = xyes ]; then
+		chgrp $new_group /dev/"${2}".*
+		chmod $new_perms /dev/"${2}".*
+		#
+		# We need to create a symlink here to remember
+		# the ugen device node that was used, since we
+		# can't recover it from the device name that
+		# comes from the kernel later because we get the
+		# event *after* the device is gone, and thus
+		# cannot query any properties.
+		#
+		rm -f /dev/${1}-${device_name}
+		ln -sf ${2} /dev/${1}-${device_name}
+	fi
+}
+
+restore_permissions()
+{
+	if [ -h "/dev/${1}-${device_name}" ]; then
+		devnode=$(readlink "/dev/${1}-${device_name}")
+		if [ x"$devnode" != x ]; then
+			chmod $orig_perms /dev/"${devnode}".*
+			chgrp $orig_group /dev/"${devnode}".*
+		fi
+		rm -f "/dev/${1}-${device_name}"
+	fi
+}
+
+get_ugen_devnode()
+{
+	# Because "ugen" and "ugenif" share the same /dev/ugenN.*
+	# namespace, we have to query an additional property to
+	# determine which one it is.
+	local ugen_unit
+
+	ugen_unit=$(drvctl -p $1 ugen-unit)
+	case "$ugen_unit" in
+	[0-9]*)
+		echo "ugen$ugen_unit"
+		;;
+	esac
+}

CVS commit: src/share/examples

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:34 UTC 2024

Modified Files:
src/share/examples: Makefile
Added Files:
src/share/examples/devpubd: Makefile

Log Message:
Descend into share/examples/devpubd/hooks


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/examples/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/Makefile

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

Modified files:

Index: src/share/examples/Makefile
diff -u src/share/examples/Makefile:1.24 src/share/examples/Makefile:1.25
--- src/share/examples/Makefile:1.24	Tue Oct 15 18:32:59 2019
+++ src/share/examples/Makefile	Sat Mar 30 06:29:33 2024
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.24 2019/10/15 18:32:59 christos Exp $
+#	$NetBSD: Makefile,v 1.25 2024/03/30 06:29:33 thorpej Exp $
 
-SUBDIR= amd apm asm disktab emul fstab ftpd getdate hostapd \
+SUBDIR= amd apm asm devpubd disktab emul fstab ftpd getdate hostapd \
 lua npf pppd racoon syslogd wpa_supplicant wsmoused
 
 .include 

Added files:

Index: src/share/examples/devpubd/Makefile
diff -u /dev/null src/share/examples/devpubd/Makefile:1.1
--- /dev/null	Sat Mar 30 06:29:34 2024
+++ src/share/examples/devpubd/Makefile	Sat Mar 30 06:29:33 2024
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile,v 1.1 2024/03/30 06:29:33 thorpej Exp $
+
+SUBDIR= hooks
+
+.include 



CVS commit: src/share/examples

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:34 UTC 2024

Modified Files:
src/share/examples: Makefile
Added Files:
src/share/examples/devpubd: Makefile

Log Message:
Descend into share/examples/devpubd/hooks


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/examples/Makefile
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:01 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
Added Files:
src/share/examples/devpubd/hooks: 99-ucom-symlinks Makefile

Log Message:
Add an example devpubd hook that makes stable path names, using symlinks,
for USB serial interfaces, regardless of where the interface is connected
or the order of enumeration.  This requires the USB device to have a
"serialnumber" to function.  Examples:

- uftdi serial adapter with two ports:

/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
/dev/tty-uftdi-FT64S4YP-2 -> /dev/ttyU1

- uslsa serial adapter:

/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4

This allows something like the following in /etc/remote:

sun3:dv=/dev/tty-uftdi-FT64S4YP-1:br#9600:pa=none:dc:

That path will always be stable regardless of which /dev/ttyU* node is
actually assigned when the serial adapter is plugged in.


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ucom-symlinks \
src/share/examples/devpubd/hooks/Makefile

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:29:01 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
Added Files:
src/share/examples/devpubd/hooks: 99-ucom-symlinks Makefile

Log Message:
Add an example devpubd hook that makes stable path names, using symlinks,
for USB serial interfaces, regardless of where the interface is connected
or the order of enumeration.  This requires the USB device to have a
"serialnumber" to function.  Examples:

- uftdi serial adapter with two ports:

/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
/dev/tty-uftdi-FT64S4YP-2 -> /dev/ttyU1

- uslsa serial adapter:

/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4

This allows something like the following in /etc/remote:

sun3:dv=/dev/tty-uftdi-FT64S4YP-1:br#9600:pa=none:dc:

That path will always be stable regardless of which /dev/ttyU* node is
actually assigned when the serial adapter is plugged in.


To generate a diff of this commit:
cvs rdiff -u -r1.1335 -r1.1336 src/distrib/sets/lists/base/mi
cvs rdiff -u -r0 -r1.1 src/share/examples/devpubd/hooks/99-ucom-symlinks \
src/share/examples/devpubd/hooks/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1335 src/distrib/sets/lists/base/mi:1.1336
--- src/distrib/sets/lists/base/mi:1.1335	Sat Mar 30 06:11:59 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:29:01 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1335 2024/03/30 06:11:59 thorpej Exp $
+# $NetBSD: mi,v 1.1336 2024/03/30 06:29:01 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2487,6 +2487,7 @@
 ./usr/share/examples/certctl/certs.conf		base-sysutil-examples
 ./usr/share/examples/devpubd			base-sys-examples
 ./usr/share/examples/devpubd/hooks		base-sys-examples
+./usr/share/examples/devpubd/hooks/99-ucom-symlinks	base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Added files:

Index: src/share/examples/devpubd/hooks/99-ucom-symlinks
diff -u /dev/null src/share/examples/devpubd/hooks/99-ucom-symlinks:1.1
--- /dev/null	Sat Mar 30 06:29:01 2024
+++ src/share/examples/devpubd/hooks/99-ucom-symlinks	Sat Mar 30 06:29:01 2024
@@ -0,0 +1,134 @@
+#!/bin/sh -
+#
+# $NetBSD: 99-ucom-symlinks,v 1.1 2024/03/30 06:29:01 thorpej Exp $
+#
+# Attempt to create stable names (using symbolic links) to USB serial
+# devices, regardless of device enumeration order, suitable for use in
+# configuration files.  The format of the stable names is:
+#
+#	/dev/{cdt}ty-$driver-$serialnumber-$portnumber
+# - or -
+#	/dev/{cdt}ty-$driver-$serialnumber
+#
+# depending on whether or not the device is a multi-port adapter.
+#
+# e.g.
+#
+#	/dev/tty-uftdi-FT64S4YP-1 -> /dev/ttyU0
+#
+#	/dev/tty-uslsa-01E7ABCC -> /dev/ttyU4
+#
+# If $driver or $serialnumber cannot be determined, then no symbolic link
+# will be created.
+#
+# Written by Jason R. Thorpe, December 2022.  Public domain.
+#
+
+export LC_ALL=C
+
+event="$1"
+shift
+devices=$@
+
+symlink_name()
+{
+	local parent
+	local portnum
+	local serialnum
+	local driver
+
+	parent=$(drvctl -p $1 device-parent)
+	if [ x"$parent" != x ]; then
+		driver=$(drvctl -p $parent device-driver)
+		serialnum=$(drvctl -p $parent serialnumber)
+	fi
+
+	# If the device is a single-port device, it may have the default
+	# port number locator of '-1'.  In that case, elide the port
+	# number.
+	portnum=$(drvctl -p $1 port)
+	if [ x"$portnum" = x"-1" -o x"$portnum" = x ]; then
+		portnum=""
+	else
+		portnum="-${portnum}"
+	fi
+
+	if [ x"$driver" != x -a x"$serialnum" != x ]; then
+		echo "${driver}-${serialnum}${portnum}"
+	else
+		echo ""
+	fi
+}
+
+remove_ucom_symlink()
+{
+	local name
+	local unit
+
+	name=$(readlink "/dev/${1}")
+
+	if [ x"$name" != x ]; then
+		rm -f "/dev/tty-${name}"
+		rm -f "/dev/dty-${name}"
+		rm -f "/dev/cty-${name}"
+		rm -f "/dev/${1}"
+	fi
+}
+
+add_ucom_symlink()
+{
+	local name
+	local tty_path
+	local dty_path
+	local cty_path
+
+	name=$(symlink_name $1)
+	unit=$(drvctl -p $1 device-unit)
+
+	if [ x"$name" != x -a x"$unit" != x ]; then
+		#
+		# We need to make two sets of symlinks:
+		#
+		# /dev/tty-uslsa-01E7ABCC -> /dev/ttyU4
+		#
+		# /dev/ucom4 -> uslsa-01E7ABCC
+		#
+		# This is needed because when we get the detach event
+		# for e.g. ucom4, the parent device (e.g. uslsa0) may
+		# already be gone, meaning we cannot query it.  So
+		# what we're doing is stashing the information in the
+		# second symlink so we can readlink(

CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:11:59 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/etc/mtree: NetBSD.dist.base

Log Message:
Add an examples directory for devpubd hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.255 -r1.256 src/etc/mtree/NetBSD.dist.base

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



CVS commit: src

2024-03-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar 30 06:11:59 UTC 2024

Modified Files:
src/distrib/sets/lists/base: mi
src/etc/mtree: NetBSD.dist.base

Log Message:
Add an examples directory for devpubd hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.1334 -r1.1335 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.255 -r1.256 src/etc/mtree/NetBSD.dist.base

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1334 src/distrib/sets/lists/base/mi:1.1335
--- src/distrib/sets/lists/base/mi:1.1334	Sun Mar  3 04:35:18 2024
+++ src/distrib/sets/lists/base/mi	Sat Mar 30 06:11:59 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1334 2024/03/03 04:35:18 riastradh Exp $
+# $NetBSD: mi,v 1.1335 2024/03/30 06:11:59 thorpej Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2485,6 +2485,8 @@
 ./usr/share/examples/blocklist/npf.conf		base-sys-examples
 ./usr/share/examples/certctl			base-sysutil-examples
 ./usr/share/examples/certctl/certs.conf		base-sysutil-examples
+./usr/share/examples/devpubd			base-sys-examples
+./usr/share/examples/devpubd/hooks		base-sys-examples
 ./usr/share/examples/dhcp			base-dhcpd-examples
 ./usr/share/examples/dhcpcd			base-dhcpcd-examples
 ./usr/share/examples/dhcpcd/hooks		base-dhcpcd-examples

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.255 src/etc/mtree/NetBSD.dist.base:1.256
--- src/etc/mtree/NetBSD.dist.base:1.255	Sat Jan 27 21:06:09 2024
+++ src/etc/mtree/NetBSD.dist.base	Sat Mar 30 06:11:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.255 2024/01/27 21:06:09 riastradh Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.256 2024/03/30 06:11:58 thorpej Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -479,6 +479,8 @@
 ./usr/share/examples/atf
 ./usr/share/examples/blocklist
 ./usr/share/examples/certctl
+./usr/share/examples/devpubd
+./usr/share/examples/devpubd/hooks
 ./usr/share/examples/dhcp
 ./usr/share/examples/dhcpcd
 ./usr/share/examples/dhcpcd/hooks



CVS commit: src/sys/dev/usb

2024-03-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 29 19:30:09 UTC 2024

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

Log Message:
ugen and ugenif share the same /dev/ugenN.xx namespace in such a way
that the device unit number does not necessarily match the /dev/ugenN.xx
unit number (N).  If you ONLY have ugen devices, it happens to work out
and devpubd scripts can be extremely naive.  If you ONLY have ugenif
devices, it also happens to work out, but your devpubd scripts have to
slightly more informed.  If you have a mix of ugen AND ugenif devices,
though, you're pretty much out of luck.

So, this change adds a "ugen-unit" device property which devpubd scripts
can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif
device is using.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.176 src/sys/dev/usb/ugen.c:1.177
--- src/sys/dev/usb/ugen.c:1.176	Tue Mar 26 03:24:14 2024
+++ src/sys/dev/usb/ugen.c	Fri Mar 29 19:30:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $	*/
+/*	$NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -238,12 +238,18 @@ ugenif_get_unit(struct ugen_softc *sc)
 	KASSERT(sc0 == sc);
 	KASSERT(rb_tree_find_node(, ) == sc);
 	mutex_exit();
+
+	prop_dictionary_set_uint(device_properties(sc->sc_dev),
+	"ugen-unit", sc->sc_unit);
 }
 
 static void
 ugenif_put_unit(struct ugen_softc *sc)
 {
 
+	prop_dictionary_remove(device_properties(sc->sc_dev),
+	"ugen-unit");
+
 	mutex_enter();
 	KASSERT(rb_tree_find_node(, >sc_unit) == sc);
 	rb_tree_remove_node(, sc);



CVS commit: src/sys/dev/usb

2024-03-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 29 19:30:09 UTC 2024

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

Log Message:
ugen and ugenif share the same /dev/ugenN.xx namespace in such a way
that the device unit number does not necessarily match the /dev/ugenN.xx
unit number (N).  If you ONLY have ugen devices, it happens to work out
and devpubd scripts can be extremely naive.  If you ONLY have ugenif
devices, it also happens to work out, but your devpubd scripts have to
slightly more informed.  If you have a mix of ugen AND ugenif devices,
though, you're pretty much out of luck.

So, this change adds a "ugen-unit" device property which devpubd scripts
can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif
device is using.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.c

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



CVS commit: src/sys/dev/usb

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:38:02 UTC 2024

Modified Files:
src/sys/dev/usb: uftdi.c usbdevices.config

Log Message:
Add a "match quirk" mechanism to the uftdi driver that allows it to
selectively reject individual interfaces based on the combination of
- Vendor ID
- Product ID
- Interface number
- Vendor string
- Product string

This is necessary[*] to allow some devices that would otherwise match
uftdi (and thus instantiate a ucom) to be matched by ugenif instead,
which is required to make the device available to libusb1.

[*] ...due to a deficiency in the USB stack that does not provide a
mechanism for a user-space driver to claim a device from a kernel driver
and then return it back at a later time.

Use this new match quirk mechanism to reject "interface 1" of the
FTDI 2232C-based Tigard debug board; On this board, "interface 0"
is brought out to regular TTL-level UART pins, but "interface 1" is
brought out to SWD and JTAG headers, and is really only useful when
used with something like openocd.  Because the FTDI 2232C on this board
just uses the standard FTDI vendor and product IDs, it can only be
distinguished by the strings, which cannot be specified usbdevices.config,
thus necessitating the match quirk entry (that works in combination
with the ugenif entry added in usbdevices.config).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config

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

Modified files:

Index: src/sys/dev/usb/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.76 src/sys/dev/usb/uftdi.c:1.77
--- src/sys/dev/usb/uftdi.c:1.76	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/uftdi.c	Tue Mar 26 03:38:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -184,10 +185,72 @@ static int	uftdi_detach(device_t, int);
 CFATTACH_DECL2_NEW(uftdi, sizeof(struct uftdi_softc), uftdi_match,
 uftdi_attach, uftdi_detach, NULL, NULL, uftdi_childdet);
 
+struct uftdi_match_quirk_entry {
+	uint16_t	vendor_id;
+	uint16_t	product_id;
+	int		iface_no;
+	const char *	vendor_str;
+	const char *	product_str;
+	int		match_ret;
+};
+
+static const struct uftdi_match_quirk_entry uftdi_match_quirks[] = {
+	/*
+	 * The Tigard board (https://github.com/tigard-tools/tigard)
+	 * has two interfaces, one of which is meant to act as a
+	 * regular USB serial port (interface 0), the other of which
+	 * is meant for other protocols (SWD, JTAG, etc.).  We must
+	 * reject interface 1 so that ugenif matches, thus allowing
+	 * full user-space control of that port.
+	 */
+	{
+	  .vendor_id	= USB_VENDOR_FTDI,
+	  .product_id	= USB_PRODUCT_FTDI_SERIAL_2232C,
+	  .iface_no	= 1,
+	  .vendor_str	= "SecuringHardware.com",
+	  .product_str	= "Tigard V1.1",
+	  .match_ret	= UMATCH_NONE,
+	}
+};
+
+static int
+uftdi_quirk_match(struct usbif_attach_arg *uiaa, int rv)
+{
+	struct usbd_device *dev = uiaa->uiaa_device;
+	const struct uftdi_match_quirk_entry *q;
+	int i;
+
+	for (i = 0; i < __arraycount(uftdi_match_quirks); i++) {
+		q = _match_quirks[i];
+		if (uiaa->uiaa_vendor != q->vendor_id ||
+		uiaa->uiaa_product != q->product_id ||
+		uiaa->uiaa_ifaceno != q->iface_no) {
+			continue;
+		}
+		if (q->vendor_str != NULL &&
+		(dev->ud_vendor == NULL ||
+		 strcmp(dev->ud_vendor, q->vendor_str) != 0)) {
+			continue;
+		}
+		if (q->product_str != NULL &&
+		(dev->ud_product == NULL ||
+		 strcmp(dev->ud_product, q->product_str) != 0)) {
+			continue;
+		}
+		/*
+		 * Got a match!
+		 */
+		rv = q->match_ret;
+		break;
+	}
+	return rv;
+}
+
 static int
 uftdi_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct usbif_attach_arg *uiaa = aux;
+	int rv;
 
 	DPRINTFN(20,("uftdi: vendor=%#x, product=%#x\n",
 		 uiaa->uiaa_vendor, uiaa->uiaa_product));
@@ -195,8 +258,12 @@ uftdi_match(device_t parent, cfdata_t ma
 	if (uiaa->uiaa_configno != UFTDI_CONFIG_NO)
 		return UMATCH_NONE;
 
-	return uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ?
+	rv = uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ?
 		UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE;
+	if (rv != UMATCH_NONE) {
+		rv = uftdi_quirk_match(uiaa, rv);
+	}
+	return rv;
 }
 
 static void

Index: src/sys/dev/usb/usbdevices.config
diff -u src/sys/dev/usb/usbdevices.config:1.42 src/sys/dev/usb/usbdevices.config:1.43

CVS commit: src/sys/dev/usb

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:38:02 UTC 2024

Modified Files:
src/sys/dev/usb: uftdi.c usbdevices.config

Log Message:
Add a "match quirk" mechanism to the uftdi driver that allows it to
selectively reject individual interfaces based on the combination of
- Vendor ID
- Product ID
- Interface number
- Vendor string
- Product string

This is necessary[*] to allow some devices that would otherwise match
uftdi (and thus instantiate a ucom) to be matched by ugenif instead,
which is required to make the device available to libusb1.

[*] ...due to a deficiency in the USB stack that does not provide a
mechanism for a user-space driver to claim a device from a kernel driver
and then return it back at a later time.

Use this new match quirk mechanism to reject "interface 1" of the
FTDI 2232C-based Tigard debug board; On this board, "interface 0"
is brought out to regular TTL-level UART pins, but "interface 1" is
brought out to SWD and JTAG headers, and is really only useful when
used with something like openocd.  Because the FTDI 2232C on this board
just uses the standard FTDI vendor and product IDs, it can only be
distinguished by the strings, which cannot be specified usbdevices.config,
thus necessitating the match quirk entry (that works in combination
with the ugenif entry added in usbdevices.config).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config

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



CVS commit: src

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:24:14 UTC 2024

Modified Files:
src/share/man/man4: ugen.4
src/sys/dev/usb: ugen.c

Log Message:
Define a "flags 1" config directive for ugenif, which is similar to ugen's,
but rather forces the ugenif to match at the *lowest* match priority rather
than the highest.  This allows ugenif to claim only otherwise unclaimed
interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man4/ugen.4
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/share/man/man4/ugen.4
diff -u src/share/man/man4/ugen.4:1.38 src/share/man/man4/ugen.4:1.39
--- src/share/man/man4/ugen.4:1.38	Fri Aug 28 16:07:49 2020
+++ src/share/man/man4/ugen.4	Tue Mar 26 03:24:14 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: ugen.4,v 1.38 2020/08/28 16:07:49 fcambus Exp $
+.\" $NetBSD: ugen.4,v 1.39 2024/03/26 03:24:14 thorpej Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 14, 2019
+.Dd March 25, 2024
 .Dt UGEN 4
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Cd "ugen* at uhub? flags N"
 .Cd "ugen* at uhub? vendor V product P flags 1"
 .Cd "ugenif* at uhub? vendor V product P configuration C interface I"
+.Cd "ugenif* at uhub? vendor V product P configuration C interface I flags 1"
 .Sh DESCRIPTION
 The
 .Nm
@@ -62,7 +63,9 @@ locators this can be used to force the
 driver to be used for a certain
 device.
 .Pp
-The second form of attachment can be used to
+The
+.Sq ugenif
+form of attachment can be used to
 .Dq steal
 only one interface from some device for use by the
 .Nm
@@ -74,6 +77,12 @@ as otherwise the
 driver would capture all of your
 .Nm usb
 devices.
+If
+.Dq flags 1
+is specified, the
+.Sq ugenif
+form will match at the lowest priority, thus allowing it to match only
+otherwise unclaimed interfaces.
 .Em NOTE :
 You have to be extremely careful,
 when using this form,

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.175 src/sys/dev/usb/ugen.c:1.176
--- src/sys/dev/usb/ugen.c:1.175	Mon Nov  6 12:16:52 2023
+++ src/sys/dev/usb/ugen.c	Tue Mar 26 03:24:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $	*/
+/*	$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -367,8 +367,12 @@ ugen_match(device_t parent, cfdata_t mat
 static int
 ugenif_match(device_t parent, cfdata_t match, void *aux)
 {
-	/* Assume that they knew what they configured! (see ugenif(4)) */
-	return UMATCH_HIGHEST;
+	/*
+	 * Like ugen(4), ugenif(4) also has an override flag.  It has the
+	 * opposite effect, however, causing us to match with GENERIC
+	 * priority rather than HIGHEST.
+	 */
+	return (match->cf_flags & 1) ? UMATCH_GENERIC : UMATCH_HIGHEST;
 }
 
 static void



CVS commit: src

2024-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 26 03:24:14 UTC 2024

Modified Files:
src/share/man/man4: ugen.4
src/sys/dev/usb: ugen.c

Log Message:
Define a "flags 1" config directive for ugenif, which is similar to ugen's,
but rather forces the ugenif to match at the *lowest* match priority rather
than the highest.  This allows ugenif to claim only otherwise unclaimed
interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/share/man/man4/ugen.4
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/ugen.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-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

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. Redi

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/dev/ic

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

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.h

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

Modified files:

Index: src/sys/dev/ic/mc146818.c
diff -u src/sys/dev/ic/mc146818.c:1.20 src/sys/dev/ic/mc146818.c:1.21
--- src/sys/dev/ic/mc146818.c:1.20	Wed Jan  1 19:24:03 2020
+++ src/sys/dev/ic/mc146818.c	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $	*/
+/*	$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.20 2020/01/01 19:24:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mc146818.c,v 1.21 2024/03/06 02:31:44 thorpej Exp $");
 
 #include 
 #include 
@@ -43,9 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: mc146818.c,v
 #include 
 #include 
 
-int mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-int mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
-
 void
 mc146818_attach(struct mc146818_softc *sc)
 {
@@ -61,11 +58,14 @@ mc146818_attach(struct mc146818_softc *s
 
 	handle = >sc_handle;
 	handle->cookie = sc;
-	handle->todr_gettime = NULL;
-	handle->todr_settime = NULL;
-	handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
-	handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
-	handle->todr_setwen  = NULL;
+	KASSERT(handle->todr_gettime == NULL);
+	KASSERT(handle->todr_settime == NULL);
+	if (handle->todr_gettime_ymdhms == NULL) {
+		handle->todr_gettime_ymdhms = mc146818_gettime_ymdhms;
+	}
+	if (handle->todr_settime_ymdhms == NULL) {
+		handle->todr_settime_ymdhms = mc146818_settime_ymdhms;
+	}
 
 	todr_attach(handle);
 }
@@ -103,7 +103,7 @@ mc146818_gettime_ymdhms(todr_chip_handle
 	dt->dt_wday = FROMREG((*sc->sc_mcread)(sc, MC_DOW));
 	dt->dt_day  = FROMREG((*sc->sc_mcread)(sc, MC_DOM));
 	dt->dt_mon  = FROMREG((*sc->sc_mcread)(sc, MC_MONTH));
-	year   = FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
+	year= FROMREG((*sc->sc_mcread)(sc, MC_YEAR));
 	if (sc->sc_getcent) {
 		cent = (*sc->sc_getcent)(sc);
 		year += cent * 100;

Index: src/sys/dev/ic/mc146818var.h
diff -u src/sys/dev/ic/mc146818var.h:1.7 src/sys/dev/ic/mc146818var.h:1.8
--- src/sys/dev/ic/mc146818var.h:1.7	Wed May 14 13:29:29 2008
+++ src/sys/dev/ic/mc146818var.h	Wed Mar  6 02:31:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mc146818var.h,v 1.7 2008/05/14 13:29:29 tsutsui Exp $	*/
+/*	$NetBSD: mc146818var.h,v 1.8 2024/03/06 02:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 Izumi Tsutsui.  All rights reserved.
@@ -24,6 +24,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef _DEV_IC_MC146818VAR_H_
+#define	_DEV_IC_MC146818VAR_H_
+
 struct mc146818_softc {
 	device_t sc_dev;
 
@@ -45,4 +48,8 @@ struct mc146818_softc {
 	void (*sc_setcent)(struct mc146818_softc *, u_int);
 };
 
-void mc146818_attach(struct mc146818_softc *);
+void	mc146818_attach(struct mc146818_softc *);
+int	mc146818_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+int	mc146818_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+
+#endif /* _DEV_IC_MC146818VAR_H_ */



CVS commit: src/sys/dev/ic

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

Modified Files:
src/sys/dev/ic: mc146818.c mc146818var.h

Log Message:
Expose mc146818_{get,set}time_ymdhms() and allow a front-end to override
these function pointers in the TODR handle, allowing the front-end to
wrap mc146818_{get,set}time_ymdhms() with special handling, if needed.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mc146818.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/mc146818var.h

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



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 20:59:41 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Revert previous until I can diagnose a failure reported by gson.


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/kern/init_main.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.53 -r1.54 src/sys/sys/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

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 20:59:41 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Revert previous until I can diagnose a failure reported by gson.


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/kern/init_main.c
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.53 -r1.54 src/sys/sys/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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.548 src/sys/kern/init_main.c:1.549
--- src/sys/kern/init_main.c:1.548	Tue Mar  5 14:39:29 2024
+++ src/sys/kern/init_main.c	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: init_main.c,v 1.549 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2023 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.549 2024/03/05 20:59:41 thorpej Exp $");
 
 #include "opt_cnmagic.h"
 #include "opt_ddb.h"
@@ -275,8 +275,7 @@ main(void)
 #ifdef DIAGNOSTIC
 	/*
 	 * Verify that CPU_INFO_FOREACH() knows about the boot CPU
-	 * and only the boot CPU at this point.  The boot CPU should
-	 * also be marked PRIMARY.
+	 * and only the boot CPU at this point.
 	 */
 	int cpucount = 0;
 	for (CPU_INFO_FOREACH(cii, ci)) {
@@ -284,12 +283,8 @@ main(void)
 		cpucount++;
 	}
 	KASSERT(cpucount == 1);
-	KASSERT(CPU_IS_PRIMARY(curcpu()));
 #endif
 
-	/* Stash a pointer to the boot CPU for quick reference wheen needed. */
-	boot_cpu = curcpu();
-
 	l = 
 #ifndef LWP0_CPU_INFO
 	l->l_cpu = curcpu();

Index: src/sys/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.21 src/sys/kern/subr_cpu.c:1.22
--- src/sys/kern/subr_cpu.c:1.21	Tue Mar  5 14:39:29 2024
+++ src/sys/kern/subr_cpu.c	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.22 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.22 2024/03/05 20:59:41 thorpej Exp $");
 
 #include 
 #include 
@@ -86,9 +86,6 @@ int64_t		cpu_counts[CPU_COUNT_MAX];
 /* An array of CPUs.  There are ncpu entries. */
 struct cpu_info **cpu_infos		__read_mostly;
 
-/* A pointer to the boot CPU, for quick reference when needed. */
-struct cpu_info *boot_cpu		__read_mostly;
-
 /* Note: set on mi_cpu_attach() and idle_loop(). */
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.53 src/sys/sys/cpu.h:1.54
--- src/sys/sys/cpu.h:1.53	Tue Mar  5 14:39:29 2024
+++ src/sys/sys/cpu.h	Tue Mar  5 20:59:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.53 2024/03/05 14:39:29 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.54 2024/03/05 20:59:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -100,7 +100,6 @@ void	cpu_topology_init(void);
 extern kmutex_t cpu_lock;
 extern u_int maxcpus;
 extern struct cpu_info **cpu_infos;
-extern struct cpu_info *boot_cpu;
 extern kcpuset_t *kcpuset_attached;
 extern kcpuset_t *kcpuset_running;
 



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:39:30 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Early in main(), assert that curcpu() evaluates as the primary CPU and
stash away a pointer to it as the boot CPU for quick reference later.


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 src/sys/kern/init_main.c
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.547 src/sys/kern/init_main.c:1.548
--- src/sys/kern/init_main.c:1.547	Wed Jan 17 10:18:41 2024
+++ src/sys/kern/init_main.c	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.547 2024/01/17 10:18:41 hannken Exp $	*/
+/*	$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019, 2023 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.547 2024/01/17 10:18:41 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.548 2024/03/05 14:39:29 thorpej Exp $");
 
 #include "opt_cnmagic.h"
 #include "opt_ddb.h"
@@ -275,7 +275,8 @@ main(void)
 #ifdef DIAGNOSTIC
 	/*
 	 * Verify that CPU_INFO_FOREACH() knows about the boot CPU
-	 * and only the boot CPU at this point.
+	 * and only the boot CPU at this point.  The boot CPU should
+	 * also be marked PRIMARY.
 	 */
 	int cpucount = 0;
 	for (CPU_INFO_FOREACH(cii, ci)) {
@@ -283,8 +284,12 @@ main(void)
 		cpucount++;
 	}
 	KASSERT(cpucount == 1);
+	KASSERT(CPU_IS_PRIMARY(curcpu()));
 #endif
 
+	/* Stash a pointer to the boot CPU for quick reference wheen needed. */
+	boot_cpu = curcpu();
+
 	l = 
 #ifndef LWP0_CPU_INFO
 	l->l_cpu = curcpu();

Index: src/sys/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.20 src/sys/kern/subr_cpu.c:1.21
--- src/sys/kern/subr_cpu.c:1.20	Thu Jan  4 11:18:19 2024
+++ src/sys/kern/subr_cpu.c	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.21 2024/03/05 14:39:29 thorpej Exp $");
 
 #include 
 #include 
@@ -86,6 +86,9 @@ int64_t		cpu_counts[CPU_COUNT_MAX];
 /* An array of CPUs.  There are ncpu entries. */
 struct cpu_info **cpu_infos		__read_mostly;
 
+/* A pointer to the boot CPU, for quick reference when needed. */
+struct cpu_info *boot_cpu		__read_mostly;
+
 /* Note: set on mi_cpu_attach() and idle_loop(). */
 kcpuset_t *	kcpuset_attached	__read_mostly	= NULL;
 kcpuset_t *	kcpuset_running		__read_mostly	= NULL;

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.52 src/sys/sys/cpu.h:1.53
--- src/sys/sys/cpu.h:1.52	Sat Jul  8 13:59:05 2023
+++ src/sys/sys/cpu.h	Tue Mar  5 14:39:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.52 2023/07/08 13:59:05 riastradh Exp $	*/
+/*	$NetBSD: cpu.h,v 1.53 2024/03/05 14:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -100,6 +100,7 @@ void	cpu_topology_init(void);
 extern kmutex_t cpu_lock;
 extern u_int maxcpus;
 extern struct cpu_info **cpu_infos;
+extern struct cpu_info *boot_cpu;
 extern kcpuset_t *kcpuset_attached;
 extern kcpuset_t *kcpuset_running;
 



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:39:30 UTC 2024

Modified Files:
src/sys/kern: init_main.c subr_cpu.c
src/sys/sys: cpu.h

Log Message:
Early in main(), assert that curcpu() evaluates as the primary CPU and
stash away a pointer to it as the boot CPU for quick reference later.


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 src/sys/kern/init_main.c
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_cpu.c
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/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/uvm

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:33:50 UTC 2024

Modified Files:
src/sys/uvm: uvm_page.c

Log Message:
Rename the local "boot_cpu" variable to "uvm_boot_cpu".


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.c

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



CVS commit: src/sys/uvm

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:33:50 UTC 2024

Modified Files:
src/sys/uvm: uvm_page.c

Log Message:
Rename the local "boot_cpu" variable to "uvm_boot_cpu".


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.255 src/sys/uvm/uvm_page.c:1.256
--- src/sys/uvm/uvm_page.c:1.255	Sat Feb 10 09:24:18 2024
+++ src/sys/uvm/uvm_page.c	Tue Mar  5 14:33:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -328,7 +328,7 @@ uvm_page_init_bucket(struct pgfreelist *
 void
 uvm_page_init(vaddr_t *kvm_startp, vaddr_t *kvm_endp)
 {
-	static struct uvm_cpu boot_cpu __cacheline_aligned;
+	static struct uvm_cpu uvm_boot_cpu __cacheline_aligned;
 	psize_t freepages, pagecount, bucketsize, n;
 	struct pgflbucket *pgb;
 	struct vm_page *pagearray;
@@ -344,7 +344,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
 	 * structures).
 	 */
 
-	curcpu()->ci_data.cpu_uvm = _cpu;
+	curcpu()->ci_data.cpu_uvm = _boot_cpu;
 	uvmpdpol_init();
 	for (b = 0; b < __arraycount(uvm_freelist_locks); b++) {
 		mutex_init(_freelist_locks[b].lock, MUTEX_DEFAULT, IPL_VM);



CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:15:36 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_reboot.c
src/sys/arch/algor/algor: machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/amiga/amiga: machdep.c
src/sys/arch/amigappc/amigappc: machdep.c
src/sys/arch/amigappc/include: autoconf.h
src/sys/arch/arc/arc: machdep.c
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/atari/atari: machdep.c
src/sys/arch/bebox/bebox: machdep.c
src/sys/arch/cesfic/cesfic: machdep.c
src/sys/arch/cobalt/cobalt: machdep.c
src/sys/arch/dreamcast/dreamcast: machdep.c
src/sys/arch/emips/emips: machdep.c
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbmips/adm5120: machdep.c
src/sys/arch/evbmips/alchemy: machdep.c
src/sys/arch/evbmips/atheros: machdep.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/ingenic: machdep.c
src/sys/arch/evbmips/loongson: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/evbmips/mipssim: machdep.c
src/sys/arch/evbmips/rasoc: machdep.c
src/sys/arch/evbmips/rmixl: machdep.c
src/sys/arch/evbmips/sbmips: machdep.c
src/sys/arch/evbppc/ev64260: machdep.c
src/sys/arch/evbppc/pmppc: machdep.c
src/sys/arch/evbppc/wii: machdep.c
src/sys/arch/ews4800mips/ews4800mips: machdep.c
src/sys/arch/hp300/hp300: machdep.c
src/sys/arch/hpcmips/hpcmips: machdep.c
src/sys/arch/hpcsh/hpcsh: machdep.c
src/sys/arch/hppa/hppa: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/landisk/landisk: machdep.c
src/sys/arch/luna68k/luna68k: machdep.c
src/sys/arch/macppc/macppc: machdep.c
src/sys/arch/mipsco/mipsco: machdep.c
src/sys/arch/mvme68k/mvme68k: machdep.c
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/news68k/news68k: machdep.c
src/sys/arch/newsmips/newsmips: machdep.c
src/sys/arch/next68k/next68k: machdep.c
src/sys/arch/ofppc/include: autoconf.h
src/sys/arch/ofppc/ofppc: machdep.c
src/sys/arch/playstation2/playstation2: machdep.c
src/sys/arch/pmax/pmax: machdep.c
src/sys/arch/powerpc/booke: booke_machdep.c
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c
src/sys/arch/prep/prep: machdep.c
src/sys/arch/riscv/riscv: riscv_machdep.c
src/sys/arch/rs6000/include: autoconf.h
src/sys/arch/sandpoint/sandpoint: machdep.c
src/sys/arch/sbmips/sbmips: machdep.c
src/sys/arch/sgimips/sgimips: machdep.c
src/sys/arch/sparc/sparc: machdep.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/arch/vax/vax: machdep.c
src/sys/arch/virt68k/virt68k: machdep.c
src/sys/arch/zaurus/zaurus: machdep.c
src/sys/kern: kern_reboot.c

Log Message:
Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/aarch64_reboot.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/algor/algor/machdep.c
cvs rdiff -u -r1.377 -r1.378 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.367 -r1.368 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.254 -r1.255 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amigappc/amigappc/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amigappc/include/autoconf.h
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/bebox/bebox/machdep.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/cesfic/cesfic/machdep.c
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dreamcast/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/emips/emips/machdep.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbmips/atheros/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/loongson/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/mipssim/machdep.c
cvs 

CVS commit: src/sys

2024-03-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar  5 14:15:36 UTC 2024

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_reboot.c
src/sys/arch/algor/algor: machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/amiga/amiga: machdep.c
src/sys/arch/amigappc/amigappc: machdep.c
src/sys/arch/amigappc/include: autoconf.h
src/sys/arch/arc/arc: machdep.c
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/atari/atari: machdep.c
src/sys/arch/bebox/bebox: machdep.c
src/sys/arch/cesfic/cesfic: machdep.c
src/sys/arch/cobalt/cobalt: machdep.c
src/sys/arch/dreamcast/dreamcast: machdep.c
src/sys/arch/emips/emips: machdep.c
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbmips/adm5120: machdep.c
src/sys/arch/evbmips/alchemy: machdep.c
src/sys/arch/evbmips/atheros: machdep.c
src/sys/arch/evbmips/cavium: machdep.c
src/sys/arch/evbmips/gdium: machdep.c
src/sys/arch/evbmips/ingenic: machdep.c
src/sys/arch/evbmips/loongson: machdep.c
src/sys/arch/evbmips/malta: machdep.c
src/sys/arch/evbmips/mipssim: machdep.c
src/sys/arch/evbmips/rasoc: machdep.c
src/sys/arch/evbmips/rmixl: machdep.c
src/sys/arch/evbmips/sbmips: machdep.c
src/sys/arch/evbppc/ev64260: machdep.c
src/sys/arch/evbppc/pmppc: machdep.c
src/sys/arch/evbppc/wii: machdep.c
src/sys/arch/ews4800mips/ews4800mips: machdep.c
src/sys/arch/hp300/hp300: machdep.c
src/sys/arch/hpcmips/hpcmips: machdep.c
src/sys/arch/hpcsh/hpcsh: machdep.c
src/sys/arch/hppa/hppa: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/landisk/landisk: machdep.c
src/sys/arch/luna68k/luna68k: machdep.c
src/sys/arch/macppc/macppc: machdep.c
src/sys/arch/mipsco/mipsco: machdep.c
src/sys/arch/mvme68k/mvme68k: machdep.c
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/news68k/news68k: machdep.c
src/sys/arch/newsmips/newsmips: machdep.c
src/sys/arch/next68k/next68k: machdep.c
src/sys/arch/ofppc/include: autoconf.h
src/sys/arch/ofppc/ofppc: machdep.c
src/sys/arch/playstation2/playstation2: machdep.c
src/sys/arch/pmax/pmax: machdep.c
src/sys/arch/powerpc/booke: booke_machdep.c
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c
src/sys/arch/prep/prep: machdep.c
src/sys/arch/riscv/riscv: riscv_machdep.c
src/sys/arch/rs6000/include: autoconf.h
src/sys/arch/sandpoint/sandpoint: machdep.c
src/sys/arch/sbmips/sbmips: machdep.c
src/sys/arch/sgimips/sgimips: machdep.c
src/sys/arch/sparc/sparc: machdep.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/arch/vax/vax: machdep.c
src/sys/arch/virt68k/virt68k: machdep.c
src/sys/arch/zaurus/zaurus: machdep.c
src/sys/kern: kern_reboot.c

Log Message:
Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/aarch64_reboot.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/algor/algor/machdep.c
cvs rdiff -u -r1.377 -r1.378 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.367 -r1.368 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.254 -r1.255 src/sys/arch/amiga/amiga/machdep.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amigappc/amigappc/machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amigappc/include/autoconf.h
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arc/arc/machdep.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/bebox/bebox/machdep.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/cesfic/cesfic/machdep.c
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dreamcast/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/emips/emips/machdep.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbmips/alchemy/machdep.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbmips/atheros/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/cavium/machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbmips/gdium/machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/loongson/machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbmips/malta/machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/mipssim/machdep.c
cvs 

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
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: files.alpha,v 1.196 2024/03/02 20:15:33 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -19,6 +19,7 @@ defflag		DEC_AXPPCI_33	# NoName:	AXPpci3
 defflag		DEC_EB164	# EB164:	AlphaPC 164
 defflag		DEC_EB64PLUS	# EB64+:	AlphaPC 64, etc.
 defflag		DEC_KN20AA	# KN20AA:	AlphaStation 500 and 600
+defflag		DEC_KN7AA	# KN7AA:	DEC 7000 and 1
 defflag		DEC_KN8AE	# KN8AE:	AlphaServer 8200 and 8400
 defflag		DEC_KN300	# KN300:	AlphaServer 4X00
 defflag		DEC_1000	# Mikasa etc:	AlphaServer 1000
@@ -416,6 +417,7 @@ file	arch/alpha/alpha/dec_eb164.c		dec_e
 file	arch/alpha/alpha/dec_eb64plus.c		dec_eb64plus
 file	arch/alpha/alpha/dec_eb66.c		dec_eb66
 file	arch/alpha/alpha/dec_kn20aa.c		dec_kn20aa
+file	arch/alpha/alpha/dec_kn7aa.c		dec_kn7aa
 file	arch/alpha/alpha/dec_kn8ae.c		dec_kn8ae
 file	arch/alpha/alpha/dec_kn300.c		dec_kn300
 file	arch/alpha/alpha/api_up1000.c		api_up1000

Index: src/sys/arch/alpha/include/prom.h
diff -u src/sys/arch/alpha/include/prom.h:1.16 src/sys/arch/alpha/include/prom.h:1.17
--- src/sys/arch/alpha/include/prom.h:1.16	Sat Oct  3 17:31:46 2020
+++ src/sys/arch/alpha/include/prom.h	Sat Mar  2 20:15:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.h,v 1.16 2020/10/03 17:31:46 thorpej Exp $ */
+/* $NetBSD: prom.h,v 1.17 2024/03/02 20:15:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -121,10 +121,11 @@ void	hwrpb_restart_setup(void);
 #ifdef _KERNEL
 
 #ifdef _KERNEL_OPT
+#include "opt_dec_kn7aa.h"
 #include "opt_dec_kn8ae.h"
 
-#if defined(DEC_KN8AE)
-#define _PROM_MAY_USE_PROM_CONSOLE
+#if defined(DEC_KN7AA) || defined(DEC_KN8AE)
+#define _PROM_MAY_USE_PROM_CONSOLE	/* XXX */
 #endif /* DEC_KN8AE */
 #endif /* _KERNEL_OPT */
 

Added files:

Index: src/sys/arch/alpha/alpha/dec_kn7aa.c
diff -u /dev/null src/sys/arch/alpha/alpha/dec_kn7aa.c:1.1
--- /dev/null	Sat Mar  2 20:15:33 2024
+++ src/sys/arch/alpha/alpha/dec_kn7aa.c	Sat Mar  2 20:15:33 2024
@@ -0,0 +1,84 @@
+/* $NetBSD: dec_kn7aa.c,v 1.1 2024/03/02 20:15:33 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.
+ */
+
+#include 			/* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: dec_kn7aa.c,v 1.1 2024/03/02 20:15:33 thorpej Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+void		dec_kn7aa_init(void);
+void		dec_kn7aa_cons_init(void);
+static void	dec_kn7aa_device_register(device_t, void *);
+
+const struct alpha_variation_table dec_kn7aa_variations[] = {
+	{ 0, "DEC 7000" },
+	{ 1, "DEC 1" },
+	{ 0, NULL },
+};
+
+void
+dec_kn7aa_init(void)
+{
+	uint64_t variation;
+
+	platform.family = "KN7AA (\"Ruby\")";
+
+	if ((platform.model = alpha_dsr_sysname()) == NULL) {
+		variation = hwrpb->rpb_variation & SV_ST_MASK;
+		if ((platform.model = alpha_variation_name(variation,
+		dec_kn7aa_variations)) == NULL)
+			platform.model = alpha_unknown_sysname();
+	}
+
+	platform.iobus = "lsb";
+	platform.cons_init = dec_kn7aa_cons_init;
+	platform.device_register = dec_kn7aa_device_register;
+}
+
+void
+dec_kn7aa_cons_init(void)
+{
+}
+
+static void
+dec_kn7aa_device_register(device_t dev, void *aux)
+{
+}



CVS commit: src/sys/arch/alpha

2024-03-02 Thread Jason R Thorpe
 OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Autoconfiguration and support routines for the Gbus: the internal
+ * bus on AlphaServer CPU modules.
+ */
+
+#include 			/* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.1 2024/03/02 19:57:57 thorpej Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "locators.h"
+
+#define KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
+
+struct gbus_softc {
+	device_t	sc_dev;
+	int		sc_tlsbnode;	/* node on the TurboLaser */
+};
+
+static int	gbusmatch(device_t, cfdata_t, void *);
+static void	gbusattach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(gbus, sizeof(struct gbus_softc),
+gbusmatch, gbusattach, NULL, NULL);
+
+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 },
+};
+
+static int
+gbusprint(void *aux, const char *pnp)
+{
+	struct gbus_attach_args *ga = aux;
+
+	if (pnp)
+		aprint_normal("%s at %s", ga->ga_name, pnp);
+	aprint_normal(" offset 0x%lx", ga->ga_offset);
+	return (UNCONF);
+}
+
+static int
+gbusmatch(device_t parent, cfdata_t cf, void *aux)
+{
+	struct tlsb_dev_attach_args *ta = aux;
+
+	/*
+	 * Make sure we're looking for a Gbus.  The Gbus only
+	 * "exists" on the CPU module that holds the primary CPU.
+	 *
+	 * Compute which node this should exist on by dividing the
+	 * primary CPU by 2 (since there are up to 2 CPUs per CPU
+	 * module).
+	 */
+	if (TLDEV_ISCPU(ta->ta_dtype) &&
+	ta->ta_node == (hwrpb->rpb_primary_cpu_id / 2))
+		return (1);
+
+	return (0);
+}
+
+static void
+gbusattach(device_t parent, device_t self, void *aux)
+{
+	struct gbus_softc *sc = device_private(self);
+	struct tlsb_dev_attach_args *ta = aux;
+	const struct gbus_attach_args *ga;
+	int locs[GBUSCF_NLOCS];
+
+	aprint_normal("\n");
+
+	sc->sc_dev = self;
+	sc->sc_tlsbnode = ta->ta_node;
+
+	/* Attach the children. */
+	for (ga = gbus_children; ga->ga_name != NULL; ga++) {
+		struct gbus_attach_args gaa = *ga;
+		locs[GBUSCF_OFFSET] = gaa.ga_offset;
+		config_found(self, , gbusprint,
+		CFARGS(.submatch = config_stdsubmatch,
+			   .locators = locs));
+	}
+}
Index: src/sys/arch/alpha/gbus/gbusreg.h
diff -u /dev/null src/sys/arch/alpha/gbus/gbusreg.h:1.1
--- /dev/null	Sat Mar  2 19:57:58 2024
+++ src/sys/arch/alpha/gbus/gbusreg.h	Sat Mar  2 19:57:57 2024
@@ -0,0 +1,39 @@
+/* $NetBSD: gbusreg.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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.
+ */
+
+/*
+ * Register definitions for the Gbus found on TurboLaser CPU modules.
+ */
+
+#define GBUS_DUART0_OFFSET	0x1000		/* duart 0 */
+#define GBUS_DUART1_OFFSET	0x1100		/* duart 1 */
+#define GBUS_CLOCK_OFFSET	0x2000		/* clock */
Index: src/sys/arch/alpha/gbus/gbusvar.h
diff -u /dev/null src/sys/arch/alpha/gbus/gbusvar.h:1.1
--- /dev/null	Sat Mar  2 19:57:58 2024
+++ src/sys/arch/alpha/gbus/gbusvar.h	Sat Mar  2 19:57:57 2024
@@ -0,0 +1,42 @@
+/* $NetBSD: gbusvar.h,v 1.1 2024/03/02 19:57:57 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc

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/evbcf/include

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:07:08 UTC 2024

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

Log Message:
Revert the CLOCK_FORMAT0 work-around.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbcf/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/evbcf/include/cpu.h
diff -u src/sys/arch/evbcf/include/cpu.h:1.10 src/sys/arch/evbcf/include/cpu.h:1.11
--- src/sys/arch/evbcf/include/cpu.h:1.10	Tue Feb 27 16:07:02 2024
+++ src/sys/arch/evbcf/include/cpu.h	Wed Feb 28 13:07:07 2024
@@ -1,7 +1,3 @@
-/*	$NetBSD: cpu.h,v 1.10 2024/02/27 16:07:02 nat Exp $	*/
-
-#ifndef CLOCK_FORMAT0
-#define CLOCK_FORMAT0
-#endif
+/*	$NetBSD: cpu.h,v 1.11 2024/02/28 13:07:07 thorpej Exp $	*/
 
 #include 



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

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:07:08 UTC 2024

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

Log Message:
Revert the CLOCK_FORMAT0 work-around.


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

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:05:40 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/dev: adb_direct.c
src/sys/arch/mac68k/include: cpu.h intr.h
src/sys/arch/mac68k/mac68k: intr.c locore.s via.c

Log Message:
Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around.  As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mac68k/dev/adb_direct.c
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/include/intr.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/mac68k/mac68k/via.c

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

Modified files:

Index: src/sys/arch/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.24 src/sys/arch/m68k/include/cpu.h:1.25
--- src/sys/arch/m68k/include/cpu.h:1.24	Tue Feb 27 16:07:02 2024
+++ src/sys/arch/m68k/include/cpu.h	Wed Feb 28 13:05:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.24 2024/02/27 16:07:02 nat Exp $	*/
+/*	$NetBSD: cpu.h,v 1.25 2024/02/28 13:05:39 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -149,10 +149,8 @@ void	cpu_proc_fork(struct proc *, struct
  * what the interrupt stub puts on the stack before calling C code.
  */
 struct clockframe {
-#ifndef CLOCK_FORMAT0
 	/* regs saved on the stack by the interrupt stub */
 	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
-#endif
 	/* hardware frame */
 	u_short	cf_sr;		/* sr at time of interrupt */
 	u_long	cf_pc;		/* pc at time of interrupt */

Index: src/sys/arch/mac68k/dev/adb_direct.c
diff -u src/sys/arch/mac68k/dev/adb_direct.c:1.70 src/sys/arch/mac68k/dev/adb_direct.c:1.71
--- src/sys/arch/mac68k/dev/adb_direct.c:1.70	Fri Feb  9 18:20:00 2024
+++ src/sys/arch/mac68k/dev/adb_direct.c	Wed Feb 28 13:05:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_direct.c,v 1.70 2024/02/09 18:20:00 andvar Exp $	*/
+/*	$NetBSD: adb_direct.c,v 1.71 2024/02/28 13:05:39 thorpej Exp $	*/
 
 /* From: adb_direct.c 2.02 4/18/97 jpw */
 
@@ -62,7 +62,7 @@
 #ifdef __NetBSD__
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.70 2024/02/09 18:20:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.71 2024/02/28 13:05:39 thorpej Exp $");
 
 #include "opt_adb.h"
 
@@ -78,6 +78,8 @@ __KERNEL_RCSID(0, "$NetBSD: adb_direct.c
 #include 			/* required for adbvar.h */
 #include 			/* required for IOP support */
 
+#include 
+
 #include 
 #include 
 #define printf_intr printf
@@ -353,6 +355,17 @@ print_single(u_char *str)
 }
 #endif
 
+static inline void
+adb_process_serial_intrs(void)
+{
+	/* grab any serial interrupts (autovector IPL 4) */
+	struct clockframe dummy_frame = {
+		.cf_sr = PSL_S,
+		.cf_vo = VECI_TO_VECO(VECI_INTRAV4),
+	};
+	(void)intr_dispatch(dummy_frame);
+}
+
 void
 adb_cuda_tickle(void)
 {
@@ -720,7 +733,7 @@ adb_intr_II(void *arg)
 
 	delay(ADB_DELAY);	/* yuck (don't remove) */
 
-	(void)intr_dispatch(0x70); /* grab any serial interrupts */
+	adb_process_serial_intrs();
 
 	if (ADB_INTR_IS_ON)
 		intr_on = 1;	/* save for later */
@@ -768,7 +781,7 @@ switch_start:
 			adbActionState = ADB_ACTION_IN;
 		}
 		delay(ADB_DELAY);
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 		goto switch_start;
 		break;
 	case ADB_ACTION_IDLE:
@@ -1262,7 +1275,7 @@ switch_start:
 		ADB_SET_STATE_ACKON();	/* start ACK to ADB chip */
 		delay(ADB_DELAY);	/* delay */
 		ADB_SET_STATE_ACKOFF();	/* end ACK to ADB chip */
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 		break;
 
 	case ADB_ACTION_IN:
@@ -1276,7 +1289,7 @@ switch_start:
 		ADB_SET_STATE_ACKON();	/* start ACK to ADB chip */
 		delay(ADB_DELAY);	/* delay */
 		ADB_SET_STATE_ACKOFF();	/* end ACK to ADB chip */
-		(void)intr_dispatch(0x70); /* grab any serial interrupts */
+		adb_process_serial_intrs();
 
 		if (1 == ending) {	/* end of message? */
 			ADB_SET_STATE_INACTIVE();	/* signal end of frame */
@@ -1323,7 +1336,7 @@ switch_start:
 adbActionState = ADB_ACTION_OUT;	/* set next state */
 
 delay(ADB_DELAY);	/* delay */
-(void)intr_dispatch(0x70); /* grab any serial interrupts */
+adb_process_serial_intrs();
 
 if (ADB_INTR_IS_ON) {	/* ADB intr low during
 			 * write */
@@ -1364,13 +1377,13 @@ switch_start:
 			adbWriteDelay = 1;	/* must retry when done with
 		 * read */
 			delay(ADB_DELAY);	/* delay */
-			(void)intr_dispatch(0x70); /* grab any serial interrupts */
+			adb_process_serial_intrs();

CVS commit: src/sys/arch

2024-02-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Feb 28 13:05:40 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h
src/sys/arch/mac68k/dev: adb_direct.c
src/sys/arch/mac68k/include: cpu.h intr.h
src/sys/arch/mac68k/mac68k: intr.c locore.s via.c

Log Message:
Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around.  As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mac68k/dev/adb_direct.c
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mac68k/include/intr.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/mac68k/mac68k/locore.s
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/mac68k/mac68k/via.c

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



CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spivar.h

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

Modified files:

Index: src/sys/dev/spi/spivar.h
diff -u src/sys/dev/spi/spivar.h:1.12 src/sys/dev/spi/spivar.h:1.13
--- src/sys/dev/spi/spivar.h:1.12	Wed Jan 19 13:33:11 2022
+++ src/sys/dev/spi/spivar.h	Fri Feb 23 23:45:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: spivar.h,v 1.12 2022/01/19 13:33:11 thorpej Exp $ */
+/* $NetBSD: spivar.h,v 1.13 2024/02/23 23:45:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -55,16 +55,24 @@
 struct spi_handle;
 struct spi_transfer;
 
+#define	SPI_MODE_CPHA	__BIT(0)
+#define	SPI_MODE_CPOL	__BIT(1)
+
 /*
  * De facto standard latching modes.
  */
-#define	SPI_MODE_0	0	/* CPOL = 0, CPHA = 0 */
-#define	SPI_MODE_1	1	/* CPOL = 0, CPHA = 1 */
-#define	SPI_MODE_2	2	/* CPOL = 1, CPHA = 0 */
-#define	SPI_MODE_3	3	/* CPOL = 1, CPHA = 1 */
+#define	SPI_MODE_0	0
+#define	SPI_MODE_1	SPI_MODE_CPHA
+#define	SPI_MODE_2	SPI_MODE_CPOL
+#define	SPI_MODE_3	(SPI_MODE_CPHA | SPI_MODE_CPOL)
+
 /* Philips' Microwire is just Mode 0 */
 #define	SPI_MODE_MICROWIRE	SPI_MODE_0
 
+/* SPI transfer speed helper macros -- converts to Hz for spi_configure(). */
+#define	SPI_FREQ_kHz(x)	((x) * 1000)
+#define	SPI_FREQ_MHz(x)	((x) * 100)
+
 struct spi_controller {
 	void	*sct_cookie;	/* controller private data */
 	int	sct_nslaves;



CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spivar.h

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



CVS commit: src/sys/dev/sun

2024-02-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 13:46:14 UTC 2024

Modified Files:
src/sys/dev/sun: sireg.h

Log Message:
Add the Sun3 obio flavor's DMA controller access registers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sun/sireg.h

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



CVS commit: src/sys/dev/sun

2024-02-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 13:46:14 UTC 2024

Modified Files:
src/sys/dev/sun: sireg.h

Log Message:
Add the Sun3 obio flavor's DMA controller access registers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sun/sireg.h

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

Modified files:

Index: src/sys/dev/sun/sireg.h
diff -u src/sys/dev/sun/sireg.h:1.1 src/sys/dev/sun/sireg.h:1.2
--- src/sys/dev/sun/sireg.h:1.1	Tue Feb 13 05:35:13 2024
+++ src/sys/dev/sun/sireg.h	Tue Feb 13 13:46:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sireg.h,v 1.1 2024/02/13 05:35:13 thorpej Exp $	*/
+/*	$NetBSD: sireg.h,v 1.2 2024/02/13 13:46:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -54,7 +54,9 @@ struct si_regs {
 	u_short	dma_counth;	/* DMA count   (VME only) */
 	u_short	dma_countl;	/* (high word, low word)  */
 
-	u_int	pad0;		/* no-existent register */
+	/* AMD 9516 regs (OBIO only) see am9516.h */
+	u_short udc_data;	/* Am9516, reg data (OBIO only) */
+	u_short udc_addr;	/* Am9516, reg addr (OBIO only) */
 
 	u_short	fifo_data;	/* fifo data register */
 	u_short	fifo_count;	/* fifo count register */
@@ -83,6 +85,8 @@ struct si_regs {
 #define SIREG_DMA_ADDRL	(NCR5380REGS_SZ + 2)	/* DMA address, low word */
 #define SIREG_DMA_CNTH	(NCR5380REGS_SZ + 4)	/* DMA count, high word */
 #define SIREG_DMA_CNTL	(NCR5380REGS_SZ + 6)	/* DMA count, low word */
+#define SIREG_UDC_DATA	(NCR5380REGS_SZ + 8)	/* UDC reg data */
+#define SIREG_UDC_ADDR	(NCR5380REGS_SZ + 10)	/* UDC reg addr */
 #define SIREG_FIFO_DATA	(NCR5380REGS_SZ + 12)	/* FIFO data */
 #define SIREG_FIFO_CNT	(NCR5380REGS_SZ + 14)	/* FIFO count, low word */
 #define SIREG_CSR	(NCR5380REGS_SZ + 16)	/* Control/status register */



CVS commit: src/sys/dev

2024-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 05:35:13 UTC 2024

Modified Files:
src/sys/dev/vme: si.c
Added Files:
src/sys/dev/sun: sireg.h
Removed Files:
src/sys/dev/vme: sireg.h

Log Message:
Move sireg.h from vme/ to sun/ -- the same (or nearly so) register defns
are used by multiple bus attachments.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/sun/sireg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/vme/si.c
cvs rdiff -u -r1.4 -r0 src/sys/dev/vme/sireg.h

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

Modified files:

Index: src/sys/dev/vme/si.c
diff -u src/sys/dev/vme/si.c:1.24 src/sys/dev/vme/si.c:1.25
--- src/sys/dev/vme/si.c:1.24	Sun Nov 10 21:16:38 2019
+++ src/sys/dev/vme/si.c	Tue Feb 13 05:35:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $	*/
+/*	$NetBSD: si.c,v 1.25 2024/02/13 05:35:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996,2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.25 2024/02/13 05:35:13 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: si.c,v 1.24 
 #include 
 #include 
 
-#include 
+#include 
 
 /*
  * Transfers smaller than this are done using PIO

Added files:

Index: src/sys/dev/sun/sireg.h
diff -u /dev/null src/sys/dev/sun/sireg.h:1.1
--- /dev/null	Tue Feb 13 05:35:13 2024
+++ src/sys/dev/sun/sireg.h	Tue Feb 13 05:35:13 2024
@@ -0,0 +1,129 @@
+/*	$NetBSD: sireg.h,v 1.1 2024/02/13 05:35:13 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * 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.
+ */
+
+/*
+ * Register map for the VME SCSI-3 adapter (si)
+ * The first part of this register map is an NCR5380
+ * SCSI Bus Interface Controller (SBIC).  The rest is a
+ * DMA controller and custom logic.
+ */
+
+
+#if __for_reference_only__
+/*
+ * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h
+ */
+struct ncr5380regs {
+	u_char r[8];
+};
+
+struct si_regs {
+	struct ncr5380regs sci;
+
+	/* DMA controller registers */
+	u_short	dma_addrh;	/* DMA address (VME only) */
+	u_short	dma_addrl;	/* (high word, low word)  */
+	u_short	dma_counth;	/* DMA count   (VME only) */
+	u_short	dma_countl;	/* (high word, low word)  */
+
+	u_int	pad0;		/* no-existent register */
+
+	u_short	fifo_data;	/* fifo data register */
+	u_short	fifo_count;	/* fifo count register */
+	u_short	si_csr;		/* si control/status */
+	u_short	bprh;		/* VME byte pack high */
+	u_short	bprl;		/* VME byte pack low */
+	u_short	iv_am;		/* bits 0-7: intr vector */
+/* bits 8-13: addr modifier (VME only) */
+/* bits 14-15: unused */
+	u_short	fifo_cnt_hi;	/* high part of fifo_count (VME only) */
+
+	/* Whole thing repeats after 32 bytes. */
+	u_short	_space[3];
+};
+#endif
+
+/*
+ * Size of NCR5380 registers located at the bottom of the register bank
+ */
+#define NCR5380REGS_SZ	8
+
+/*
+ * Register definition for the `si' VME controller
+ */
+#define SIREG_DMA_ADDRH	(NCR5380REGS_SZ + 0)	/* DMA address, high word */
+#define SIREG_DMA_ADDRL	(NCR5380REGS_SZ + 2)	/* DMA address, low word */
+#define SIREG_DMA_CNTH	(NCR5380REGS_SZ + 4)	/* DMA count, high word */
+#define SIREG_DMA_CNTL	(NCR5380REGS_SZ + 6)	/* DMA count, low word */
+#define SIREG_FIFO_DATA	(NCR5380REGS_SZ + 12)	/* FIFO data */
+#define SIREG_FIFO_CNT	(NCR5380REGS_SZ + 14)	/* FIFO count, low word */
+#define 

CVS commit: src/sys/dev

2024-02-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb 13 05:35:13 UTC 2024

Modified Files:
src/sys/dev/vme: si.c
Added Files:
src/sys/dev/sun: sireg.h
Removed Files:
src/sys/dev/vme: sireg.h

Log Message:
Move sireg.h from vme/ to sun/ -- the same (or nearly so) register defns
are used by multiple bus attachments.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/sun/sireg.h
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/vme/si.c
cvs rdiff -u -r1.4 -r0 src/sys/dev/vme/sireg.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/hp300/dev

2024-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 28 17:31:40 UTC 2024

Modified Files:
src/sys/arch/hp300/dev: intio.c intiovar.h

Log Message:
Rather than having different "builtin" tables (3xx, 362, 382, 4xx),
just have a single "builtin" table with a mask indicating which of
those groups of machines have a particular built-in device.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/hp300/dev/intio.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/dev/intiovar.h

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

Modified files:

Index: src/sys/arch/hp300/dev/intio.c
diff -u src/sys/arch/hp300/dev/intio.c:1.31 src/sys/arch/hp300/dev/intio.c:1.32
--- src/sys/arch/hp300/dev/intio.c:1.31	Sat Aug  7 16:18:53 2021
+++ src/sys/arch/hp300/dev/intio.c	Sun Jan 28 17:31:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio.c,v 1.31 2021/08/07 16:18:53 thorpej Exp $	*/
+/*	$NetBSD: intio.c,v 1.32 2024/01/28 17:31:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1998, 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.31 2021/08/07 16:18:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.32 2024/01/28 17:31:40 thorpej Exp $");
 
 #include 
 #include 
@@ -60,47 +60,53 @@ CFATTACH_DECL_NEW(intio, sizeof(struct i
 #if defined(HP320) || defined(HP330) || defined(HP340) || defined(HP345) || \
 defined(HP350) || defined(HP360) || defined(HP370) || defined(HP375) || \
 defined(HP380) || defined(HP385)
-static const struct intio_builtins intio_3xx_builtins[] = {
-	{ "rtc",	RTC_BASE,	-1},
-	{ "hil",	HIL_BASE,	1},
-	{ "hpib",	HPIB_BASE,	3},
-	{ "dma",	DMA_BASE,	1},
-	{ "fb",		FB_BASE,	-1},
-};
-#define nintio_3xx_builtins	__arraycount(intio_3xx_builtins)
+#define	HAVE_INTIO_FB
 #endif
 
-#if defined(HP362)
-static const struct intio_builtins intio_362_builtins[] = {
-	{ "rtc",	RTC_BASE,	-1},
-	{ "hil",	HIL_BASE,	1},
-	{ "hpib",	HPIB_BASE,	3},
-	{ "dma",	DMA_BASE,	1},
-};
-#define nintio_362_builtins	__arraycount(intio_362_builtins)
+#if defined(HP382) || defined(HP400) || defined(HP425) || defined(HP433)
+#define	HAVE_INTIO_FRODO
 #endif
 
-#if defined(HP382)
-static const struct intio_builtins intio_382_builtins[] = {
-	{ "rtc",	RTC_BASE,	-1},
-	{ "frodo",	FRODO_BASE,	5},
-	{ "hil",	HIL_BASE,	1},
-	{ "hpib",	HPIB_BASE,	3},
-	{ "dma",	DMA_BASE,	1},
-};
-#define nintio_382_builtins	__arraycount(intio_382_builtins)
+#define	INTIO_3xx_BUILTINS		\
+	(__BIT(HP_320) | __BIT(HP_330) | __BIT(HP_340) ||		\
+	 __BIT(HP_345) | __BIT(HP_345) | __BIT(HP_350) ||		\
+	 __BIT(HP_360) | __BIT(HP_370) | __BIT(HP_375) ||		\
+	 __BIT(HP_380) | __BIT(HP_385))
+
+#define	INTIO_362_BUILTINS	__BIT(HP_362)
+#define	INTIO_382_BUILTINS	__BIT(HP_382)
+
+#define	INTIO_4xx_BUILTINS		\
+	(__BIT(HP_400) | __BIT(HP_425) | __BIT(HP_433))
+
+#define	INTIO_ALL_BUILTINS		\
+	(INTIO_3xx_BUILTINS | INTIO_362_BUILTINS |			\
+	 INTIO_382_BUILTINS | INTIO_4xx_BUILTINS)
+
+static const struct intio_builtins intio_builtins[] = {
+	{ "rtc",	RTC_BASE,	-1,
+	  INTIO_ALL_BUILTINS },
+
+#ifdef HAVE_INTIO_FRODO
+	{ "frodo",	FRODO_BASE,	5,
+	  INTIO_382_BUILTINS | INTIO_4xx_BUILTINS },
 #endif
 
-#if defined(HP400) || defined(HP425) || defined(HP433)
-static const struct intio_builtins intio_4xx_builtins[] = {
-	{ "rtc",	RTC_BASE,	-1},
-	{ "frodo",	FRODO_BASE,	5},
-	{ "hil",	HIL_BASE,	1},
-	{ "hpib",	HPIB_BASE,	3},
-	{ "dma",	DMA_BASE,	1},
-};
-#define nintio_4xx_builtins	__arraycount(intio_4xx_builtins)
+	{ "hil",	HIL_BASE,	1,
+	  INTIO_ALL_BUILTINS },
+
+	{ "hpib",	HPIB_BASE,	3,
+	  INTIO_ALL_BUILTINS },
+
+	{ "dma",	DMA_BASE,	1,
+	  INTIO_ALL_BUILTINS },
+
+#ifdef HAVE_INTIO_FB
+	{ "fb",		FB_BASE,	-1,
+	  INTIO_3xx_BUILTINS },
 #endif
+};
+#define	nintio_builtins		__arraycount(intio_builtins)
 
 static int intio_matched = 0;
 extern void *internalhpib;
@@ -122,76 +128,43 @@ intioattach(device_t parent, device_t se
 {
 	struct intio_softc *sc = device_private(self);
 	struct intio_attach_args ia;
-	const struct intio_builtins *ib;
 	bus_space_tag_t bst = >sc_tag;
-	int ndevs;
+	const uint32_t spumask = 1U << machineid;
 	int i;
 
 	sc->sc_dev = self;
 	aprint_normal("\n");
 
+	KASSERT(spumask != 0);
+
 	memset(bst, 0, sizeof(struct bus_space_tag));
 	bst->bustype = HP300_BUS_SPACE_INTIO;
 
-	switch (machineid) {
-#if defined(HP320) || defined(HP330) || defined(HP340) || defined(HP345) || \
-defined(HP350) || defined(HP360) || defined(HP370) || defined(HP375) || \
-defined(HP380) || defined(HP385)
-	case HP_320:
-	case HP_330:
-	case HP_340:
-	case HP_345:
-	case HP_350:
-	case HP_360:
-	case HP_370:
-	case HP_375:
-	case HP_380:
-	case HP_385:
-		ib = intio_3xx_builtins;
-		ndevs = nintio_3xx_builtins;
-		break;
-#endif
-#if defined(HP362)
-	case HP_362:
-		ib = intio_362_builtins;
-		ndevs = nintio_362_builtins;
-		break;
-#endif
-#if defined(HP382)
-	case HP_382:
-		ib = 

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

2024-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 28 17:31:40 UTC 2024

Modified Files:
src/sys/arch/hp300/dev: intio.c intiovar.h

Log Message:
Rather than having different "builtin" tables (3xx, 362, 382, 4xx),
just have a single "builtin" table with a mask indicating which of
those groups of machines have a particular built-in device.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/hp300/dev/intio.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/dev/intiovar.h

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



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

2024-01-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 21 03:42:08 UTC 2024

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

Log Message:
Catch up with revision 1.5 of atomic_init_cas.c.  Fixes building libc
on sun2, and probably others.


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

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



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

2024-01-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 21 03:42:08 UTC 2024

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

Log Message:
Catch up with revision 1.5 of atomic_init_cas.c.  Fixes building libc
on sun2, and probably others.


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

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

Modified files:

Index: src/common/lib/libc/atomic/atomic_init_testset.c
diff -u src/common/lib/libc/atomic/atomic_init_testset.c:1.18 src/common/lib/libc/atomic/atomic_init_testset.c:1.19
--- src/common/lib/libc/atomic/atomic_init_testset.c:1.18	Fri Jan 19 19:33:49 2024
+++ src/common/lib/libc/atomic/atomic_init_testset.c	Sun Jan 21 03:42:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $	*/
+/*	$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,8 +36,9 @@
  */
 
 #include 
-__RCSID("$NetBSD: atomic_init_testset.c,v 1.18 2024/01/19 19:33:49 christos Exp $");
+__RCSID("$NetBSD: atomic_init_testset.c,v 1.19 2024/01/21 03:42:08 thorpej Exp $");
 
+#include "extern.h"
 #include "atomic_op_namespace.h"
 
 #include 



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

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

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

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

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


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

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

Modified files:

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



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

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

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

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

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


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

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



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

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

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

Log Message:
Hygiene.


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

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



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

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

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

Log Message:
Hygiene.


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

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

Modified files:

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

CVS commit: src/sys/arch

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

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

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


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

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

Modified files:

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

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



CVS commit: src/sys/arch

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

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

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


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

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



CVS commit: src/sys/arch

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

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

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


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

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

Modified files:

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

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

CVS commit: src/sys/arch

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

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

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


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

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



CVS commit: src/sys/arch

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

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

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


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

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

Modified files:

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

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

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

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

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

CVS commit: src/sys/arch

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

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

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


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

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



CVS commit: src/sys/arch/x68k

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

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

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


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

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

Modified files:

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

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



CVS commit: src/sys/arch/x68k

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

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

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


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

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



CVS commit: src/sys/arch

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

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

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


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

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



CVS commit: src/sys/arch

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

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

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


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

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

Modified files:

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

CVS commit: src/sys/arch/amiga

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

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

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


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

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

Modified files:

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

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



CVS commit: src/sys/arch/amiga

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

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

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


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

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



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

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

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

Log Message:
Revert unintended commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/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/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.5 src/sys/arch/virt68k/conf/GENERIC:1.6
--- src/sys/arch/virt68k/conf/GENERIC:1.5	Fri Jan 19 05:46:36 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Fri Jan 19 05:47:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.5 2024/01/19 05:46:36 thorpej Exp $
+# $NetBSD: GENERIC,v 1.6 2024/01/19 05:47:15 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.5 $"
+#ident 		"GENERIC-$Revision: 1.6 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -100,9 +100,7 @@ options 	INET6		# IPV6
 
 options 	COMPAT_AOUT_M68K	# compatibility with NetBSD/m68k a.out
 include 	"conf/compat_netbsd09.config"
-options 	COMPAT_SUNOS
-options 	COMPAT_13
-options 	COMPAT_16
+#options 	COMPAT_SUNOS
 #options 	COMPAT_M68K4K	# compatibility with NetBSD/m68k4k binaries
 #options 	COMPAT_LINUX	# compatibility with Linux/m68k binaries
 #options 	COMPAT_OSSAUDIO	# compatibility with Linux/m68k binaries



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

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

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

Log Message:
Revert unintended commit.


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

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

Modified Files:
src/sys/arch/virt68k/conf: GENERIC
src/sys/arch/virt68k/include: cpu.h intr.h
src/sys/arch/virt68k/virt68k: intr.c locore.s

Log Message:
Adjust the clockframe to be the same as what the common m68k interrupt
dispatch code expects.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/intr.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/intr.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/virt68k/virt68k/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/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.4 src/sys/arch/virt68k/conf/GENERIC:1.5
--- src/sys/arch/virt68k/conf/GENERIC:1.4	Mon Jan  8 05:11:54 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.4 2024/01/08 05:11:54 thorpej Exp $
+# $NetBSD: GENERIC,v 1.5 2024/01/19 05:46:36 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.4 $"
+#ident 		"GENERIC-$Revision: 1.5 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -100,7 +100,9 @@ options 	INET6		# IPV6
 
 options 	COMPAT_AOUT_M68K	# compatibility with NetBSD/m68k a.out
 include 	"conf/compat_netbsd09.config"
-#options 	COMPAT_SUNOS
+options 	COMPAT_SUNOS
+options 	COMPAT_13
+options 	COMPAT_16
 #options 	COMPAT_M68K4K	# compatibility with NetBSD/m68k4k binaries
 #options 	COMPAT_LINUX	# compatibility with Linux/m68k binaries
 #options 	COMPAT_OSSAUDIO	# compatibility with Linux/m68k binaries

Index: src/sys/arch/virt68k/include/cpu.h
diff -u src/sys/arch/virt68k/include/cpu.h:1.5 src/sys/arch/virt68k/include/cpu.h:1.6
--- src/sys/arch/virt68k/include/cpu.h:1.5	Thu Jan 18 14:39:07 2024
+++ src/sys/arch/virt68k/include/cpu.h	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.5 2024/01/18 14:39:07 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.6 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -54,17 +54,17 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the virt68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
  */
 struct clockframe {
-	u_short	sr;		/* sr at time of interrupt */
-	u_long	pc;		/* pc at time of interrupt */
-	u_short	fmt:4,
-		vec:12;		/* vector offset (4-word frame) */
+	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+	u_short	cf_sr;		/* sr at time of interrupt */
+	u_long	cf_pc;		/* pc at time of interrupt */
+	u_short	cf_vo;		/* vector offset (4-word frame) */
 } __attribute__((packed));
 
-#define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
-#define	CLKF_PC(framep)		((framep)->pc)
+#define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
+#define	CLKF_PC(framep)		((framep)->cf_pc)
 
 /*
  * The clock interrupt handler can determine if it's a nested

Index: src/sys/arch/virt68k/include/intr.h
diff -u src/sys/arch/virt68k/include/intr.h:1.1 src/sys/arch/virt68k/include/intr.h:1.2
--- src/sys/arch/virt68k/include/intr.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/intr.h	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.2 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -162,7 +162,7 @@ void	intr_register_pic(struct device *, 
 #include 
 #include 
 
-void	intr_dispatch(struct clockframe *);
+void	intr_dispatch(struct clockframe);
 #endif /* _VIRT68K_INTR_PRIVATE */
 
 #endif /* !_LOCORE */

Index: src/sys/arch/virt68k/virt68k/intr.c
diff -u src/sys/arch/virt68k/virt68k/intr.c:1.2 src/sys/arch/virt68k/virt68k/intr.c:1.3
--- src/sys/arch/virt68k/virt68k/intr.c:1.2	Tue Jan  2 07:48:46 2024
+++ src/sys/arch/virt68k/virt68k/intr.c	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $");
 
 #define _VIRT68K_INTR_PRIVATE
 
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -267,9 +269,9 @@ intr_string(void *v, char *buf, size_t b
 #define	VEC_AVINTR	0x18

CVS commit: src/sys/arch/virt68k

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

Modified Files:
src/sys/arch/virt68k/conf: GENERIC
src/sys/arch/virt68k/include: cpu.h intr.h
src/sys/arch/virt68k/virt68k: intr.c locore.s

Log Message:
Adjust the clockframe to be the same as what the common m68k interrupt
dispatch code expects.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/intr.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/intr.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/virt68k/virt68k/locore.s

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



  1   2   3   4   5   6   7   8   9   10   >