Thu Mar 3 06:26:06 2022 UTC ()
arm: Use device_set_private for cpuN.

For cpu at fdt, nix the fdt softc -- this was leaked and never used
for anything.  The device's private storage is the cpu_info.


(riastradh)
diff -r1.68 -r1.69 src/sys/arch/aarch64/aarch64/cpu.c
diff -r1.152 -r1.153 src/sys/arch/arm/arm32/cpu.c
diff -r1.41 -r1.42 src/sys/arch/arm/fdt/cpu_fdt.c

cvs diff -r1.68 -r1.69 src/sys/arch/aarch64/aarch64/cpu.c (expand / switch to context diff)
--- src/sys/arch/aarch64/aarch64/cpu.c 2021/11/12 06:44:46 1.68
+++ src/sys/arch/aarch64/aarch64/cpu.c 2022/03/03 06:26:05 1.69
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.68 2021/11/12 06:44:46 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.69 2022/03/03 06:26:05 riastradh Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.68 2021/11/12 06:44:46 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.69 2022/03/03 06:26:05 riastradh Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -128,7 +128,7 @@
 		cpu_info[ncpu] = ci;
 		if (cpu_hatched_p(unit) == 0) {
 			ci->ci_dev = dv;
-			dv->dv_private = ci;
+			device_set_private(dv, ci);
 			ci->ci_index = -1;
 
 			aprint_naive(": disabled\n");
@@ -143,7 +143,7 @@
 	}
 
 	ci->ci_dev = dv;
-	dv->dv_private = ci;
+	device_set_private(dv, ci);
 
 	ci->ci_kfpu_spl = -1;
 

cvs diff -r1.152 -r1.153 src/sys/arch/arm/arm32/cpu.c (expand / switch to context diff)
--- src/sys/arch/arm/arm32/cpu.c 2021/10/31 16:23:47 1.152
+++ src/sys/arch/arm/arm32/cpu.c 2022/03/03 06:26:05 1.153
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.152 2021/10/31 16:23:47 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.153 2022/03/03 06:26:05 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.152 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.153 2022/03/03 06:26:05 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -128,7 +128,7 @@
 		cpu_info[unit] = ci;
 		if (cpu_hatched_p(unit) == false) {
 			ci->ci_dev = dv;
-			dv->dv_private = ci;
+			device_set_private(dv, ci);
 			aprint_naive(": disabled\n");
 			aprint_normal(": disabled (unresponsive)\n");
 			return;
@@ -141,7 +141,7 @@
 	}
 
 	ci->ci_dev = dv;
-	dv->dv_private = ci;
+	device_set_private(dv, ci);
 
 	arm_cpu_do_topology(ci);
 

cvs diff -r1.41 -r1.42 src/sys/arch/arm/fdt/cpu_fdt.c (expand / switch to context diff)
--- src/sys/arch/arm/fdt/cpu_fdt.c 2021/08/30 23:16:17 1.41
+++ src/sys/arch/arm/fdt/cpu_fdt.c 2022/03/03 06:26:05 1.42
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.41 2021/08/30 23:16:17 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.42 2022/03/03 06:26:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.41 2021/08/30 23:16:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.42 2022/03/03 06:26:05 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -57,12 +57,7 @@
 static int	cpu_fdt_match(device_t, cfdata_t, void *);
 static void	cpu_fdt_attach(device_t, device_t, void *);
 
-struct cpu_fdt_softc {
-	device_t		sc_dev;
-	int			sc_phandle;
-};
-
-CFATTACH_DECL_NEW(cpu_fdt, sizeof(struct cpu_fdt_softc),
+CFATTACH_DECL_NEW(cpu_fdt, 0,
 	cpu_fdt_match, cpu_fdt_attach, NULL, NULL);
 
 static int
@@ -80,15 +75,11 @@
 static void
 cpu_fdt_attach(device_t parent, device_t self, void *aux)
 {
-	struct cpu_fdt_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	bus_addr_t cpuid;
 	const uint32_t *cap_ptr;
 	int len;
-
-	sc->sc_dev = self;
-	sc->sc_phandle = phandle;
 
  	cap_ptr = fdtbus_get_prop(phandle, "capacity-dmips-mhz", &len);
 	if (cap_ptr && len == 4) {