Module Name: src
Committed By: riastradh
Date: Thu Mar 3 06:27:41 UTC 2022
Modified Files:
src/sys/arch/evbmips/evbmips: cpu.c
src/sys/arch/evbmips/ingenic: cpu.c
src/sys/arch/mips/cavium: octeon_cpunode.c
src/sys/arch/mips/mips: cpu_subr.c
Log Message:
mips: Carefully use device_set_private for cpuN.
But don't do it in cpu_attach_common because the callers aren't set
up right -- instead leave a comment about what's wrong, to be dealt
with later.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/evbmips/cpu.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/ingenic/cpu.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/mips/cavium/octeon_cpunode.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/mips/mips/cpu_subr.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/evbmips/evbmips/cpu.c
diff -u src/sys/arch/evbmips/evbmips/cpu.c:1.5 src/sys/arch/evbmips/evbmips/cpu.c:1.6
--- src/sys/arch/evbmips/evbmips/cpu.c:1.5 Fri Jun 26 21:57:25 2015
+++ src/sys/arch/evbmips/evbmips/cpu.c Thu Mar 3 06:27:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.5 2015/06/26 21:57:25 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.6 2022/03/03 06:27:40 riastradh Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.5 2015/06/26 21:57:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.6 2022/03/03 06:27:40 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -64,7 +64,7 @@ cpu_attach(device_t parent, device_t sel
struct cpu_info * const ci = curcpu();
ci->ci_dev = self;
- self->dv_private = ci;
+ device_set_private(self, ci);
aprint_normal(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
ci->ci_cpu_freq / 1000000,
Index: src/sys/arch/evbmips/ingenic/cpu.c
diff -u src/sys/arch/evbmips/ingenic/cpu.c:1.4 src/sys/arch/evbmips/ingenic/cpu.c:1.5
--- src/sys/arch/evbmips/ingenic/cpu.c:1.4 Sun May 21 06:49:12 2017
+++ src/sys/arch/evbmips/ingenic/cpu.c Thu Mar 3 06:27:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.4 2017/05/21 06:49:12 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.5 2022/03/03 06:27:40 riastradh Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.4 2017/05/21 06:49:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.5 2022/03/03 06:27:40 riastradh Exp $");
#include "opt_ingenic.h"
#include "opt_multiprocessor.h"
@@ -113,7 +113,7 @@ cpu_attach(device_t parent, device_t sel
}
ci->ci_dev = self;
- self->dv_private = ci;
+ device_set_private(self, ci);
aprint_normal(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
ci->ci_cpu_freq / 1000000,
Index: src/sys/arch/mips/cavium/octeon_cpunode.c
diff -u src/sys/arch/mips/cavium/octeon_cpunode.c:1.21 src/sys/arch/mips/cavium/octeon_cpunode.c:1.22
--- src/sys/arch/mips/cavium/octeon_cpunode.c:1.21 Sat Aug 7 16:18:59 2021
+++ src/sys/arch/mips/cavium/octeon_cpunode.c Thu Mar 3 06:27:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_cpunode.c,v 1.21 2021/08/07 16:18:59 thorpej Exp $ */
+/* $NetBSD: octeon_cpunode.c,v 1.22 2022/03/03 06:27:41 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#define __INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.21 2021/08/07 16:18:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.22 2022/03/03 06:27:41 riastradh Exp $");
#include "locators.h"
#include "cpunode.h"
@@ -252,7 +252,7 @@ cpu_cpunode_attach_common(device_t self,
struct cpu_softc * const cpu __diagused = ci->ci_softc;
ci->ci_dev = self;
- self->dv_private = ci;
+ device_set_private(self, ci);
KASSERTMSG(cpu != NULL, "ci %p index %d", ci, cpu_index(ci));
Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.59 src/sys/arch/mips/mips/cpu_subr.c:1.60
--- src/sys/arch/mips/mips/cpu_subr.c:1.59 Tue Nov 16 06:11:52 2021
+++ src/sys/arch/mips/mips/cpu_subr.c Thu Mar 3 06:27:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_subr.c,v 1.59 2021/11/16 06:11:52 simonb Exp $ */
+/* $NetBSD: cpu_subr.c,v 1.60 2022/03/03 06:27:41 riastradh Exp $ */
/*-
* Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.59 2021/11/16 06:11:52 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.60 2022/03/03 06:27:41 riastradh Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -236,6 +236,11 @@ cpu_attach_common(device_t self, struct
/*
* Cross link cpu_info and its device together
+ *
+ * XXX autoconf abuse: Can't use device_set_private here
+ * because some callers already do so -- and some callers
+ * (sbmips cpu_attach) already have a softc allocated by
+ * autoconf.
*/
ci->ci_dev = self;
self->dv_private = ci;