CVS commit: src/sys/arch/arm

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 17:58:08 UTC 2024

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c cpu_acpi.c
src/sys/arch/arm/arm: arm_cpu_topology.c

Log Message:
aarch64: Add NUMA awareness for ACPI systems with SRAT tables.

On an Ampere Altra w/ hemisphere mode enabled:

[   1.000] cpu0: package 16, core 0, smt 0, numa 0
[...]
[   1.000] cpu32: package 22, core 0, smt 0, numa 1

[ 1.04] SRAT: 2 NUMA nodes
[ 1.04] SRAT: node 0 memory range 0 (0x8830 - 0x8840 flags 1)
[ 1.04] SRAT: node 0 memory range 1 (0x9000 - 0x1 flags 1)
[ 1.04] SRAT: node 0 memory range 2 (0x800 - 0x8008000 
flags 1)
[ 1.04] SRAT: node 0 memory range 3 (0x801 - 0x810 
flags 1)
[ 1.04] SRAT: node 1 memory range 0 (0xc00 - 0xc10 
flags 1)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm/arm_cpu_topology.c

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.36 src/sys/arch/arm/acpi/acpi_platform.c:1.37
--- src/sys/arch/arm/acpi/acpi_platform.c:1.36	Fri Apr  7 08:55:29 2023
+++ src/sys/arch/arm/acpi/acpi_platform.c	Sun Jun 30 17:58:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.36 2023/04/07 08:55:29 skrll Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.37 2024/06/30 17:58:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.36 2023/04/07 08:55:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.37 2024/06/30 17:58:08 jmcneill Exp $");
 
 #include 
 #include 
@@ -79,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_platfor
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -391,6 +392,14 @@ spcr_unmap:
 }
 
 static void
+acpi_platform_device_register_post_config(device_t self, void *aux)
+{
+	if (device_is_a(self, "acpi")) {
+		acpisrat_load_uvm();
+	}
+}
+
+static void
 acpi_platform_reset(void)
 {
 #ifdef EFI_RUNTIME
@@ -413,6 +422,7 @@ static const struct fdt_platform acpi_pl
 	.fp_startup = acpi_platform_startup,
 	.fp_init_attach_args = acpi_platform_init_attach_args,
 	.fp_device_register = acpi_platform_device_register,
+	.fp_device_register_post_config = acpi_platform_device_register_post_config,
 	.fp_reset = acpi_platform_reset,
 	.fp_delay = gtmr_delay,
 	.fp_uart_freq = acpi_platform_uart_freq,

Index: src/sys/arch/arm/acpi/cpu_acpi.c
diff -u src/sys/arch/arm/acpi/cpu_acpi.c:1.15 src/sys/arch/arm/acpi/cpu_acpi.c:1.16
--- src/sys/arch/arm/acpi/cpu_acpi.c:1.15	Thu May  9 12:41:08 2024
+++ src/sys/arch/arm/acpi/cpu_acpi.c	Sun Jun 30 17:58:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_acpi.c,v 1.15 2024/05/09 12:41:08 pho Exp $ */
+/* $NetBSD: cpu_acpi.c,v 1.16 2024/06/30 17:58:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.15 2024/05/09 12:41:08 pho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.16 2024/06/30 17:58:08 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -100,6 +101,7 @@ cpu_acpi_attach(device_t parent, device_
 	const uint64_t mpidr = gicc->ArmMpidr;
 	const int unit = device_unit(self);
 	struct cpu_info *ci = _info_store[unit];
+	struct acpisrat_node *node;
 
 #ifdef MULTIPROCESSOR
 	if (cpu_mpidr_aff_read() != mpidr && (boothowto & RB_MD1) == 0) {
@@ -133,6 +135,15 @@ cpu_acpi_attach(device_t parent, device_
 	/* Store the ACPI Processor UID in cpu_info */
 	ci->ci_acpiid = gicc->Uid;
 
+	/* Scan SRAT for NUMA info. */
+	if (cpu_mpidr_aff_read() == mpidr) {
+		acpisrat_init();
+	}
+	node = acpisrat_get_node(gicc->Uid);
+	if (node != NULL) {
+		ci->ci_numa_id = node->nodeid;
+	}
+
 	/* Attach the CPU */
 	cpu_attach(self, mpidr);
 

Index: src/sys/arch/arm/arm/arm_cpu_topology.c
diff -u src/sys/arch/arm/arm/arm_cpu_topology.c:1.6 src/sys/arch/arm/arm/arm_cpu_topology.c:1.7
--- src/sys/arch/arm/arm/arm_cpu_topology.c:1.6	Sat Dec 11 19:24:20 2021
+++ src/sys/arch/arm/arm/arm_cpu_topology.c	Sun Jun 30 17:58:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm_cpu_topology.c,v 1.6 2021/12/11 19:24:20 mrg Exp $	*/
+/*	$NetBSD: arm_cpu_topology.c,v 1.7 2024/06/30 17:58:08 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2020 Matthew R. Green
@@ -31,7 +31,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm_cpu_topology.c,v 1.6 2021/12/11 19:24:20 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/arch/arm

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 17:58:08 UTC 2024

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c cpu_acpi.c
src/sys/arch/arm/arm: arm_cpu_topology.c

Log Message:
aarch64: Add NUMA awareness for ACPI systems with SRAT tables.

On an Ampere Altra w/ hemisphere mode enabled:

[   1.000] cpu0: package 16, core 0, smt 0, numa 0
[...]
[   1.000] cpu32: package 22, core 0, smt 0, numa 1

[ 1.04] SRAT: 2 NUMA nodes
[ 1.04] SRAT: node 0 memory range 0 (0x8830 - 0x8840 flags 1)
[ 1.04] SRAT: node 0 memory range 1 (0x9000 - 0x1 flags 1)
[ 1.04] SRAT: node 0 memory range 2 (0x800 - 0x8008000 
flags 1)
[ 1.04] SRAT: node 0 memory range 3 (0x801 - 0x810 
flags 1)
[ 1.04] SRAT: node 1 memory range 0 (0xc00 - 0xc10 
flags 1)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm/arm_cpu_topology.c

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



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

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 09:38:07 UTC 2024

Modified Files:
src/sys/arch/arm/pci: pci_msi_machdep.c

Log Message:
arm: pci: Fix ITS ID lookup for MSIs.

pci_get_frameid expects a BDF requestor ID as input, not a Device ID.
Fixes MSI/MSI-X support on Ampere Altra systems.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/pci/pci_msi_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/arm/pci/pci_msi_machdep.c
diff -u src/sys/arch/arm/pci/pci_msi_machdep.c:1.9 src/sys/arch/arm/pci/pci_msi_machdep.c:1.10
--- src/sys/arch/arm/pci/pci_msi_machdep.c:1.9	Thu Feb 13 06:28:25 2020
+++ src/sys/arch/arm/pci/pci_msi_machdep.c	Sun Jun 30 09:38:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_msi_machdep.c,v 1.9 2020/02/13 06:28:25 skrll Exp $ */
+/* $NetBSD: pci_msi_machdep.c,v 1.10 2024/06/30 09:38:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.9 2020/02/13 06:28:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.10 2024/06/30 09:38:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -63,14 +63,13 @@ static struct arm_pci_msi *
 arm_pci_msi_lookup(const struct pci_attach_args *pa)
 {
 	struct arm_pci_msi *msip;
-	uint32_t devid, frameid;
+	uint32_t rid, frameid;
 	int b, d, f;
 
 	pci_decompose_tag(pa->pa_pc, pa->pa_tag, , , );
 
-	devid = (b << 8) | (d << 3) | f;
-	devid = pci_get_devid(pa->pa_pc, devid);
-	frameid = pci_get_frameid(pa->pa_pc, devid);
+	rid = (b << 8) | (d << 3) | f;
+	frameid = pci_get_frameid(pa->pa_pc, rid);
 
 	SIMPLEQ_FOREACH(msip, _pci_msi_list, msi_link)
 		if (frameid == msip->msi_id)



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

2024-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jun 30 09:38:07 UTC 2024

Modified Files:
src/sys/arch/arm/pci: pci_msi_machdep.c

Log Message:
arm: pci: Fix ITS ID lookup for MSIs.

pci_get_frameid expects a BDF requestor ID as input, not a Device ID.
Fixes MSI/MSI-X support on Ampere Altra systems.


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

2024-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 29 11:27:12 UTC 2024

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
scx(4): Fix if_statinc call.

We don't have a reference to the local statistics counters, so we
can't use if_statinc_ref.  But, because net_stat_ref_t is just an
alias for void *, the compiler doesn't detect this mistake.

PR kern/58380


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.43 src/sys/arch/arm/sociox/if_scx.c:1.44
--- src/sys/arch/arm/sociox/if_scx.c:1.43	Thu Jun 15 07:21:45 2023
+++ src/sys/arch/arm/sociox/if_scx.c	Sat Jun 29 11:27:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.43 2023/06/15 07:21:45 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.44 2024/06/29 11:27:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.43 2023/06/15 07:21:45 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.44 2024/06/29 11:27:12 riastradh Exp $");
 
 #include 
 #include 
@@ -1399,7 +1399,7 @@ scx_start(struct ifnet *ifp)
 "DMA segments, dropping...\n");
 IFQ_DEQUEUE(>if_snd, m0);
 m_freem(m0);
-if_statinc_ref(ifp, if_oerrors);
+if_statinc(ifp, if_oerrors);
 continue;
 			}
 			/* Short on resources, just stop for now. */



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

2024-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 29 11:27:12 UTC 2024

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
scx(4): Fix if_statinc call.

We don't have a reference to the local statistics counters, so we
can't use if_statinc_ref.  But, because net_stat_ref_t is just an
alias for void *, the compiler doesn't detect this mistake.

PR kern/58380


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/sociox/if_scx.c

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



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

2024-06-10 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

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

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c

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



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

2024-06-10 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

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

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_pmwdog.c
diff -u src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_pmwdog.c	Mon Jun 10 06:03:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $");
 
 
 #include 
@@ -54,12 +54,19 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwd
 #endif
 
 #define	 BCM2835_PM_PASSWORD		0x5a00
+#define	 BCM2835_PM_PASSWORD_MASK	0xff00
 
 #define	BCM2835_PM_RSTC		0x1c
 #define	 BCM2835_PM_RSTC_CONFIGMASK	0x0030
 #define	 BCM2835_PM_RSTC_FULL_RESET	0x0020
 #define	 BCM2835_PM_RSTC_RESET		0x0102
 
+#define	BCM2835_PM_RSTS		0x20
+#define  BCM2835_PM_RSTS_PART(x) \
+		((uint16_t)((x) & 0x01) << 0 | (uint16_t)((x) & 0x02) << 1 | \
+		 (uint16_t)((x) & 0x04) << 2 | (uint16_t)((x) & 0x08) << 3 | \
+		 (uint16_t)((x) & 0x10) << 4 | (uint16_t)((x) & 0x20) << 5)
+
 #define	BCM2835_PM_WDOG		0x24
 #define	 BCM2835_PM_WDOG_TIMEMASK	0x000f
 
@@ -82,6 +89,10 @@ static void bcmpmwdog_set_timeout(struct
 static int bcmpmwdog_setmode(struct sysmon_wdog *);
 static int bcmpmwdog_tickle(struct sysmon_wdog *);
 
+/* fdt power controller */
+static void bcm2835_power_reset(device_t);
+static void bcm2835_power_poweroff(device_t);
+
 CFATTACH_DECL_NEW(bcmpmwdog_fdt, sizeof(struct bcm2835pmwdog_softc),
 bcmpmwdog_match, bcmpmwdog_attach, NULL, NULL);
 
@@ -90,6 +101,11 @@ static const struct device_compatible_en
 	DEVICE_COMPAT_EOL
 };
 
+static struct fdtbus_power_controller_func bcmpmwdog_power_funcs = {
+	.reset = bcm2835_power_reset,
+	.poweroff = bcm2835_power_poweroff
+};
+
 /* ARGSUSED */
 static int
 bcmpmwdog_match(device_t parent, cfdata_t match, void *aux)
@@ -136,6 +152,9 @@ bcmpmwdog_attach(device_t parent, device
 	sc->sc_smw.smw_period = BCM2835_PM_DEFAULT_PERIOD;
 	if (sysmon_wdog_register(>sc_smw) != 0)
 		aprint_error_dev(self, "couldn't register watchdog\n");
+
+	fdtbus_register_power_controller(self, phandle,
+	_power_funcs);
 }
 
 static void
@@ -176,6 +195,17 @@ bcmpmwdog_setmode(struct sysmon_wdog *sm
 	return error;
 }
 
+static void
+bcmpmwdog_set_partition(struct bcm2835pmwdog_softc *sc, uint8_t part)
+{
+	uint32_t tmp;
+
+	tmp = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS);
+	tmp &= ~(BCM2835_PM_PASSWORD_MASK | BCM2835_PM_RSTS_PART(~0));
+	tmp |= BCM2835_PM_PASSWORD | BCM2835_PM_RSTS_PART(part);
+	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS, tmp);
+}
+
 static int
 bcmpmwdog_tickle(struct sysmon_wdog *smw)
 {
@@ -187,11 +217,43 @@ bcmpmwdog_tickle(struct sysmon_wdog *smw
 	return 0;
 }
 
+static void
+bcm2835_restart(struct bcm2835pmwdog_softc *sc, int partition)
+{
+	uint32_t timeout = 10;
+
+	bcmpmwdog_set_partition(sc, partition);
+	bcmpmwdog_set_timeout(sc, timeout);
+}
+
 void
 bcm2835_system_reset(void)
 {
 	struct bcm2835pmwdog_softc *sc = bcm2835pmwdog_sc;
-	uint32_t timeout = 10;
 
-	bcmpmwdog_set_timeout(sc, timeout);
+	bcm2835_restart(sc, 0);
+}
+
+static void
+bcm2835_power_reset(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	bcm2835_restart(sc, 0);
+
+	for (;;) continue;
+	/* NOTREACHED */
 }
+
+static void
+bcm2835_power_poweroff(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	/* Boot from partition 63 is magic to halt boot process */
+	bcm2835_restart(sc, 63);
+
+	for (;;) continue;
+	/* NOTREACHED */
+}
+



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

2024-06-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun  9 22:35:47 UTC 2024

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

Log Message:
arm/asm.h: Respect NETBSD_REVISIONID.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/include/asm.h

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

Modified files:

Index: src/sys/arch/arm/include/asm.h
diff -u src/sys/arch/arm/include/asm.h:1.34 src/sys/arch/arm/include/asm.h:1.35
--- src/sys/arch/arm/include/asm.h:1.34	Thu Apr 23 23:22:41 2020
+++ src/sys/arch/arm/include/asm.h	Sun Jun  9 22:35:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.34 2020/04/23 23:22:41 jakllsch Exp $	*/
+/*	$NetBSD: asm.h,v 1.35 2024/06/09 22:35:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -224,10 +224,33 @@
 #define	PIC_SYM(x,y)	x
 #endif	/* __PIC__ */
 
-#define RCSID(x)	.pushsection ".ident","MS",%progbits,1;		\
-			.asciz x;	\
+/*
+ * Annoyingly, gas on arm seems to generate _two_ NUL-terminated
+ * strings for
+ *
+ *	.asciz "foo" "bar"
+ *
+ * instead of concatenating it into a single NUL-terminated string as
+ * on other architectures.
+ *
+ * To work around this, we concatenate into a single NUL-terminated by:
+ *
+ *	.ascii "foo"
+ *	.asciz "bar"
+ */
+#define _IDENTSTR(x)	.pushsection ".ident","MS",%progbits,1;		\
+			x;		\
 			.popsection
 
+#ifdef _NETBSD_REVISIONID
+#define	RCSID(_s)			\
+	_IDENTSTR(.asciz _s);		\
+	_IDENTSTR(.ascii "$"; .ascii "NetBSD: "; .ascii __FILE__;	\
+	.ascii " "; .ascii _NETBSD_REVISIONID; .asciz " $")
+#else
+#define	RCSID(_s)	_IDENTSTR(.asciz _s)
+#endif
+
 #define	WEAK_ALIAS(alias,sym)		\
 	.weak alias;			\
 	alias = sym



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

2024-06-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun  9 22:35:47 UTC 2024

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

Log Message:
arm/asm.h: Respect NETBSD_REVISIONID.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/include/asm.h

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



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

2024-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat May 18 19:04:45 UTC 2024

Modified Files:
src/sys/arch/arm/iomd: vidc20config.c

Log Message:
s/abou/about/ in comment.


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

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

Modified files:

Index: src/sys/arch/arm/iomd/vidc20config.c
diff -u src/sys/arch/arm/iomd/vidc20config.c:1.36 src/sys/arch/arm/iomd/vidc20config.c:1.37
--- src/sys/arch/arm/iomd/vidc20config.c:1.36	Tue May 24 06:28:00 2022
+++ src/sys/arch/arm/iomd/vidc20config.c	Sat May 18 19:04:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vidc20config.c,v 1.36 2022/05/24 06:28:00 andvar Exp $	*/
+/*	$NetBSD: vidc20config.c,v 1.37 2024/05/18 19:04:45 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Reinoud Zandijk
@@ -48,7 +48,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.36 2022/05/24 06:28:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.37 2024/05/18 19:04:45 andvar Exp $");
 
 #include 
 #include 
@@ -206,7 +206,7 @@ vidcvideo_write(u_int reg, int value)
 
 	/*
 	 * Undefine SAFER if you wish to speed things up (a little)
-	 * although this means the function will assume things abou
+	 * although this means the function will assume things about
 	 * the structure of vidc_state. i.e. the first 256 words are
 	 * the palette array
 	 */



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

2024-05-18 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat May 18 19:04:45 UTC 2024

Modified Files:
src/sys/arch/arm/iomd: vidc20config.c

Log Message:
s/abou/about/ in comment.


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

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



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

2024-05-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 10 14:42:21 UTC 2024

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
arm/fdt/cpu_fdt.c: Use `cpu' iattr to attach cpufreq.

Now that cpu has an explicit interface attribute, cpufeaturebus,
_all_ children of cpu must use an explicit interface attribute to
disambiguate.  For children that weren't previously attached using an
explicit interface attribute, the name of the parent, `cpu', serves
as the iattr.

XXX I think we should either
(a) not use cpufreqbus, since in the aarch64 case it doesn't seem to
be passing any information through attach args, or
(b) create another iattr like cpufdtbus for use by cpufreq_dt.c,
which does rely on attach args, if it has to attach differently
from the rest of fdtbus.
But for now this should get aarch64 on fdt booting again.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/fdt/cpu_fdt.c

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



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

2024-05-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May 10 14:42:21 UTC 2024

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
arm/fdt/cpu_fdt.c: Use `cpu' iattr to attach cpufreq.

Now that cpu has an explicit interface attribute, cpufeaturebus,
_all_ children of cpu must use an explicit interface attribute to
disambiguate.  For children that weren't previously attached using an
explicit interface attribute, the name of the parent, `cpu', serves
as the iattr.

XXX I think we should either
(a) not use cpufreqbus, since in the aarch64 case it doesn't seem to
be passing any information through attach args, or
(b) create another iattr like cpufdtbus for use by cpufreq_dt.c,
which does rely on attach args, if it has to attach differently
from the rest of fdtbus.
But for now this should get aarch64 on fdt booting again.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/fdt/cpu_fdt.c

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

Modified files:

Index: src/sys/arch/arm/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.43 src/sys/arch/arm/fdt/cpu_fdt.c:1.44
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.43	Thu May  9 12:41:08 2024
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Fri May 10 14:42:21 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.43 2024/05/09 12:41:08 pho Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.44 2024/05/10 14:42:21 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.43 2024/05/09 12:41:08 pho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.44 2024/05/10 14:42:21 riastradh Exp $");
 
 #include 
 #include 
@@ -98,7 +98,7 @@ cpu_fdt_attach(device_t parent, device_t
 	cpu_attach(self, cpuid);
 
 	/* Attach CPU frequency scaling provider */
-	config_found(self, faa, NULL, CFARGS_NONE);
+	config_found(self, faa, NULL, CFARGS(.iattr = "cpu"));
 }
 
 #if defined(MULTIPROCESSOR) && (NPSCI_FDT > 0 || defined(__aarch64__))



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

2024-05-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  6 07:29:30 UTC 2024

Modified Files:
src/sys/arch/arm/include: setjmp.h

Log Message:
Improve the comment.


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

2024-05-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May  6 07:29:30 UTC 2024

Modified Files:
src/sys/arch/arm/include: setjmp.h

Log Message:
Improve the comment.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/include/setjmp.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/arm/include/setjmp.h
diff -u src/sys/arch/arm/include/setjmp.h:1.5 src/sys/arch/arm/include/setjmp.h:1.6
--- src/sys/arch/arm/include/setjmp.h:1.5	Fri Jan 11 13:56:32 2013
+++ src/sys/arch/arm/include/setjmp.h	Mon May  6 07:29:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.h,v 1.5 2013/01/11 13:56:32 matt Exp $	*/
+/*	$NetBSD: setjmp.h,v 1.6 2024/05/06 07:29:30 skrll Exp $	*/
 
 /*
  * machine/setjmp.h: machine dependent setjmp-related information.
@@ -10,11 +10,12 @@
  * NOTE: The internal structure of a jmp_buf is *PRIVATE*
  *   This information is provided as there is software
  *   that fiddles with this with obtain the stack pointer
- *	 (yes really ! and its commercial !).
+ *	 (yes really ! and it's commercial !).
  *
  * Description of the setjmp buffer
  *
- * word  0	magic number	(dependent on creator)
+ * Word		Field		Comment
+ * 	0	magic number	(dependent on creator)
  *	13	fpscr		vfp status control register
  *	14	r4		register 4
  *	15	r5		register 5
@@ -47,13 +48,13 @@
  * A side note I should mention - Please do not tamper
  * with the floating point fields. While they are
  * always saved and restored at the moment this cannot
- * be garenteed especially if the compiler happens
+ * be guaranteed especially if the compiler happens
  * to be generating soft-float code so no fp
  * registers will be used.
  *
- * Whilst this can be seen an encouraging people to
+ * Whilst this can be seen as encouraging people to
  * use the setjmp buffer in this way I think that it
- * is for the best then if changes occur compiles will
+ * is for the best then, if changes occur, compiles will
  * break rather than just having new builds falling over
  * mysteriously.
  */



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

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:04:55 UTC 2024

Modified Files:
src/sys/arch/arm/xilinx: zynq_uart.c

Log Message:
Initialize `struct consdev` members cn_dev and cn_pri like other
UART drivers do.  If cn_dev is 0 instead of NODEV, then the kernel
may redirect console writes to major 0, minor 0, which is /dev/mem.
On my Zynq board the kernel overwrote the page free list with a
console message in this way.


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

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

Modified files:

Index: src/sys/arch/arm/xilinx/zynq_uart.c
diff -u src/sys/arch/arm/xilinx/zynq_uart.c:1.5 src/sys/arch/arm/xilinx/zynq_uart.c:1.6
--- src/sys/arch/arm/xilinx/zynq_uart.c:1.5	Thu Oct 27 07:57:46 2022
+++ src/sys/arch/arm/xilinx/zynq_uart.c	Sat May  4 02:04:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: zynq_uart.c,v 1.5 2022/10/27 07:57:46 skrll Exp $	*/
+/*	$NetBSD: zynq_uart.c,v 1.6 2024/05/04 02:04:54 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.5 2022/10/27 07:57:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.6 2024/05/04 02:04:54 dyoung Exp $");
 
 #include "opt_soc.h"
 #include "opt_console.h"
@@ -1974,7 +1974,9 @@ zynquart_init(struct zynquart_regs *regs
 struct consdev zynquartcons = {
 	.cn_getc = zynquartcngetc,
 	.cn_putc = zynquartcnputc,
-	.cn_pollc = nullcnpollc
+	.cn_pollc = nullcnpollc,
+	.cn_dev = NODEV,
+	.cn_pri = CN_NORMAL,
 };
 
 



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

2024-05-03 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat May  4 02:04:55 UTC 2024

Modified Files:
src/sys/arch/arm/xilinx: zynq_uart.c

Log Message:
Initialize `struct consdev` members cn_dev and cn_pri like other
UART drivers do.  If cn_dev is 0 instead of NODEV, then the kernel
may redirect console writes to major 0, minor 0, which is /dev/mem.
On my Zynq board the kernel overwrote the page free list with a
console message in this way.


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

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



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

2024-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 14 07:56:13 UTC 2024

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

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/arm/sig_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/arm/arm/sig_machdep.c
diff -u src/sys/arch/arm/arm/sig_machdep.c:1.52 src/sys/arch/arm/arm/sig_machdep.c:1.53
--- src/sys/arch/arm/arm/sig_machdep.c:1.52	Mon Feb  1 19:31:34 2021
+++ src/sys/arch/arm/arm/sig_machdep.c	Sun Apr 14 07:56:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.52 2021/02/01 19:31:34 skrll Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.53 2024/04/14 07:56:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.52 2021/02/01 19:31:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.53 2024/04/14 07:56:13 skrll Exp $");
 
 #include 		/* XXX only needed by syscallargs.h */
 #include 
@@ -97,10 +97,10 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	sig_t catcher = SIGACTION(p, sig).sa_handler;
 
 	fp = getframe(l, sig, );
-	
+
 	/* make room on the stack */
 	fp--;
-	
+
 	/* make the stack aligned */
 	fp = (struct sigframe_siginfo *)STACK_ALIGN(fp, STACK_ALIGNBYTES);
 
@@ -134,7 +134,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	 * trampoline version numbers are coordinated with machine-
 	 * dependent code in libc.
 	 */
-	
+
 	tf->tf_r0 = sig;
 	tf->tf_r1 = (int)>sf_si;
 	tf->tf_r2 = (int)>sf_uc;



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

2024-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 14 07:56:13 UTC 2024

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

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/arm/arm/sig_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/arm/arm32

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 12:28:01 UTC 2024

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

Log Message:
port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.442 src/sys/arch/arm/arm32/pmap.c:1.443
--- src/sys/arch/arm/arm32/pmap.c:1.442	Sat Apr 13 10:36:01 2024
+++ src/sys/arch/arm/arm32/pmap.c	Sat Apr 13 12:28:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.443 2024/04/13 12:28:01 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.443 2024/04/13 12:28:01 skrll Exp $");
 
 #include 
 #include 
@@ -2330,15 +2330,10 @@ pmap_clearbit(struct vm_page_md *md, pad
 #ifdef PMAP_CACHE_VIPT
 	const bool want_syncicache = PV_IS_EXEC_P(md->pvh_attrs);
 	bool need_syncicache = false;
-#ifdef ARM_MMU_EXTENDED
-	const u_int execbits = (maskbits & PVF_EXEC) ? L2_XS_XN : 0;
-#else
-	const u_int execbits = 0;
+#ifndef ARM_MMU_EXTENDED
 	bool need_vac_me_harder = false;
 #endif
-#else
-	const u_int execbits = 0;
-#endif
+#endif /* PMAP_CACHE_VIPT */
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, "md %#jx pa %#jx maskbits %#jx",
@@ -2421,9 +2416,14 @@ pmap_clearbit(struct vm_page_md *md, pad
 
 		pt_entry_t * const ptep = >l2b_kva[l2pte_index(va)];
 		const pt_entry_t opte = *ptep;
-		pt_entry_t npte = opte | execbits;
+		pt_entry_t npte = opte;
+
+#if defined(ARM_MMU_EXTENDED)
+		if ((maskbits & PVF_EXEC) != 0 && l2pte_valid_p(opte)) {
+			KASSERT((opte & L2_TYPE_S) != 0);
+			npte |= L2_XS_XN;
+		}
 
-#ifdef ARM_MMU_EXTENDED
 		KASSERT((opte & L2_XS_nG) == (pm == pmap_kernel() ? 0 : L2_XS_nG));
 #endif
 



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

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 12:28:01 UTC 2024

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

Log Message:
port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/arch/arm/arm32/pmap.c

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



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

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 10:36:01 UTC 2024

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

Log Message:
Restore a space I accidentally removed from a copyright with

$NetBSD: pmap.c,v 1.396 2020/03/13 16:14:18 skrll Exp $


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.441 src/sys/arch/arm/arm32/pmap.c:1.442
--- src/sys/arch/arm/arm32/pmap.c:1.441	Wed Dec 13 06:42:40 2023
+++ src/sys/arch/arm/arm32/pmap.c	Sat Apr 13 10:36:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the company nor the name of the author may be used to
- *   endorse or promote products derived from this software without specific
+ *endorse or promote products derived from this software without specific
  *prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $");
 
 #include 
 #include 



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

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 10:36:01 UTC 2024

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

Log Message:
Restore a space I accidentally removed from a copyright with

$NetBSD: pmap.c,v 1.396 2020/03/13 16:14:18 skrll Exp $


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 src/sys/arch/arm/arm32/pmap.c

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



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

2024-04-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Apr  1 15:52:08 UTC 2024

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
ti_gpio: add gpio(4) interrupt support

tested with gpiopps(4) on Beagle Bone Black


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/ti_gpio.c

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

Modified files:

Index: src/sys/arch/arm/ti/ti_gpio.c
diff -u src/sys/arch/arm/ti/ti_gpio.c:1.14 src/sys/arch/arm/ti/ti_gpio.c:1.15
--- src/sys/arch/arm/ti/ti_gpio.c:1.14	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/arm/ti/ti_gpio.c	Mon Apr  1 15:52:08 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_gpio.c,v 1.14 2021/08/07 16:18:46 thorpej Exp $ */
+/* $NetBSD: ti_gpio.c,v 1.15 2024/04/01 15:52:08 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.14 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.15 2024/04/01 15:52:08 jakllsch Exp $");
 
 #include 
 #include 
@@ -262,10 +262,8 @@ static struct fdtbus_gpio_controller_fun
 };
 
 static void
-ti_gpio_intr_disestablish(device_t dev, void *ih)
+ti_gpio_intr_disable(struct ti_gpio_softc * const sc, struct ti_gpio_intr * const intr)
 {
-	struct ti_gpio_softc * const sc = device_private(dev);
-	struct ti_gpio_intr *intr = ih;
 	const u_int pin = intr->intr_pin;
 	const uint32_t pin_mask = __BIT(pin);
 	uint32_t val;
@@ -280,6 +278,7 @@ ti_gpio_intr_disestablish(device_t dev, 
 
 	intr->intr_func = NULL;
 	intr->intr_arg = NULL;
+	intr->intr_mpsafe = false;
 }
 
 static void *
@@ -359,6 +358,15 @@ ti_gpio_intr_establish(device_t dev, u_i
 	return >sc_intr[pin];
 }
 
+static void
+ti_gpio_intr_disestablish(device_t dev, void *ih)
+{
+	struct ti_gpio_softc * const sc = device_private(dev);
+	struct ti_gpio_intr * const intr = ih;
+	
+	ti_gpio_intr_disable(sc, intr);
+}
+
 static bool
 ti_gpio_intrstr(device_t dev, u_int *specifier, char *buf, size_t buflen)
 {
@@ -423,6 +431,106 @@ ti_gpio_pin_ctl(void *priv, int pin, int
 	mutex_exit(>sc_lock);
 }
 
+static void *
+ti_gpio_gp_intr_establish(void *vsc, int pin, int ipl, int irqmode,
+int (*func)(void *), void *arg)
+{
+	struct ti_gpio_softc * const sc = vsc;
+	uint32_t val;
+
+	if (ipl != IPL_VM || pin < 0 || pin >= __arraycount(sc->sc_pins))
+		return NULL;
+
+	if (sc->sc_intr[pin].intr_func != NULL)
+		return NULL;
+
+	/*
+	 * Enabling both high and low level triggers will cause the GPIO
+	 * controller to always assert the interrupt.
+	 */
+	if ((irqmode & (GPIO_INTR_LOW_LEVEL|GPIO_INTR_HIGH_LEVEL)) ==
+	(GPIO_INTR_LOW_LEVEL|GPIO_INTR_HIGH_LEVEL))
+		return NULL;
+
+	/* Set pin as input */
+	mutex_enter(>sc_lock);
+	if (ti_gpio_ctl(sc, pin, GPIO_PIN_INPUT) != 0) {
+		mutex_exit(>sc_lock);
+		return NULL;
+	}
+
+	sc->sc_intr[pin].intr_pin = pin;
+	sc->sc_intr[pin].intr_func = func;
+	sc->sc_intr[pin].intr_arg = arg;
+	sc->sc_intr[pin].intr_mpsafe = (irqmode & GPIO_INTR_MPSAFE) != 0;
+
+	const uint32_t pin_mask = __BIT(pin);
+
+	/* Configure triggers */
+	val = RD4(sc, GPIO_LEVELDETECT0);
+	if ((irqmode & GPIO_INTR_LOW_LEVEL) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_LEVELDETECT0, val);
+
+	val = RD4(sc, GPIO_LEVELDETECT1);
+	if ((irqmode & GPIO_INTR_HIGH_LEVEL) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_LEVELDETECT1, val);
+
+	val = RD4(sc, GPIO_RISINGDETECT);
+	if ((irqmode & GPIO_INTR_POS_EDGE) != 0 ||
+	(irqmode & GPIO_INTR_DOUBLE_EDGE) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_RISINGDETECT, val);
+
+	val = RD4(sc, GPIO_FALLINGDETECT);
+	if ((irqmode & GPIO_INTR_NEG_EDGE) != 0 ||
+	(irqmode & GPIO_INTR_DOUBLE_EDGE) != 0)
+		val |= pin_mask;
+	else
+		val &= ~pin_mask;
+	WR4(sc, GPIO_FALLINGDETECT, val);
+
+	/* Enable interrupts */
+	if (sc->sc_type == TI_GPIO_OMAP3) {
+		val = RD4(sc, GPIO_IRQENABLE1);
+		WR4(sc, GPIO_IRQENABLE1, val | pin_mask);
+	} else {
+		WR4(sc, GPIO_IRQENABLE1_SET, pin_mask);
+	}
+
+	mutex_exit(>sc_lock);
+	
+	return >sc_intr[pin];
+}
+
+static void
+ti_gpio_gp_intr_disestablish(void *vsc, void *ih)
+{
+	struct ti_gpio_softc * const sc = vsc;
+	struct ti_gpio_intr * const intr = ih;
+
+	ti_gpio_intr_disable(sc, intr);
+}
+
+static bool
+ti_gpio_gp_intrstr(void *vsc, int pin, int irqmode, char *buf, size_t buflen)
+{
+	struct ti_gpio_softc * const sc = vsc;
+
+	if (pin < 0 || pin >= TI_GPIO_NPINS)
+		return false;
+
+	snprintf(buf, buflen, "%s pin %d", sc->sc_modname, pin);
+	return true;
+}
+
 static void
 ti_gpio_attach_ports(struct ti_gpio_softc *sc)
 {
@@ -434,10 +542,17 @@ ti_gpio_attach_ports(struct ti_gpio_soft
 	gp->gp_pin_read = ti_gpio_pin_read;
 	gp->gp_pin_write = ti_gpio_pin_write;
 	gp->gp_pin_ctl = ti_gpio_pin_ctl;
+	gp->gp_intr_establish = ti_gpio_gp_intr_establish;
+	gp->gp_intr_disestablish = ti_gpio_gp_intr_disestablish;
+	

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

2024-04-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Apr  1 15:52:08 UTC 2024

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c

Log Message:
ti_gpio: add gpio(4) interrupt support

tested with gpiopps(4) on Beagle Bone Black


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/ti/ti_gpio.c

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



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

2024-02-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Feb 24 12:04:16 UTC 2024

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_rtc.c

Log Message:
Declare dt variable in PXARTC_DEBUG guarded blocks, since declarations were
removed in general one (likely as unused).

Fix dt.dt_year format specifier from %02d to expected %02lld.

Pass ch (todr_chip_handle_t), not sc (pxartc_softc) to rtc_wristwatch_gettime().

Fixes PXARTC_DEBUG enabled build (tested on zaurus).


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

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

Modified files:

Index: src/sys/arch/arm/xscale/pxa2x0_rtc.c
diff -u src/sys/arch/arm/xscale/pxa2x0_rtc.c:1.7 src/sys/arch/arm/xscale/pxa2x0_rtc.c:1.8
--- src/sys/arch/arm/xscale/pxa2x0_rtc.c:1.7	Thu Jan  2 22:27:15 2020
+++ src/sys/arch/arm/xscale/pxa2x0_rtc.c	Sat Feb 24 12:04:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_rtc.c,v 1.7 2020/01/02 22:27:15 thorpej Exp $	*/
+/*	$NetBSD: pxa2x0_rtc.c,v 1.8 2024/02/24 12:04:16 andvar Exp $	*/
 
 /*
  * Copyright (c) 2007 NONAKA Kimihiro 
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_rtc.c,v 1.7 2020/01/02 22:27:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_rtc.c,v 1.8 2024/02/24 12:04:16 andvar Exp $");
 
 #include 
 #include 
@@ -123,10 +123,11 @@ pxartc_todr_gettime(todr_chip_handle_t c
 	tv->tv_sec = bus_space_read_4(sc->sc_iot, sc->sc_ioh, RTC_RCNR);
 	tv->tv_usec = 0;
 #ifdef PXARTC_DEBUG
+	struct clock_ymdhms dt;
 	DPRINTF(("%s: RCNR = %08llx\n", device_xname(sc->sc_dev),
 	tv->tv_sec));
 	clock_secs_to_ymdhms(tv->tv_sec, );
-	DPRINTF(("%s: %02d/%02d/%02d %02d:%02d:%02d\n",
+	DPRINTF(("%s: %02lld/%02d/%02d %02d:%02d:%02d\n",
 	device_xname(sc->sc_dev),
 	dt.dt_year, dt.dt_mon, dt.dt_day,
 	dt.dt_hour, dt.dt_min, dt.dt_sec));
@@ -140,10 +141,11 @@ pxartc_todr_settime(todr_chip_handle_t c
 	struct pxartc_softc *sc = ch->cookie;
 
 #ifdef PXARTC_DEBUG
+	struct clock_ymdhms dt;
 	DPRINTF(("%s: RCNR = %08llx\n", device_xname(sc->sc_dev),
 	tv->tv_sec));
 	clock_secs_to_ymdhms(tv->tv_sec, );
-	DPRINTF(("%s: %02d/%02d/%02d %02d:%02d:%02d\n",
+	DPRINTF(("%s: %02lld/%02d/%02d %02d:%02d:%02d\n",
 	device_xname(sc->sc_dev),
 	dt.dt_year, dt.dt_mon, dt.dt_day,
 	dt.dt_hour, dt.dt_min, dt.dt_sec));
@@ -157,7 +159,7 @@ pxartc_todr_settime(todr_chip_handle_t c
 		DPRINTF(("%s: new RCNR = %08x\n", device_xname(sc->sc_dev),
 		cntr));
 		clock_secs_to_ymdhms(cntr, );
-		DPRINTF(("%s: %02d/%02d/%02d %02d:%02d:%02d\n",
+		DPRINTF(("%s: %02lld/%02d/%02d %02d:%02d:%02d\n",
 		device_xname(sc->sc_dev),
 		dt.dt_year, dt.dt_mon, dt.dt_day,
 		dt.dt_hour, dt.dt_min, dt.dt_sec));
@@ -191,7 +193,7 @@ pxartc_wristwatch_gettime(todr_chip_hand
 	dt->dt_mon = (yearr >> RYCR_MONTH_SHIFT) & RYCR_MONTH_MASK;
 	dt->dt_year = (yearr >> RYCR_YEAR_SHIFT) & RYCR_YEAR_MASK;
 
-	DPRINTF(("%s: %02d/%02d/%02d %02d:%02d:%02d\n",
+	DPRINTF(("%s: %02lld/%02d/%02d %02d:%02d:%02d\n",
 	device_xname(sc->sc_dev),
 	dt->dt_year, dt->dt_mon, dt->dt_day,
 	dt->dt_hour, dt->dt_min, dt->dt_sec));
@@ -210,7 +212,7 @@ pxartc_wristwatch_settime(todr_chip_hand
 	DPRINTF(("%s: pxartc_wristwatch_settime()\n",
 		 device_xname(sc->sc_dev)));
 
-	DPRINTF(("%s: %02d/%02d/%02d %02d:%02d:%02d\n",
+	DPRINTF(("%s: %02lld/%02d/%02d %02d:%02d:%02d\n",
 	device_xname(sc->sc_dev),
 	dt->dt_year, dt->dt_mon, dt->dt_day,
 	dt->dt_hour, dt->dt_min, dt->dt_sec));
@@ -242,7 +244,7 @@ pxartc_wristwatch_settime(todr_chip_hand
 #ifdef PXARTC_DEBUG
 	{
 		struct clock_ymdhms dummy;
-		pxartc_wristwatch_gettime(sc, );
+		pxartc_wristwatch_gettime(ch, );
 	}
 #endif
 



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

2024-02-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Feb 24 12:04:16 UTC 2024

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_rtc.c

Log Message:
Declare dt variable in PXARTC_DEBUG guarded blocks, since declarations were
removed in general one (likely as unused).

Fix dt.dt_year format specifier from %02d to expected %02lld.

Pass ch (todr_chip_handle_t), not sc (pxartc_softc) to rtc_wristwatch_gettime().

Fixes PXARTC_DEBUG enabled build (tested on zaurus).


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

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



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

2024-02-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb 18 10:49:43 UTC 2024

Modified Files:
src/sys/arch/arm/conf: Makefile.arm

Log Message:
if we're building with GCC and MACHINE_CPU is aarch64, error out since
that isn't going to work.

doing this better in config(1) is difficult, but at least we can
detect and give a useful error message for this case instead of just
erroring out with some compiler options aren't supported.  if we have
a good solution for config(1) we can remove this hack here..

might want to copy this hack for riscv too.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/arm/conf/Makefile.arm

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

Modified files:

Index: src/sys/arch/arm/conf/Makefile.arm
diff -u src/sys/arch/arm/conf/Makefile.arm:1.57 src/sys/arch/arm/conf/Makefile.arm:1.58
--- src/sys/arch/arm/conf/Makefile.arm:1.57	Fri Jul 28 02:41:30 2023
+++ src/sys/arch/arm/conf/Makefile.arm	Sun Feb 18 10:49:43 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.arm,v 1.57 2023/07/28 02:41:30 rin Exp $
+#	$NetBSD: Makefile.arm,v 1.58 2024/02/18 10:49:43 mrg Exp $
 
 # Makefile for NetBSD
 #
@@ -21,6 +21,11 @@ USETOOLS?=	no
 NEED_OWN_INSTALL_TARGET?=no
 .include 
 
+.if ${MACHINE_CPU} == "aarch64" && ${HAVE_GCC} != "no"
+. info (Building GENERIC instead of GENERIC64?)
+. error Don't build 32-bit kernel with 64-bit toolchain
+.endif
+
 ##
 ## (1) port identification
 ##



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

2024-02-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb 18 10:49:43 UTC 2024

Modified Files:
src/sys/arch/arm/conf: Makefile.arm

Log Message:
if we're building with GCC and MACHINE_CPU is aarch64, error out since
that isn't going to work.

doing this better in config(1) is difficult, but at least we can
detect and give a useful error message for this case instead of just
erroring out with some compiler options aren't supported.  if we have
a good solution for config(1) we can remove this hack here..

might want to copy this hack for riscv too.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/arm/conf/Makefile.arm

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



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:40:09 UTC 2024

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

Log Message:
Test sc->sc_soft_ih (not sc->sc_ih) to see if the soft interrupt got
established correctly.

>From Mori Hiroki.

Fix some error recovery while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/broadcom/bcm53xx_eth.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.43 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.44
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.43	Fri Feb 16 12:08:29 2024
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Fri Feb 16 15:40:09 2024
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.43 2024/02/16 12:08:29 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.44 2024/02/16 15:40:09 skrll Exp $");
 
 #include 
 #include 
@@ -344,16 +344,15 @@ bcmeth_ccb_attach(device_t parent, devic
 	(PRI_USER + MAXPRI_USER) / 2, IPL_NET, WQ_MPSAFE|WQ_PERCPU);
 	if (error) {
 		aprint_error(": failed to create workqueue: %d\n", error);
-		goto fail_2;
+		goto fail_1;
 	}
 
 	sc->sc_soft_ih = softint_establish(SOFTINT_MPSAFE | SOFTINT_NET,
 	bcmeth_soft_intr, sc);
 
-	if (sc->sc_ih == NULL) {
-		aprint_error_dev(self, "failed to establish interrupt %d\n",
-		 loc->loc_intrs[0]);
-		goto fail_3;
+	if (sc->sc_soft_ih == NULL) {
+		aprint_error_dev(self, "failed to establish soft interrupt\n");
+		goto fail_2;
 	}
 
 	sc->sc_ih = intr_establish(loc->loc_intrs[0], IPL_VM, IST_LEVEL,
@@ -362,7 +361,7 @@ bcmeth_ccb_attach(device_t parent, devic
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
 		 loc->loc_intrs[0]);
-		goto fail_4;
+		goto fail_3;
 	} else {
 		aprint_normal_dev(self, "interrupting on irq %d\n",
 		 loc->loc_intrs[0]);
@@ -426,8 +425,6 @@ bcmeth_ccb_attach(device_t parent, devic
 
 	return;
 
-fail_4:
-	intr_disestablish(sc->sc_ih);
 fail_3:
 	softint_disestablish(sc->sc_soft_ih);
 fail_2:



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:40:09 UTC 2024

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

Log Message:
Test sc->sc_soft_ih (not sc->sc_ih) to see if the soft interrupt got
established correctly.

>From Mori Hiroki.

Fix some error recovery while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/broadcom/bcm53xx_eth.c

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



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:11:38 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc.c bcm2835_vcaudio.c
bcm2838_pcie.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/broadcom/bcm2835_bsc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/broadcom/bcm2838_pcie.c

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



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:11:38 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc.c bcm2835_vcaudio.c
bcm2838_pcie.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/broadcom/bcm2835_bsc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/broadcom/bcm2838_pcie.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_bsc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.15 src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.16
--- src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.15	Tue Mar 31 12:23:17 2020
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c	Fri Feb 16 15:11:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_bsc.c,v 1.16 2024/02/16 15:11:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2019 Jason R. Thorpe
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.16 2024/02/16 15:11:38 skrll Exp $");
 
 #include 
 #include 
@@ -203,7 +203,7 @@ bsciic_next_state(struct bsciic_softc * 
 	case BSC_EXEC_STATE_SEND_DATA:
 	case BSC_EXEC_STATE_RECV_DATA:
 		return BSC_EXEC_STATE_DONE;
-	
+
 	case BSC_EXEC_STATE_DONE:
 	case BSC_EXEC_STATE_ERROR:
 		return sc->sc_exec_state;

Index: src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.19 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.20
--- src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.19	Sun Apr 30 14:20:23 2023
+++ src/sys/arch/arm/broadcom/bcm2835_vcaudio.c	Fri Feb 16 15:11:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_vcaudio.c,v 1.19 2023/04/30 14:20:23 mlelstv Exp $ */
+/* $NetBSD: bcm2835_vcaudio.c,v 1.20 2024/02/16 15:11:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.19 2023/04/30 14:20:23 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.20 2024/02/16 15:11:38 skrll Exp $");
 
 #include 
 #include 
@@ -88,7 +88,7 @@ enum vcaudio_dest {
  *
  * Setting blocksize to 4 x 1600 means that we send approx 33ms of audio. We
  * prefill by two blocks before starting audio meaning we have 50ms of latency.
- * 
+ *
  * Six messages of 1600 bytes was chosen working back from a desired latency of
  * 50ms.
  */

Index: src/sys/arch/arm/broadcom/bcm2838_pcie.c
diff -u src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.6 src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.7
--- src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.6	Sat Oct 15 11:07:38 2022
+++ src/sys/arch/arm/broadcom/bcm2838_pcie.c	Fri Feb 16 15:11:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $ */
+/*	$NetBSD: bcm2838_pcie.c,v 1.7 2024/02/16 15:11:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.7 2024/02/16 15:11:38 skrll Exp $");
 
 #include 
 #include 
@@ -417,7 +417,7 @@ bcmstb_setwin(struct bcmstb_softc *sc, i
 	STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI(win),
 	PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE,
 	__SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE));
-	
+
 	STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI(win),
 	PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT,
 	__SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT));



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:11:17 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_board.c bcm53xx_cca.c bcm53xx_idm.c
bcm53xx_pax.c bcm53xx_reg.h

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/broadcom/bcm53xx_board.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/broadcom/bcm53xx_cca.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm53xx_idm.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/broadcom/bcm53xx_pax.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/broadcom/bcm53xx_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/arm/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.25 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.26
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.25	Tue Jul 31 06:46:25 2018
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Fri Feb 16 15:11:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.25 2018/07/31 06:46:25 skrll Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.26 2024/02/16 15:11:17 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.25 2018/07/31 06:46:25 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.26 2024/02/16 15:11:17 skrll Exp $");
 
 #include 
 #include 
@@ -328,7 +328,7 @@ bcm53xx_usb_clock_init(struct bcm53xx_cl
 	const uint32_t ndiv = bcm53xx_value_wrap(usb2_control,
 	USB2_CONTROL_NDIV_INT);
 
-	uint32_t usb_ref = (clk->clk_usb2 / pdiv) * ndiv; 
+	uint32_t usb_ref = (clk->clk_usb2 / pdiv) * ndiv;
 	if (usb_ref != USB2_REF_CLK) {
 		/*
 		 * USB Reference Clock isn't 1.92GHz.  So we need to modify
@@ -350,7 +350,7 @@ bcm53xx_usb_clock_init(struct bcm53xx_cl
 		bus_space_write_4(bcm53xx_ioreg_bst, bcm53xx_ioreg_bsh,
 		CRU_BASE + CRU_CLKSET_KEY, 0);
 
-		usb_ref = (clk->clk_usb2 / pdiv) * new_ndiv; 
+		usb_ref = (clk->clk_usb2 / pdiv) * new_ndiv;
 	}
 
 	clk->clk_usb_ref = usb_ref;
@@ -367,7 +367,7 @@ bcm53xx_clock_init(struct bcm53xx_clock_
 /*
  * F(ddr) = ((1 / pdiv) * ndiv * CH2) / (post_div * 2)
  */
-static void 
+static void
 bcm53xx_get_ddr_freq(struct bcm53xx_clock_info *clk, uint32_t pll_status,
 uint32_t pll_dividers)
 {
@@ -402,7 +402,7 @@ bcm53xx_get_cpu_freq(struct bcm53xx_cloc
 		clk->clk_apb = clk->clk_cpu / 4;
 		return;
 	}
-		
+
 	const u_int pdiv = bcm53xx_value_wrap(pllarma, CLK_PLLARMA_PDIV);
 	const u_int ndiv_int = bcm53xx_value_wrap(pllarma, CLK_PLLARMA_NDIV_INT);
 	const u_int ndiv_frac = __SHIFTOUT(pllarmb, CLK_PLLARMB_NDIV_FRAC);
@@ -605,13 +605,13 @@ bcm53xx_device_register(device_t self, v
 		 * XXX KLUDGE ALERT XXX
 		 * The iot mainbus supplies is completely wrong since it scales
 		 * addresses by 2.  The simplest remedy is to replace with our
-		 * bus space used for the armcore registers (which armperiph uses). 
+		 * bus space used for the armcore registers (which armperiph uses).
 		 */
 		struct mainbus_attach_args * const mb = aux;
 		mb->mb_iot = bcm53xx_armcore_bst;
 		return;
 	}
- 
+
 	/*
 	 * We need to tell the A9 Global/Watchdog Timer
 	 * what frequency it runs at.
@@ -649,8 +649,8 @@ bcm53xx_srab_init(void)
 {
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 
-	bcm53xx_srab_write_4(0x0079, 0x90);	// reset switch 
-	for (u_int port = 0; port < 8; port++) {
+	bcm53xx_srab_write_4(0x0079, 0x90);	// reset switch
+	for (u_int port = 0; port < 8; port++) {
 		/* per port control: no stp */
 		bcm53xx_srab_write_4(port, 0x00);
 	}

Index: src/sys/arch/arm/broadcom/bcm53xx_cca.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_cca.c:1.5 src/sys/arch/arm/broadcom/bcm53xx_cca.c:1.6
--- src/sys/arch/arm/broadcom/bcm53xx_cca.c:1.5	Thu Mar  3 06:26:28 2022
+++ src/sys/arch/arm/broadcom/bcm53xx_cca.c	Fri Feb 16 15:11:17 2024
@@ -43,7 +43,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_cca.c,v 1.5 2022/03/03 06:26:28 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_cca.c,v 1.6 2024/02/16 15:11:17 skrll Exp $");
 
 #include 
 #include 
@@ -143,7 +143,7 @@ bcmcca_intr(void *arg)
 		}
 	}
 	if (v & INTSTATUS_GPIOINT) {
-		
+
 	}
 	return rv;
 }

Index: src/sys/arch/arm/broadcom/bcm53xx_idm.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_idm.c:1.3 src/sys/arch/arm/broadcom/bcm53xx_idm.c:1.4
--- src/sys/arch/arm/broadcom/bcm53xx_idm.c:1.3	Wed Dec 12 00:01:28 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_idm.c	Fri Feb 16 15:11:17 2024
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_idm.c,v 1.3 2012/12/12 00:01:28 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_idm.c,v 1.4 2024/02/16 15:11:17 skrll Exp $");
 
 #include 
 #include 
@@ -59,7 +59,7 @@ struct idm_info {
 static bool
 bcmeth_unreset(bus_space_tag_t bst, bus_space_handle_t bsh,
 const struct idm_info *idm)
-{ 
+{
 	/*
 	 * To 

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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 15:11:17 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_board.c bcm53xx_cca.c bcm53xx_idm.c
bcm53xx_pax.c bcm53xx_reg.h

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/broadcom/bcm53xx_board.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/broadcom/bcm53xx_cca.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm53xx_idm.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/broadcom/bcm53xx_pax.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/broadcom/bcm53xx_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/arm/broadcom

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 12:08:29 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_eth.c bcm53xx_pax.c

Log Message:
Fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/broadcom/bcm53xx_pax.c

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



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

2024-02-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 16 12:08:29 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_eth.c bcm53xx_pax.c

Log Message:
Fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/broadcom/bcm53xx_eth.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/broadcom/bcm53xx_pax.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.43
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.42	Sat Sep 17 19:41:18 2022
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Fri Feb 16 12:08:29 2024
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.42 2022/09/17 19:41:18 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.43 2024/02/16 12:08:29 skrll Exp $");
 
 #include 
 #include 
@@ -252,9 +252,7 @@ bcmeth_ccb_match(device_t parent, cfdata
 	if (strcmp(cf->cf_name, loc->loc_name))
 		return 0;
 
-#ifdef DIAGNOSTIC
-	const int port = cf->cf_loc[BCMCCBCF_PORT];
-#endif
+	const int port __diagused = cf->cf_loc[BCMCCBCF_PORT];
 	KASSERT(port == BCMCCBCF_PORT_DEFAULT || port == loc->loc_port);
 
 	return 1;

Index: src/sys/arch/arm/broadcom/bcm53xx_pax.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.22 src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.23
--- src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.22	Sat Aug  7 16:18:43 2021
+++ src/sys/arch/arm/broadcom/bcm53xx_pax.c	Fri Feb 16 12:08:29 2024
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.22 2021/08/07 16:18:43 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.23 2024/02/16 12:08:29 skrll Exp $");
 
 #include 
 #include 
@@ -136,9 +136,7 @@ bcmpax_ccb_match(device_t parent, cfdata
 	if (strcmp(cf->cf_name, loc->loc_name))
 		return 0;
 
-#ifdef DIAGNOSTIC
-	const int port = cf->cf_loc[BCMCCBCF_PORT];
-#endif
+	const int port __diagused = cf->cf_loc[BCMCCBCF_PORT];
 	KASSERT(port == BCMCCBCF_PORT_DEFAULT || port == loc->loc_port);
 
 	return 1;



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 20:35:23 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: vm_machdep.c

Log Message:
Include  with "#ifdef STACKCHECKS" guard.

The include was lost on rev 1.77 during includes cleanup and KNF, however
it is still needed with STACKCHECKS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/arm32/vm_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/arm/arm32/vm_machdep.c
diff -u src/sys/arch/arm/arm32/vm_machdep.c:1.78 src/sys/arch/arm/arm32/vm_machdep.c:1.79
--- src/sys/arch/arm/arm32/vm_machdep.c:1.78	Sun Mar 28 10:29:05 2021
+++ src/sys/arch/arm/arm32/vm_machdep.c	Mon Jan 15 20:35:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.79 2024/01/15 20:35:22 andvar Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.79 2024/01/15 20:35:22 andvar Exp $");
 
 #include "opt_armfpe.h"
 #include "opt_cputypes.h"
@@ -55,6 +55,9 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c
 #include 
 #include 
 #include 
+#ifdef STACKCHECKS
+#include 
+#endif
 #include 
 #include 
 



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 20:35:23 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: vm_machdep.c

Log Message:
Include  with "#ifdef STACKCHECKS" guard.

The include was lost on rev 1.77 during includes cleanup and KNF, however
it is still needed with STACKCHECKS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/arm32/vm_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/arm/arm

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 19:34:13 UTC 2024

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

Log Message:
Replace format specifier from %08x to PRId64 for bp->blkno.
Exchange incorrectly placed printf() __func__ and loop arguments.

Fixes DEBUG_LABEL enabled build for acorn32.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm/disksubr_acorn.c

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

Modified files:

Index: src/sys/arch/arm/arm/disksubr_acorn.c
diff -u src/sys/arch/arm/arm/disksubr_acorn.c:1.13 src/sys/arch/arm/arm/disksubr_acorn.c:1.14
--- src/sys/arch/arm/arm/disksubr_acorn.c:1.13	Tue Sep 29 02:58:52 2020
+++ src/sys/arch/arm/arm/disksubr_acorn.c	Mon Jan 15 19:34:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr_acorn.c,v 1.13 2020/09/29 02:58:52 msaitoh Exp $	*/
+/*	$NetBSD: disksubr_acorn.c,v 1.14 2024/01/15 19:34:13 andvar Exp $	*/
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr_acorn.c,v 1.13 2020/09/29 02:58:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr_acorn.c,v 1.14 2024/01/15 19:34:13 andvar Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ filecore_label_read(dev_t dev, void (*st
 
 		bp->b_blkno = cyl * heads * sectors;
 #ifdef DEBUG_LABEL
-		printf("%s: Found RiscIX partition table @ %08x\n",
+		printf("%s: Found RiscIX partition table @ %" PRId64 "\n",
 		__func__, bp->b_blkno);
 #endif
 		bp->b_cylinder = bp->b_blkno / lp->d_secpercyl;
@@ -277,8 +277,8 @@ filecore_label_read(dev_t dev, void (*st
 		rpt = (struct riscix_partition_table *)bp->b_data;
 #ifdef DEBUG_LABEL
 		for (loop = 0; loop < NRISCIX_PARTITIONS; ++loop)
-			printf("%s: p%d: %16s %08x %08x %08x\n", loop,
-			__func__, rpt->partitions[loop].rp_name,
+			printf("%s: p%d: %16s %08x %08x %08x\n", __func__,
+			loop, rpt->partitions[loop].rp_name,
 			rpt->partitions[loop].rp_start,
 			rpt->partitions[loop].rp_length,
 			rpt->partitions[loop].rp_type);



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 19:34:13 UTC 2024

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

Log Message:
Replace format specifier from %08x to PRId64 for bp->blkno.
Exchange incorrectly placed printf() __func__ and loop arguments.

Fixes DEBUG_LABEL enabled build for acorn32.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm/disksubr_acorn.c

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



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 17:29:27 UTC 2024

Modified Files:
src/sys/arch/arm/imx: imx23_usb.c

Log Message:
Fix imx23_usb_init() function declaration, it expects two parameters.

Fixes build for IMX23_OLINUXINO kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx23_usb.c

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

Modified files:

Index: src/sys/arch/arm/imx/imx23_usb.c
diff -u src/sys/arch/arm/imx/imx23_usb.c:1.6 src/sys/arch/arm/imx/imx23_usb.c:1.7
--- src/sys/arch/arm/imx/imx23_usb.c:1.6	Thu May  4 17:09:44 2023
+++ src/sys/arch/arm/imx/imx23_usb.c	Mon Jan 15 17:29:27 2024
@@ -1,4 +1,4 @@
-/* $Id: imx23_usb.c,v 1.6 2023/05/04 17:09:44 bouyer Exp $ */
+/* $Id: imx23_usb.c,v 1.7 2024/01/15 17:29:27 andvar Exp $ */
 
 /*
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@ static void	imx23_usb_attach(device_t, d
 static int	imx23_usb_activate(device_t, enum devact);
 
 static int  imxusbc_search(device_t, cfdata_t, const int *, void *);
-static void	imx23_usb_init(struct imxehci_softc *);
+static void	imx23_usb_init(struct imxehci_softc *, uintptr_t);
 
 CFATTACH_DECL3_NEW(imxusbc,
 sizeof(struct imx23_usb_softc),



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 17:29:27 UTC 2024

Modified Files:
src/sys/arch/arm/imx: imx23_usb.c

Log Message:
Fix imx23_usb_init() function declaration, it expects two parameters.

Fixes build for IMX23_OLINUXINO kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx23_usb.c

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



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

2024-01-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 12 11:24:48 UTC 2024

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Trailing whitespace.


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

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

Modified files:

Index: src/sys/arch/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.32 src/sys/arch/arm/fdt/pcihost_fdt.c:1.33
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.32	Sat Oct 15 11:07:38 2022
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Fri Jan 12 11:24:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.32 2022/10/15 11:07:38 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.33 2024/01/12 11:24:48 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.32 2022/10/15 11:07:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.33 2024/01/12 11:24:48 skrll Exp $");
 
 #include 
 
@@ -506,8 +506,8 @@ pcihost_intr_map(const struct pci_attach
 	index = 0;
 	while (imaplen >= 20) {
 		const int map_ihandle = fdtbus_get_phandle_from_native(be32toh(imap[4]));
-	if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
-	addr_cells = 2;
+		if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
+			addr_cells = 2;
 		if (of_getprop_uint32(map_ihandle, "#interrupt-cells", _cells))
 			interrupt_cells = 0;
 		if (imaplen < (addr_cells + interrupt_cells) * 4)
@@ -542,8 +542,8 @@ pcihost_find_intr(struct pcihost_softc *
 	index = 0;
 	while (imaplen >= 20) {
 		const int map_ihandle = fdtbus_get_phandle_from_native(be32toh(imap[4]));
-	if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
-	addr_cells = 2;
+		if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
+			addr_cells = 2;
 		if (of_getprop_uint32(map_ihandle, "#interrupt-cells", _cells))
 			interrupt_cells = 0;
 		if (imaplen < (addr_cells + interrupt_cells) * 4)



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

2024-01-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 12 11:24:48 UTC 2024

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Trailing whitespace.


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

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



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

2023-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 31 09:45:58 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/rockchip/rk_gmac.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_gmac.c
diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.21 src/sys/arch/arm/rockchip/rk_gmac.c:1.22
--- src/sys/arch/arm/rockchip/rk_gmac.c:1.21	Fri Nov 12 22:02:08 2021
+++ src/sys/arch/arm/rockchip/rk_gmac.c	Sun Dec 31 09:45:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.21 2021/11/12 22:02:08 jmcneill Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.22 2023/12/31 09:45:58 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.21 2021/11/12 22:02:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.22 2023/12/31 09:45:58 skrll Exp $");
 
 #include 
 #include 
@@ -370,7 +370,7 @@ rk_gmac_setup_clocks(int phandle)
 	static const char * const clknames[] = {
 #if 0
 		"stmmaceth",
-		"mac_clk_rx", 
+		"mac_clk_rx",
 		"mac_clk_tx",
 		"clk_mac_ref",
 		"clk_mac_refout",



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

2023-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 31 09:45:58 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/rockchip/rk_gmac.c

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



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

2023-12-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 27 07:46:21 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/rockchip/rk3399_pcie.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3399_pcie.c
diff -u src/sys/arch/arm/rockchip/rk3399_pcie.c:1.20 src/sys/arch/arm/rockchip/rk3399_pcie.c:1.21
--- src/sys/arch/arm/rockchip/rk3399_pcie.c:1.20	Sun Mar 26 19:10:33 2023
+++ src/sys/arch/arm/rockchip/rk3399_pcie.c	Wed Dec 27 07:46:20 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_pcie.c,v 1.20 2023/03/26 19:10:33 andvar Exp $ */
+/* $NetBSD: rk3399_pcie.c,v 1.21 2023/12/27 07:46:20 skrll Exp $ */
 /*
  * Copyright (c) 2018 Mark Kettenis 
  *
@@ -17,7 +17,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.20 2023/03/26 19:10:33 andvar Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie.c,v 1.21 2023/12/27 07:46:20 skrll Exp $");
 
 #include 
 #include 
@@ -249,7 +249,7 @@ rkpcie_attach(device_t parent, device_t 
 		fdtbus_regulator_enable(regulator);
 		fdtbus_regulator_release(regulator);
 	}
-		
+
 	fdtbus_clock_assign(phandle);
 	clock_enable_all(phandle);
 
@@ -301,7 +301,7 @@ again:
 
 	delay(1000);	/* TPERST. use 1ms */
 	delayed_ms += 1;
-	
+
 	reset_deassert(phandle, "pm");
 	reset_deassert(phandle, "aclk");
 	reset_deassert(phandle, "pclk");



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

2023-12-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 27 07:46:21 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/rockchip/rk3399_pcie.c

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



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

2023-12-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 13 06:42:41 UTC 2023

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

Log Message:
arm: pmap: Fix clang build without DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.440 -r1.441 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.440 src/sys/arch/arm/arm32/pmap.c:1.441
--- src/sys/arch/arm/arm32/pmap.c:1.440	Thu Oct 12 11:33:37 2023
+++ src/sys/arch/arm/arm32/pmap.c	Wed Dec 13 06:42:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.440 2023/10/12 11:33:37 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.440 2023/10/12 11:33:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $");
 
 #include 
 #include 
@@ -547,7 +547,7 @@ pmap_release_page_lock(struct vm_page_md
 	mutex_exit(_lock);
 }
 
-static inline int
+static inline int __diagused
 pmap_page_locked_p(struct vm_page_md *md)
 {
 	return mutex_owned(_lock);



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

2023-12-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 13 06:42:41 UTC 2023

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

Log Message:
arm: pmap: Fix clang build without DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.440 -r1.441 src/sys/arch/arm/arm32/pmap.c

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



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

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

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

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_com.c
diff -u src/sys/arch/arm/broadcom/bcm2835_com.c:1.8 src/sys/arch/arm/broadcom/bcm2835_com.c:1.9
--- src/sys/arch/arm/broadcom/bcm2835_com.c:1.8	Fri Jan 29 14:11:14 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com.c	Mon Dec 11 12:53:08 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $ */
+/* $NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -123,7 +123,8 @@ bcm_com_attach(device_t parent, device_t
 		intrstr);
 		return;
 	}
-	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+	aprint_normal_dev(self, "interrupting on %s, clock %u Hz\n",
+	   intrstr, sc->sc_frequency);
 }
 
 static int



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

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

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

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.c

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



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

2023-11-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 25 20:17:52 UTC 2023

Modified Files:
src/sys/arch/arm/acpi: gic_acpi.c

Log Message:
gicv2: Fix truncation of GICC / GICD base addresses above 4GB.


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

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



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

2023-11-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 25 20:17:52 UTC 2023

Modified Files:
src/sys/arch/arm/acpi: gic_acpi.c

Log Message:
gicv2: Fix truncation of GICC / GICD base addresses above 4GB.


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

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

Modified files:

Index: src/sys/arch/arm/acpi/gic_acpi.c
diff -u src/sys/arch/arm/acpi/gic_acpi.c:1.7 src/sys/arch/arm/acpi/gic_acpi.c:1.8
--- src/sys/arch/arm/acpi/gic_acpi.c:1.7	Sat Aug  7 16:18:42 2021
+++ src/sys/arch/arm/acpi/gic_acpi.c	Sat Nov 25 20:17:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_acpi.c,v 1.7 2021/08/07 16:18:42 thorpej Exp $ */
+/* $NetBSD: gic_acpi.c,v 1.8 2023/11/25 20:17:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.7 2021/08/07 16:18:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.8 2023/11/25 20:17:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -102,8 +102,8 @@ gic_acpi_attach(device_t parent, device_
 		return;
 	}
 
-	const bus_addr_t addr = uimin(gicd->BaseAddress, gicc->BaseAddress);
-	const bus_size_t end = uimax(gicd->BaseAddress + GICD_SIZE, gicc->BaseAddress + GICC_SIZE);
+	const bus_addr_t addr = ulmin(gicd->BaseAddress, gicc->BaseAddress);
+	const bus_size_t end = ulmax(gicd->BaseAddress + GICD_SIZE, gicc->BaseAddress + GICC_SIZE);
 	const bus_size_t size = end - addr;
 
 	error = bus_space_map(_generic_bs_tag, addr, size, 0, );



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

2023-11-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Nov 11 17:35:45 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
gicv3_its: assorted minor improvements

- KASSERT that the command queue is not stalled due to async error
  before issuing more commands.
- implement gits_command_int under #if 0 (useful for troubleshooting)
- protect command queue with its_lock consistently
- KASSERT for 32-bit MSI that upper bits are 0
- KASSERT return value of gicv3_its_msi_alloc_lpi
- KASSERT that safe conditions for writing to CBASER are met
- move CWRITER initialization to before CBASER
- fix alignment of tables for the 16KB page size case


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/cortex/gicv3_its.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.34 src/sys/arch/arm/cortex/gicv3_its.c:1.35
--- src/sys/arch/arm/cortex/gicv3_its.c:1.34	Sun Oct 31 17:24:11 2021
+++ src/sys/arch/arm/cortex/gicv3_its.c	Sat Nov 11 17:35:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.34 2021/10/31 17:24:11 skrll Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.35 2023/11/11 17:35:45 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.34 2021/10/31 17:24:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.35 2023/11/11 17:35:45 tnn Exp $");
 
 #include 
 #include 
@@ -117,6 +117,11 @@ gits_command(struct gicv3_its *its, cons
 
 	cwriter = gits_read_8(its, GITS_CWRITER);
 	woff = cwriter & GITS_CWRITER_Offset;
+#ifdef DIAGNOSTIC
+	uint64_t creadr = gits_read_8(its, GITS_CREADR);
+	KASSERT(!ISSET(creadr, GITS_CREADR_Stalled));
+	KASSERT(((woff + sizeof(cmd->dw)) & (its->its_cmd.len - 1)) != (creadr & GITS_CREADR_Offset));
+#endif
 
 	uint64_t *dw = (uint64_t *)(its->its_cmd.base + woff);
 	for (int i = 0; i < __arraycount(cmd->dw); i++)
@@ -256,6 +261,26 @@ gits_command_sync(struct gicv3_its *its,
 	gits_command(its, );
 }
 
+#if 0
+static inline void
+gits_command_int(struct gicv3_its *its, uint32_t deviceid, uint32_t eventid)
+{
+	struct gicv3_its_command cmd;
+
+	/*
+	 * Translate the deviceid and eventid into an icid and pintid through
+	 * the device table and ITT. Mark the pintid as pending
+	 * on the redistributor.
+	 * If the interrupt is not configured the command queue stalls.
+	 */
+	memset(, 0, sizeof(cmd));
+	cmd.dw[0] = GITS_CMD_INT | ((uint64_t)deviceid << 32);
+	cmd.dw[1] = eventid;
+
+	gits_command(its, );
+}
+#endif
+
 static inline int
 gits_wait(struct gicv3_its *its)
 {
@@ -358,8 +383,10 @@ gicv3_its_device_map(struct gicv3_its *i
 	 * Map the device to the ITT
 	 */
 	const u_int id_bits = __SHIFTOUT(typer, GITS_TYPER_ID_bits) + 1;
+	mutex_enter(its->its_lock);
 	gits_command_mapd(its, devid, dev->dev_itt.segs[0].ds_addr, id_bits - 1, true);
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	return 0;
 }
@@ -391,6 +418,7 @@ gicv3_its_msi_enable(struct gicv3_its *i
 		pci_conf_write(pc, tag, off + PCI_MSI_MDATA64,
 		lpi - its->its_pic->pic_irqbase);
 	} else {
+		KASSERT((addr >> 32) == 0);
 		pci_conf_write(pc, tag, off + PCI_MSI_MADDR,
 		addr & 0x);
 		pci_conf_write(pc, tag, off + PCI_MSI_MDATA,
@@ -485,8 +513,10 @@ gicv3_its_msi_alloc(struct arm_pci_msi *
 		return NULL;
 
 	vectors = kmem_alloc(sizeof(*vectors) * *count, KM_SLEEP);
+	mutex_enter(its->its_lock);
 	for (n = 0; n < *count; n++) {
 		const int lpi = gicv3_its_msi_alloc_lpi(its, pa);
+		KASSERT(lpi >= 0);
 		vectors[n] = ARM_PCI_INTR_MSI |
 		__SHIFTIN(lpi, ARM_PCI_INTR_IRQ) |
 		__SHIFTIN(n, ARM_PCI_INTR_MSI_VEC) |
@@ -508,6 +538,7 @@ gicv3_its_msi_alloc(struct arm_pci_msi *
 		gits_command_sync(its, its->its_rdbase[cpu_index(ci)]);
 	}
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	return vectors;
 }
@@ -555,8 +586,10 @@ gicv3_its_msix_alloc(struct arm_pci_msi 
 	}
 
 	vectors = kmem_alloc(sizeof(*vectors) * *count, KM_SLEEP);
+	mutex_enter(its->its_lock);
 	for (n = 0; n < *count; n++) {
 		const int lpi = gicv3_its_msi_alloc_lpi(its, pa);
+		KASSERT(lpi >= 0);
 		const int msix_vec = table_indexes ? table_indexes[n] : n;
 		vectors[msix_vec] = ARM_PCI_INTR_MSIX |
 		__SHIFTIN(lpi, ARM_PCI_INTR_IRQ) |
@@ -578,6 +611,7 @@ gicv3_its_msix_alloc(struct arm_pci_msi 
 		gits_command_sync(its, its->its_rdbase[cpu_index(ci)]);
 	}
 	gits_wait(its);
+	mutex_exit(its->its_lock);
 
 	bus_space_unmap(bst, bsh, bsz);
 
@@ -638,14 +672,17 @@ gicv3_its_command_init(struct gicv3_soft
 
 	gicv3_dma_alloc(sc, >its_cmd, GITS_COMMANDS_SIZE, GITS_COMMANDS_ALIGN);
 
+	KASSERT((gits_read_4(its, GITS_CTLR) & GITS_CTLR_Enabled) == 0);
+	KASSERT((gits_read_4(its, GITS_CTLR) & GITS_CTLR_Quiescent) != 0);
+
 	cbaser = its->its_cmd.segs[0].ds_addr;
 	cbaser |= 

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

2023-11-11 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Nov 11 17:35:45 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
gicv3_its: assorted minor improvements

- KASSERT that the command queue is not stalled due to async error
  before issuing more commands.
- implement gits_command_int under #if 0 (useful for troubleshooting)
- protect command queue with its_lock consistently
- KASSERT for 32-bit MSI that upper bits are 0
- KASSERT return value of gicv3_its_msi_alloc_lpi
- KASSERT that safe conditions for writing to CBASER are met
- move CWRITER initialization to before CBASER
- fix alignment of tables for the 16KB page size case


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/cortex/gicv3_its.c

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



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

2023-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Nov  7 13:31:26 UTC 2023

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

Log Message:
smccc: Adjust SMCCC_ARCH_ATTRIBUTE for clang/arm

Conditionally use

(1) __attribute__ ((target("arch=armv7ve")))
(2) __attribute__ ((target("armv7ve")))

for gcc and clang, respectively.

While gcc does not accept (2), clang accepts (1) but silently ignores it :(


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/smccc.c

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

Modified files:

Index: src/sys/arch/arm/arm/smccc.c
diff -u src/sys/arch/arm/arm/smccc.c:1.3 src/sys/arch/arm/arm/smccc.c:1.4
--- src/sys/arch/arm/arm/smccc.c:1.3	Sun Aug  8 13:43:09 2021
+++ src/sys/arch/arm/arm/smccc.c	Tue Nov  7 13:31:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $ */
+/* $NetBSD: smccc.c,v 1.4 2023/11/07 13:31:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.4 2023/11/07 13:31:26 rin Exp $");
 
 #include 
 #include 
@@ -36,7 +36,11 @@ __KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.
 #include 
 
 #if defined(__arm__)
+#  if defined(__clang__)
+#define	SMCCC_ARCH_ATTRIBUTE  __attribute__ ((target("armv7ve")))
+#  else /* gcc */
 #define	SMCCC_ARCH_ATTRIBUTE  __attribute__ ((target("arch=armv7ve")))
+#  endif
 #else
 #define	SMCCC_ARCH_ATTRIBUTE
 #endif



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

2023-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Nov  7 13:31:26 UTC 2023

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

Log Message:
smccc: Adjust SMCCC_ARCH_ATTRIBUTE for clang/arm

Conditionally use

(1) __attribute__ ((target("arch=armv7ve")))
(2) __attribute__ ((target("armv7ve")))

for gcc and clang, respectively.

While gcc does not accept (2), clang accepts (1) but silently ignores it :(


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/smccc.c

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

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

Log Message:
rk3588_cru: fix clock id for BIGCORE1


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

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3588_cru.c
diff -u src/sys/arch/arm/rockchip/rk3588_cru.c:1.1 src/sys/arch/arm/rockchip/rk3588_cru.c:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.c:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.c	Tue Oct 17 19:13:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $");
 
 #include 
 #include 
@@ -636,7 +636,7 @@ static struct rk_cru_clk rk3588_cru_clks
 	CLKSEL_CON(BIGCORE0, 1),	/* div1_reg */
 	__BITS(4,0),		/* div1_mask */
 	armclk_b01_rates),
-	RK_CPU_CORE2(RK3588_ARMCLK_B01, "armclk_b23", mux_armclkb23_parents,
+	RK_CPU_CORE2(RK3588_ARMCLK_B23, "armclk_b23", mux_armclkb23_parents,
 	CLKSEL_CON(BIGCORE1, 0),	/* reg */
 	__BITS(7,6), 2, 1,		/* mux_mask, mux_main, mux_alt */
 	CLKSEL_CON(BIGCORE1, 0),	/* div0_reg */
@@ -673,7 +673,6 @@ static struct rk_cru_clk rk3588_cru_clks
 	"armclk_b23",
 	CLKGATE_CON(BIGCORE1, 0), 13),
 
-
 	RK_COMPOSITE(RK3588_CLK_50M_SRC, "clk_50m_src",
 	gpll_cpll_parents,
 	CLKSEL_CON(0, 0), __BITS(5,5), __BITS(4,0),



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

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

Log Message:
rk3588_cru: fix clock id for BIGCORE1


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

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.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/arm/rockchip/rk3588_cru.h
diff -u src/sys/arch/arm/rockchip/rk3588_cru.h:1.1 src/sys/arch/arm/rockchip/rk3588_cru.h:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.h:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.h	Tue Oct 17 18:23:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.h,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.h,v 1.2 2023/10/17 18:23:55 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -28,727 +28,726 @@
 #ifndef _RK3588_CRU_H_
 #define _RK3588_CRU_H_
 
-#define RK3588_PLL_B0PLL			1
-#define RK3588_PLL_B1PLL			2
-#define RK3588_PLL_LPLL3
-#define RK3588_PLL_V0PLL			4
-#define RK3588_PLL_AUPLL			5
-#define RK3588_PLL_CPLL6
-#define RK3588_PLL_GPLL7
-#define RK3588_PLL_NPLL8
-#define RK3588_PLL_PPLL9
-#define RK3588_ARMCLK_L10
-#define RK3588_ARMCLK_B01			11
-#define RK3588_ARMCLK_B23			12
-/* 13 */
-/* 14 */
-/* 15 */
-/* 16 */
-/* 17 */
-/* 18 */
-/* 19 */
-#define RK3588_PCLK_BIGCORE0_ROOT		20
-#define RK3588_PCLK_BIGCORE0_PVTM		21
-#define RK3588_PCLK_BIGCORE1_ROOT		22
-#define RK3588_PCLK_BIGCORE1_PVTM		23
-#define RK3588_PCLK_DSU_S_ROOT			24
-#define RK3588_PCLK_DSU_ROOT			25
-#define RK3588_PCLK_DSU_NS_ROOT			26
-#define RK3588_PCLK_LITCORE_PVTM		27
-#define RK3588_PCLK_DBG28
-#define RK3588_PCLK_DSU29
-#define RK3588_PCLK_S_DAPLITE			30
-#define RK3588_PCLK_M_DAPLITE			31
-#define RK3588_MBIST_MCLK_PDM1			32
-#define RK3588_MBIST_CLK_ACDCDIG		33
-#define RK3588_HCLK_I2S2_2CH			34
-#define RK3588_HCLK_I2S3_2CH			35
-#define RK3588_CLK_I2S2_2CH_SRC			36
-#define RK3588_CLK_I2S2_2CH_FRAC		37
-#define RK3588_CLK_I2S2_2CH			38
-#define RK3588_MCLK_I2S2_2CH			39
-#define RK3588_I2S2_2CH_MCLKOUT			40
-#define RK3588_CLK_DAC_ACDCDIG			41
-#define RK3588_CLK_I2S3_2CH_SRC			42
-#define RK3588_CLK_I2S3_2CH_FRAC		43
-#define RK3588_CLK_I2S3_2CH			44
-#define RK3588_MCLK_I2S3_2CH			45
-#define RK3588_I2S3_2CH_MCLKOUT			46
-#define RK3588_PCLK_ACDCDIG			47
-#define RK3588_HCLK_I2S0_8CH			48
-#define RK3588_CLK_I2S0_8CH_TX_SRC		49
-#define RK3588_CLK_I2S0_8CH_TX_FRAC		50
-#define RK3588_MCLK_I2S0_8CH_TX			51
-#define RK3588_CLK_I2S0_8CH_TX			52
-#define RK3588_CLK_I2S0_8CH_RX_SRC		53
-#define RK3588_CLK_I2S0_8CH_RX_FRAC		54
-#define RK3588_MCLK_I2S0_8CH_RX			55
-#define RK3588_CLK_I2S0_8CH_RX			56
-#define RK3588_I2S0_8CH_MCLKOUT			57
-#define RK3588_HCLK_PDM1			58
-#define RK3588_MCLK_PDM1			59
-#define RK3588_HCLK_AUDIO_ROOT			60
-#define RK3588_PCLK_AUDIO_ROOT			61
-#define RK3588_HCLK_SPDIF0			62
-#define RK3588_CLK_SPDIF0_SRC			63
-#define RK3588_CLK_SPDIF0_FRAC			64
-#define RK3588_MCLK_SPDIF0			65
-#define RK3588_CLK_SPDIF0			66
-#define RK3588_CLK_SPDIF1			67
-#define RK3588_HCLK_SPDIF1			68
-#define RK3588_CLK_SPDIF1_SRC			69
-#define RK3588_CLK_SPDIF1_FRAC			70
-#define RK3588_MCLK_SPDIF1			71
-#define RK3588_ACLK_AV1_ROOT			72
-#define RK3588_ACLK_AV173
-#define RK3588_PCLK_AV1_ROOT			74
-#define RK3588_PCLK_AV175
-#define RK3588_PCLK_MAILBOX0			76
-#define RK3588_PCLK_MAILBOX1			77
-#define RK3588_PCLK_MAILBOX2			78
-#define RK3588_PCLK_PMU2			79
-#define RK3588_PCLK_PMUCM0_INTMUX		80
-#define RK3588_PCLK_DDRCM0_INTMUX		81
-#define RK3588_PCLK_TOP82
-#define RK3588_PCLK_PWM1			83
-#define RK3588_CLK_PWM184
-#define RK3588_CLK_PWM1_CAPTURE			85
-#define RK3588_PCLK_PWM2			86
-#define RK3588_CLK_PWM287
-#define RK3588_CLK_PWM2_CAPTURE			88
-#define RK3588_PCLK_PWM3			89
-#define RK3588_CLK_PWM390
-#define RK3588_CLK_PWM3_CAPTURE			91
-#define RK3588_PCLK_BUSTIMER0			92
-#define RK3588_PCLK_BUSTIMER1			93
-#define RK3588_CLK_BUS_TIMER_ROOT		94
-#define RK3588_CLK_BUSTIMER0			95
-#define RK3588_CLK_BUSTIMER1			96
-#define RK3588_CLK_BUSTIMER2			97
-#define RK3588_CLK_BUSTIMER3			98
-#define RK3588_CLK_BUSTIMER4			99
-#define RK3588_CLK_BUSTIMER5			100
-#define RK3588_CLK_BUSTIMER6			101
-#define RK3588_CLK_BUSTIMER7			102
-#define RK3588_CLK_BUSTIMER8			103
-#define RK3588_CLK_BUSTIMER9			104
-#define RK3588_CLK_BUSTIMER10			105
-#define RK3588_CLK_BUSTIMER11			106
-#define RK3588_PCLK_WDT0			107
-#define RK3588_TCLK_WDT0			108
-/* 109 */
-/* 110 */
-#define RK3588_PCLK_CAN0			111
-#define RK3588_CLK_CAN0112
-#define RK3588_PCLK_CAN1			113
-#define RK3588_CLK_CAN1114
-#define RK3588_PCLK_CAN2			115
-#define RK3588_CLK_CAN2116
-#define RK3588_ACLK_DECOM			117
-#define RK3588_PCLK_DECOM			118

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

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

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_gpio.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.6 src/sys/arch/arm/rockchip/rk_gpio.c:1.7
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.6	Tue Oct 17 15:09:18 2023
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 17:31:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $");
 
 #include 
 #include 
@@ -55,6 +55,26 @@ __KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 
 #define	GPIO_PORTA_EOI_REG		0x004c
 #define	GPIO_EXT_PORTA_REG		0x0050
 #define	GPIO_LS_SYNC_REG		0x0060
+#define	GPIO_VER_ID_REG			0x0078
+#define	GPIO_VER_ID_GPIOV2		0x0101157c
+
+/*
+ * In "version 2" GPIO controllers, half of each register is used by the
+ * write_enable mask, so the 32 pins are spread over two registers.
+ *
+ * pins  0 - 15 go into the GPIO_SWPORT_*_L register
+ * pins 16 - 31 go into the GPIO_SWPORT_*_H register
+ */
+#define GPIOV2_SWPORT_DR_BASE		0x
+#define GPIOV2_SWPORT_DR_REG(pin)	\
+	(GPIOV2_SWPORT_DR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_SWPORT_DDR_BASE		0x0008
+#define	GPIOV2_SWPORT_DDR_REG(pin)	\
+	(GPIOV2_SWPORT_DDR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_EXT_PORT_REG		0x0070
+#define	GPIOV2_REG_OFFSET(pin)		(((pin) >> 4) << 2)
+#define	GPIOV2_DATA_MASK(pin)		(__BIT((pin) & 0xF))
+#define	GPIOV2_WRITE_MASK(pin)		(__BIT(((pin) & 0xF) | 0x10))
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "rockchip,gpio-bank" },
@@ -223,18 +243,58 @@ rk_gpio_pin_ctl(void *priv, int pin, int
 	mutex_exit(>sc_lock);
 }
 
+static int
+rk_gpio_v2_pin_read(void *priv, int pin)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+	int val;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t data_mask = __BIT(pin);
+
+	/* No lock required for reads */
+	data = RD4(sc, GPIOV2_EXT_PORT_REG);
+	val = __SHIFTOUT(data, data_mask);
+
+	return val;
+}
+
+static void
+rk_gpio_v2_pin_write(void *priv, int pin, int val)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t write_mask = GPIOV2_WRITE_MASK(pin);
+
+	/* No lock required for writes on v2 controllers  */
+	data = val ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DR_REG(pin), write_mask | data);
+}
+
+static void
+rk_gpio_v2_pin_ctl(void *priv, int pin, int flags)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	/* No lock required for writes on v2 controllers  */
+	ddr = (flags & GPIO_PIN_OUTPUT) ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DDR_REG(pin), GPIOV2_WRITE_MASK(pin) | ddr);
+}
+
 static void
 rk_gpio_attach_ports(struct rk_gpio_softc *sc)
 {
-	struct gpio_chipset_tag *gp = >sc_gp;
 	struct gpiobus_attach_args gba;
 	u_int pin;
 
-	gp->gp_cookie = sc;
-	gp->gp_pin_read = rk_gpio_pin_read;
-	gp->gp_pin_write = rk_gpio_pin_write;
-	gp->gp_pin_ctl = rk_gpio_pin_ctl;
-
 	for (pin = 0; pin < __arraycount(sc->sc_pins); pin++) {
 		sc->sc_pins[pin].pin_num = pin;
 		sc->sc_pins[pin].pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT;
@@ -242,7 +302,7 @@ rk_gpio_attach_ports(struct rk_gpio_soft
 	}
 
 	memset(, 0, sizeof(gba));
-	gba.gba_gc = gp;
+	gba.gba_gc = >sc_gp;
 	gba.gba_pins = sc->sc_pins;
 	gba.gba_npins = __arraycount(sc->sc_pins);
 	sc->sc_gpiodev = config_found(sc->sc_dev, , NULL, CFARGS_NONE);
@@ -260,11 +320,14 @@ static void
 rk_gpio_attach(device_t parent, device_t self, void *aux)
 {
 	struct rk_gpio_softc * const sc = device_private(self);
+	struct gpio_chipset_tag * const gp = >sc_gp;
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	struct clk *clk;
 	bus_addr_t addr;
 	bus_size_t size;
+	uint32_t ver_id;
+	int ver;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
@@ -282,10 +345,31 @@ rk_gpio_attach(device_t parent, device_t
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
+
+	gp->gp_cookie = sc;
+	ver_id = RD4(sc, GPIO_VER_ID_REG);
+	switch (ver_id) {
+	case 0: /* VER_ID not implemented in v1 but reads back as 0 */
+		ver = 1;
+		gp->gp_pin_read = rk_gpio_pin_read;
+		gp->gp_pin_write = rk_gpio_pin_write;
+		gp->gp_pin_ctl = 

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

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

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_gpio.c

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

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

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


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

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

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

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


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

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.5 src/sys/arch/arm/rockchip/rk_gpio.c:1.6
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.5	Sat Aug  7 16:18:45 2021
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 15:09:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
 
 #include 
 #include 
@@ -90,30 +90,12 @@ static void	rk_gpio_attach(device_t, dev
 CFATTACH_DECL_NEW(rk_gpio, sizeof(struct rk_gpio_softc),
 	rk_gpio_match, rk_gpio_attach, NULL, NULL);
 
-static int
-rk_gpio_ctl(struct rk_gpio_softc *sc, u_int pin, int flags)
-{
-	uint32_t ddr;
-
-	KASSERT(mutex_owned(>sc_lock));
-
-	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
-	if (flags & GPIO_PIN_INPUT)
-		ddr &= ~__BIT(pin);
-	else if (flags & GPIO_PIN_OUTPUT)
-		ddr |= __BIT(pin);
-	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
-
-	return 0;
-}
-
 static void *
 rk_gpio_acquire(device_t dev, const void *data, size_t len, int flags)
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *gpin;
 	const u_int *gpio = data;
-	int error;
 
 	if (len != 12)
 		return NULL;
@@ -124,12 +106,7 @@ rk_gpio_acquire(device_t dev, const void
 	if (pin >= __arraycount(sc->sc_pins))
 		return NULL;
 
-	mutex_enter(>sc_lock);
-	error = rk_gpio_ctl(sc, pin, flags);
-	mutex_exit(>sc_lock);
-
-	if (error != 0)
-		return NULL;
+	sc->sc_gp.gp_pin_ctl(sc, pin, flags);
 
 	gpin = kmem_zalloc(sizeof(*gpin), KM_SLEEP);
 	gpin->pin_sc = sc;
@@ -146,9 +123,9 @@ rk_gpio_release(device_t dev, void *priv
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
 
-	mutex_enter(>sc_lock);
-	rk_gpio_ctl(pin->pin_sc, pin->pin_nr, GPIO_PIN_INPUT);
-	mutex_exit(>sc_lock);
+	KASSERT(sc == pin->pin_sc);
+
+	sc->sc_gp.gp_pin_ctl(sc, pin->pin_nr, GPIO_PIN_INPUT);
 
 	kmem_free(pin, sizeof(*pin));
 }
@@ -158,16 +135,11 @@ rk_gpio_read(device_t dev, void *priv, b
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 	int val;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
-	/* No lock required for reads */
-	data = RD4(sc, GPIO_EXT_PORTA_REG);
-	val = __SHIFTOUT(data, data_mask);
+	val = sc->sc_gp.gp_pin_read(sc, pin->pin_nr);
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
@@ -179,23 +151,13 @@ rk_gpio_write(device_t dev, void *priv, 
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
-	mutex_enter(>sc_lock);
-	data = RD4(sc, GPIO_SWPORTA_DR_REG);
-	if (val)
-		data |= data_mask;
-	else
-		data &= ~data_mask;
-	WR4(sc, GPIO_SWPORTA_DR_REG, data);
-	mutex_exit(>sc_lock);
+	sc->sc_gp.gp_pin_write(sc, pin->pin_nr, val);
 }
 
 static struct fdtbus_gpio_controller_func rk_gpio_funcs = {
@@ -247,11 +209,17 @@ static void
 rk_gpio_pin_ctl(void *priv, int pin, int flags)
 {
 	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
 
 	KASSERT(pin < __arraycount(sc->sc_pins));
 
 	mutex_enter(>sc_lock);
-	rk_gpio_ctl(sc, pin, flags);
+	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
+	if (flags & GPIO_PIN_INPUT)
+		ddr &= ~__BIT(pin);
+	else if (flags & GPIO_PIN_OUTPUT)
+		ddr |= __BIT(pin);
+	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
 	mutex_exit(>sc_lock);
 }
 



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

2023-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  6 09:53:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
Fix previous and restore setting of "user" flag from trapframe.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/arm/arm32/fault.c

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

Modified files:

Index: src/sys/arch/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.117 src/sys/arch/arm/arm32/fault.c:1.118
--- src/sys/arch/arm/arm32/fault.c:1.117	Thu Oct  5 19:41:03 2023
+++ src/sys/arch/arm/arm32/fault.c	Fri Oct  6 09:53:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.117 2023/10/05 19:41:03 ad Exp $	*/
+/*	$NetBSD: fault.c,v 1.118 2023/10/06 09:53:02 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.117 2023/10/05 19:41:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.118 2023/10/06 09:53:02 martin Exp $");
 
 #include 
 
@@ -819,13 +819,14 @@ prefetch_abort_handler(trapframe_t *tf)
 
 	l = curlwp;
 	pcb = lwp_getpcb(l);
+	user = TRAP_USERMODE(tf) != 0;
 
 	/*
 	 * Enable IRQ's (disabled by the abort) This always comes
 	 * from user mode so we know interrupts were not disabled.
 	 * But we check anyway.
 	 */
-	KASSERT(!TRAP_USERMODE(tf) || VALID_PSR(tf->tf_spsr));
+	KASSERT(!user || VALID_PSR(tf->tf_spsr));
 #ifdef __NO_FIQ
 	if (__predict_true((tf->tf_spsr & I32_bit) != I32_bit))
 		restore_interrupts(tf->tf_spsr & IF32_bits);



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

2023-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  6 09:53:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
Fix previous and restore setting of "user" flag from trapframe.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/arm/arm32/fault.c

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



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

2023-10-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  5 12:30:59 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gic.c

Log Message:
arm/gic: Check l_blcnt, not l_biglocks.

l_biglocks is a now-defunct temporary storage used only when
sleeping; l_blcnt is the number of kernel locks held by the lwp when
not sleeping.

Should fix arm builds.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/cortex/gic.c

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



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

2023-10-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct  5 12:30:59 UTC 2023

Modified Files:
src/sys/arch/arm/cortex: gic.c

Log Message:
arm/gic: Check l_blcnt, not l_biglocks.

l_biglocks is a now-defunct temporary storage used only when
sleeping; l_blcnt is the number of kernel locks held by the lwp when
not sleeping.

Should fix arm builds.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/cortex/gic.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.56 src/sys/arch/arm/cortex/gic.c:1.57
--- src/sys/arch/arm/cortex/gic.c:1.56	Sun Jun 26 11:14:36 2022
+++ src/sys/arch/arm/cortex/gic.c	Thu Oct  5 12:30:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.56 2022/06/26 11:14:36 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.57 2023/10/05 12:30:59 riastradh Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.56 2022/06/26 11:14:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.57 2023/10/05 12:30:59 riastradh Exp $");
 
 #include 
 #include 
@@ -320,7 +320,7 @@ armgic_irq_handler(void *tf)
 	struct armgic_softc * const sc = _softc;
 	const int old_ipl = ci->ci_cpl;
 	const int old_mtx_count = ci->ci_mtx_count;
-	const int old_l_biglocks = ci->ci_curlwp->l_biglocks;
+	const int old_l_blcnt = ci->ci_curlwp->l_blcnt;
 #ifdef DEBUG
 	size_t n = 0;
 #endif
@@ -407,7 +407,7 @@ armgic_irq_handler(void *tf)
 	pic_do_pending_ints(I32_bit, old_ipl, tf);
 	KASSERTMSG(ci->ci_cpl == old_ipl, "ci_cpl %d old_ipl %d", ci->ci_cpl, old_ipl);
 	KASSERT(old_mtx_count == ci->ci_mtx_count);
-	KASSERT(old_l_biglocks == ci->ci_curlwp->l_biglocks);
+	KASSERT(old_l_blcnt == ci->ci_curlwp->l_blcnt);
 }
 
 void



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

2023-10-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct  2 08:42:20 UTC 2023

Modified Files:
src/sys/arch/arm/fdt: pmu_fdt.c

Log Message:
armpmu(4): Add missing newline to error message.


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

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

Modified files:

Index: src/sys/arch/arm/fdt/pmu_fdt.c
diff -u src/sys/arch/arm/fdt/pmu_fdt.c:1.11 src/sys/arch/arm/fdt/pmu_fdt.c:1.12
--- src/sys/arch/arm/fdt/pmu_fdt.c:1.11	Wed Nov  9 19:03:38 2022
+++ src/sys/arch/arm/fdt/pmu_fdt.c	Mon Oct  2 08:42:20 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pmu_fdt.c,v 1.11 2022/11/09 19:03:38 ryo Exp $ */
+/* $NetBSD: pmu_fdt.c,v 1.12 2023/10/02 08:42:20 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu_fdt.c,v 1.11 2022/11/09 19:03:38 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu_fdt.c,v 1.12 2023/10/02 08:42:20 riastradh Exp $");
 
 #include 
 #include 
@@ -136,7 +136,7 @@ pmu_fdt_init(device_t self)
 		error = arm_pmu_init();
 		if (error) {
 			aprint_error_dev(self,
-			"couldn't initialise PMU event counter");
+			"couldn't initialise PMU event counter\n");
 			return;
 		}
 	}



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

2023-10-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Oct  2 08:42:20 UTC 2023

Modified Files:
src/sys/arch/arm/fdt: pmu_fdt.c

Log Message:
armpmu(4): Add missing newline to error message.


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

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



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

2023-09-14 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Thu Sep 14 12:27:55 UTC 2023

Added Files:
src/sys/arch/arm/dts: rk3399-pinebook-pro.dts

Log Message:
Enable crypto engine on Pinebook Pro.

Only used for rng at present.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.7 src/sys/arch/arm/dts/rk3399-pinebook-pro.dts

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

Added files:

Index: src/sys/arch/arm/dts/rk3399-pinebook-pro.dts
diff -u /dev/null src/sys/arch/arm/dts/rk3399-pinebook-pro.dts:1.7
--- /dev/null	Thu Sep 14 12:27:56 2023
+++ src/sys/arch/arm/dts/rk3399-pinebook-pro.dts	Thu Sep 14 12:27:55 2023
@@ -0,0 +1,30 @@
+/* $NetBSD: rk3399-pinebook-pro.dts,v 1.7 2023/09/14 12:27:55 rjs Exp $ */
+
+/*-
+ * Copyright (c) 2023 Robert Swindells 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN 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 "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts"
+#include "rk3399-crypto.dtsi"



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

2023-09-14 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Thu Sep 14 12:27:55 UTC 2023

Added Files:
src/sys/arch/arm/dts: rk3399-pinebook-pro.dts

Log Message:
Enable crypto engine on Pinebook Pro.

Only used for rng at present.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.7 src/sys/arch/arm/dts/rk3399-pinebook-pro.dts

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



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

2023-09-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep 12 12:56:21 UTC 2023

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-plus2e.dts
Removed Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-one.dts

Log Message:
Remove now-unneeded and brocken (probably since dts-5.15 import)
sun8i-h3-orangepi-one.dts, and let the build use the one from sys/external.
Problem reported and fix tested by Dave Tyson as reported on port-arm@
While there remove #include "sun8i-h3.dtsi" from sun8i-h3-orangepi-plus2e.dts,
this file has been removed with the dts-5.15 import.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts

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

Modified files:

Index: src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts
diff -u src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.4 src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.5
--- src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.4	Tue May 21 22:31:39 2019
+++ src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts	Tue Sep 12 12:56:21 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3-orangepi-plus2e.dts,v 1.4 2019/05/21 22:31:39 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3-orangepi-plus2e.dts,v 1.5 2023/09/12 12:56:21 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,6 @@
  */
 
 #include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts"
-#include "sun8i-h3.dtsi"
 
 / {
 	cpus {



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

2023-09-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep 12 12:56:21 UTC 2023

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-plus2e.dts
Removed Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-one.dts

Log Message:
Remove now-unneeded and brocken (probably since dts-5.15 import)
sun8i-h3-orangepi-one.dts, and let the build use the one from sys/external.
Problem reported and fix tested by Dave Tyson as reported on port-arm@
While there remove #include "sun8i-h3.dtsi" from sun8i-h3-orangepi-plus2e.dts,
this file has been removed with the dts-5.15 import.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts

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



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

2023-09-04 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Sep  5 02:59:07 UTC 2023

Modified Files:
src/sys/arch/arm/ti: ti_com.c

Log Message:
ti_com.c: set sc_type to COM_TYPE_OMAP

Avoid a kernel hang reported by Brook Milligan in PR port-arm/57598.
Patch suggested by RVP, seems correct to several of us. (If this
introduces a regression with some board, sorry, mea culpa. But in
that case we should still be carrying this, just conditionalized.)


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

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



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

2023-09-04 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Sep  5 02:59:07 UTC 2023

Modified Files:
src/sys/arch/arm/ti: ti_com.c

Log Message:
ti_com.c: set sc_type to COM_TYPE_OMAP

Avoid a kernel hang reported by Brook Milligan in PR port-arm/57598.
Patch suggested by RVP, seems correct to several of us. (If this
introduces a regression with some board, sorry, mea culpa. But in
that case we should still be carrying this, just conditionalized.)


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

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

Modified files:

Index: src/sys/arch/arm/ti/ti_com.c
diff -u src/sys/arch/arm/ti/ti_com.c:1.11 src/sys/arch/arm/ti/ti_com.c:1.12
--- src/sys/arch/arm/ti/ti_com.c:1.11	Wed Jan 27 03:10:20 2021
+++ src/sys/arch/arm/ti/ti_com.c	Tue Sep  5 02:59:07 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_com.c,v 1.11 2021/01/27 03:10:20 thorpej Exp $ */
+/* $NetBSD: ti_com.c,v 1.12 2023/09/05 02:59:07 gutteridge Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.11 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ti_com.c,v 1.12 2023/09/05 02:59:07 gutteridge Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ ti_com_attach(device_t parent, device_t 
 		return;
 	}
 
-	sc->sc_type = COM_TYPE_NORMAL;
+	sc->sc_type = COM_TYPE_OMAP;
 
 	error = bus_space_map(bst, addr, size, 0, );
 	if (error) {



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

2023-09-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  3 11:36:52 UTC 2023

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

Log Message:
bcm2835_spi: guard against too large clock divider and clamp if necessary


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

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_spi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_spi.c:1.12 src/sys/arch/arm/broadcom/bcm2835_spi.c:1.13
--- src/sys/arch/arm/broadcom/bcm2835_spi.c:1.12	Sat May  7 07:26:27 2022
+++ src/sys/arch/arm/broadcom/bcm2835_spi.c	Sun Sep  3 11:36:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $	*/
+/*	$NetBSD: bcm2835_spi.c,v 1.13 2023/09/03 11:36:52 tnn Exp $	*/
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.12 2022/05/07 07:26:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.13 2023/09/03 11:36:52 tnn Exp $");
 
 #include 
 #include 
@@ -182,6 +182,8 @@ bcmspi_configure(void *cookie, int slave
 	clk = 2 * 25000 / speed; /* XXX 250MHz */
 	clk = (clk / 2) + (clk & 1);
 	clk = roundup(clk, 2);
+	if (clk >= 0xfffe)
+		clk = 0xfffe;
 	clk = __SHIFTIN(clk, SPI_CLK_CDIV);
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SPI_CLK, clk);
 



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

2023-09-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  3 11:36:52 UTC 2023

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

Log Message:
bcm2835_spi: guard against too large clock divider and clamp if necessary


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

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



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

2023-08-30 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Aug 31 01:23:55 UTC 2023

Added Files:
src/sys/arch/arm/dts: rk3328-nanopi-r2s.dts

Log Message:
Enable rkv1crypto on nanopi-r2s

Follow the example of rock64. Tested by myself.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts

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



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

2023-08-30 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu Aug 31 01:23:55 UTC 2023

Added Files:
src/sys/arch/arm/dts: rk3328-nanopi-r2s.dts

Log Message:
Enable rkv1crypto on nanopi-r2s

Follow the example of rock64. Tested by myself.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts

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

Added files:

Index: src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts
diff -u /dev/null src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts:1.1
--- /dev/null	Thu Aug 31 01:23:55 2023
+++ src/sys/arch/arm/dts/rk3328-nanopi-r2s.dts	Thu Aug 31 01:23:55 2023
@@ -0,0 +1,32 @@
+/* $NetBSD: rk3328-nanopi-r2s.dts,v 1.1 2023/08/31 01:23:55 gutteridge Exp $ */
+
+/*-
+ * Copyright (c) 2023 David H. Gutteridge
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN 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 the crypto block in RK3328. */
+
+#include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts"
+#include "rk3328-crypto.dtsi"



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

2023-08-30 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Wed Aug 30 21:26:05 UTC 2023

Modified Files:
src/sys/arch/arm/dts: rk3399-rockpro64.dts

Log Message:
Re-enable the fan.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/dts/rk3399-rockpro64.dts

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



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

2023-08-30 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Wed Aug 30 21:26:05 UTC 2023

Modified Files:
src/sys/arch/arm/dts: rk3399-rockpro64.dts

Log Message:
Re-enable the fan.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/dts/rk3399-rockpro64.dts

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

Modified files:

Index: src/sys/arch/arm/dts/rk3399-rockpro64.dts
diff -u src/sys/arch/arm/dts/rk3399-rockpro64.dts:1.14 src/sys/arch/arm/dts/rk3399-rockpro64.dts:1.15
--- src/sys/arch/arm/dts/rk3399-rockpro64.dts:1.14	Sun Nov  7 17:11:43 2021
+++ src/sys/arch/arm/dts/rk3399-rockpro64.dts	Wed Aug 30 21:26:05 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399-rockpro64.dts,v 1.14 2021/11/07 17:11:43 jmcneill Exp $ */
+/* $NetBSD: rk3399-rockpro64.dts,v 1.15 2023/08/30 21:26:05 rjs Exp $ */
 
 /*-
  * Copyright (c) 2019,2021 Jared McNeill 
@@ -113,6 +113,10 @@
 		};
 	};
 
+	fan: pwm-fan {
+	 	cooling-levels = <0 100 150 200 255>;
+	};
+
 #if 0
 	edp@ff97 {
 		status = "okay";



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

2023-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug 13 22:06:44 UTC 2023

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
fix typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/marvell/armadaxpreg.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/arm/marvell/armadaxpreg.h
diff -u src/sys/arch/arm/marvell/armadaxpreg.h:1.9 src/sys/arch/arm/marvell/armadaxpreg.h:1.10
--- src/sys/arch/arm/marvell/armadaxpreg.h:1.9	Mon Apr  4 19:33:45 2022
+++ src/sys/arch/arm/marvell/armadaxpreg.h	Sun Aug 13 22:06:44 2023
@@ -280,7 +280,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define ARMADAXP_GPIO2_BASE	(MVSOC_DEVBUS_BASE + 0x8140)
 
 /*
- * Miscellanseous Register
+ * Miscellaneous Register
  */
 #define	ARMADAXP_MISC_BASE	(MVSOC_DEVBUS_BASE + 0x8200)
 
@@ -293,7 +293,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #define	ARMADAXP_MISC_SSRR_GLOBALSOFTRST	(1 << 0)
 
 /*
- * Thermal Sensor and Thermal Managemer
+ * Thermal Sensor and Thermal Management
  */
 #define ARMADAXP_TS_BASE	(MVSOC_DEVBUS_BASE + 0x82b0)
 #define ARMADAXP_TM_BASE	(MVSOC_DEVBUS_BASE + 0x84c0)



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

2023-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug 13 22:06:44 UTC 2023

Modified Files:
src/sys/arch/arm/marvell: armadaxpreg.h

Log Message:
fix typos in comments.


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

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:10:40 UTC 2023

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

Log Message:
avoid potentially uninitialised variable that likely won't happen.

GCC 12 can't tell that hardware / platform design means it won't happen.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_ccu_display.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_ccu_display.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_display.c:1.2 src/sys/arch/arm/sunxi/sunxi_ccu_display.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_ccu_display.c:1.2	Mon Apr  2 20:55:49 2018
+++ src/sys/arch/arm/sunxi/sunxi_ccu_display.c	Thu Aug  3 08:10:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_display.c,v 1.2 2018/04/02 20:55:49 bouyer Exp $ */
+/* $NetBSD: sunxi_ccu_display.c,v 1.3 2023/08/03 08:10:40 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Manuel Bouyer 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_display.c,v 1.2 2018/04/02 20:55:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_display.c,v 1.3 2023/08/03 08:10:40 mrg Exp $");
 
 #include 
 #include 
@@ -102,7 +102,7 @@ sunxi_ccu_lcdxch1_set_rate(struct sunxi_
 {
 	struct clk *clkp, *pllclkp;
 	int best_diff;
-	int parent_rate, best_parent_rate;
+	int parent_rate, best_parent_rate = 0;
 	uint32_t best_m, best_d;
 	int error;
 



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

2023-08-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Aug  3 08:10:40 UTC 2023

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

Log Message:
avoid potentially uninitialised variable that likely won't happen.

GCC 12 can't tell that hardware / platform design means it won't happen.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_ccu_display.c

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



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

2023-08-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  2 14:36:40 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/arm/arm32/db_interface.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_interface.c
diff -u src/sys/arch/arm/arm32/db_interface.c:1.64 src/sys/arch/arm/arm32/db_interface.c:1.65
--- src/sys/arch/arm/arm32/db_interface.c:1.64	Wed Oct 26 23:38:06 2022
+++ src/sys/arch/arm/arm32/db_interface.c	Wed Aug  2 14:36:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.65 2023/08/02 14:36:39 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.65 2023/08/02 14:36:39 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -276,10 +276,10 @@ db_write_bytes(vaddr_t addr, size_t size
 	}
 
 	if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0)
-		*((int*)dst) = *((const int *)data);
+		*((int *)dst) = *((const int *)data);
 	else
 	if (size == 2 && (addr & 1) == 0 && ((uintptr_t)data & 1) == 0)
-		*((short*)dst) = *((const short *)data);
+		*((short *)dst) = *((const short *)data);
 	else {
 		loop = size;
 		while (loop-- > 0) {



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

2023-08-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  2 14:36:40 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/arm/arm32/db_interface.c

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



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

2023-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  1 10:35:42 UTC 2023

Modified Files:
src/sys/arch/arm/xscale: ixp425_intr.h

Log Message:
arm/xscale: Do not lower IPL by splraise(9)

XXX
I have fixed similar bug for xscale/i80321.
There should be more in codes written at that time...


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

2023-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  1 10:35:42 UTC 2023

Modified Files:
src/sys/arch/arm/xscale: ixp425_intr.h

Log Message:
arm/xscale: Do not lower IPL by splraise(9)

XXX
I have fixed similar bug for xscale/i80321.
There should be more in codes written at that time...


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/xscale/ixp425_intr.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/arm/xscale/ixp425_intr.h
diff -u src/sys/arch/arm/xscale/ixp425_intr.h:1.10 src/sys/arch/arm/xscale/ixp425_intr.h:1.11
--- src/sys/arch/arm/xscale/ixp425_intr.h:1.10	Mon Nov 12 18:00:38 2012
+++ src/sys/arch/arm/xscale/ixp425_intr.h	Tue Aug  1 10:35:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ixp425_intr.h,v 1.10 2012/11/12 18:00:38 skrll Exp $	*/
+/*	$NetBSD: ixp425_intr.h,v 1.11 2023/08/01 10:35:42 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -88,6 +88,10 @@ static inline int __attribute__((__unuse
 ixp425_splraise(int ipl)
 {
 	int old = curcpl();
+
+	if (ipl <= old)
+		return (old);
+
 	set_curcpl(ipl);
 
 	/* Don't let the compiler re-order this code with subsequent code */



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

2023-07-28 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jul 28 06:21:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
arm/bus_dma: Fix misleading comment:

- * For a virtually-indexed write-back cache, we need
- * to do the following things:
+ * For a write-back cache, we need to do the following things:

This comment was written long ago when we supported only virtually-
indexed caches for arm. But subsequent comments are valid also for
physically-indexed cache.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/bus_dma.c

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

Modified files:

Index: src/sys/arch/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.143 src/sys/arch/arm/arm32/bus_dma.c:1.144
--- src/sys/arch/arm/arm32/bus_dma.c:1.143	Mon Apr  3 06:42:57 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Jul 28 06:21:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.144 2023/07/28 06:21:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.144 2023/07/28 06:21:02 rin Exp $");
 
 #include 
 
@@ -1114,8 +1114,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	len, offset, map->dm_mapsize);
 
 	/*
-	 * For a virtually-indexed write-back cache, we need
-	 * to do the following things:
+	 * For a write-back cache, we need to do the following things:
 	 *
 	 *	PREREAD -- Invalidate the D-cache.  We do this
 	 *	here in case a write-back is required by the back-end.



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

2023-07-28 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jul 28 06:21:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
arm/bus_dma: Fix misleading comment:

- * For a virtually-indexed write-back cache, we need
- * to do the following things:
+ * For a write-back cache, we need to do the following things:

This comment was written long ago when we supported only virtually-
indexed caches for arm. But subsequent comments are valid also for
physically-indexed cache.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/bus_dma.c

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



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

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 11:01:18 UTC 2023

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

Log Message:
arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/arm/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/arm/include/cpu.h
diff -u src/sys/arch/arm/include/cpu.h:1.124 src/sys/arch/arm/include/cpu.h:1.125
--- src/sys/arch/arm/include/cpu.h:1.124	Sun Jun 25 07:16:14 2023
+++ src/sys/arch/arm/include/cpu.h	Tue Jul 11 11:01:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.124 2023/06/25 07:16:14 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.125 2023/07/11 11:01:18 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -150,6 +150,8 @@ static inline void set_curcpl(int);
 static inline void cpu_dosoftints(void);
 #endif
 
+#include 
+
 #ifdef _KMEMUSER
 #include 
 #endif
@@ -158,8 +160,6 @@ static inline void cpu_dosoftints(void);
 #include 
 #include 
 
-#include 
-
 /*
  * Cache info variables.
  */



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

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 11:01:18 UTC 2023

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

Log Message:
arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/arm/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/arm/include

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 10:41:58 UTC 2023

Modified Files:
src/sys/arch/arm/include: mutex.h

Log Message:
arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/include/mutex.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/arm/include

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 10:41:58 UTC 2023

Modified Files:
src/sys/arch/arm/include: mutex.h

Log Message:
arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/include/mutex.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/arm/include/mutex.h
diff -u src/sys/arch/arm/include/mutex.h:1.27 src/sys/arch/arm/include/mutex.h:1.28
--- src/sys/arch/arm/include/mutex.h:1.27	Sun Dec 26 08:41:29 2021
+++ src/sys/arch/arm/include/mutex.h	Tue Jul 11 10:41:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.27 2021/12/26 08:41:29 skrll Exp $	*/
+/*	$NetBSD: mutex.h,v 1.28 2023/07/11 10:41:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -32,6 +32,11 @@
 #ifndef _ARM_MUTEX_H_
 #define	_ARM_MUTEX_H_
 
+#ifdef _KERNEL
+#include 
+#include 
+#endif
+
 /*
  * The ARM mutex implementation is troublesome, because pre-v6 ARM lacks a
  * compare-and-swap operation.  However, there aren't any MP pre-v6 ARM



  1   2   3   4   5   6   7   8   9   10   >