summaryrefslogtreecommitdiffstats
path: root/sys/dev/ofw/ofw_cpu.c
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2015-02-19 12:47:48 +0000
committerandrew <andrew@FreeBSD.org>2015-02-19 12:47:48 +0000
commitabd24e635c165fead8b3094c3636e28a715dce33 (patch)
treebf1fdd99c1f66e3a87ae4c215a9df09b4aacff99 /sys/dev/ofw/ofw_cpu.c
parentc560f15fa85ae389cef41cccd341e86818691111 (diff)
downloadFreeBSD-src-abd24e635c165fead8b3094c3636e28a715dce33.zip
FreeBSD-src-abd24e635c165fead8b3094c3636e28a715dce33.tar.gz
Add support to get the cpu ID from its device driver in a generic way.
This will be needed by arm64 to find the value to pass to the psci (Power State Coordination Interface) driver, among other things, used to enable cores. Differential Revision: https://reviews.freebsd.org/D1824 Reviewed by: imp Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/ofw/ofw_cpu.c')
-rw-r--r--sys/dev/ofw/ofw_cpu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/ofw/ofw_cpu.c b/sys/dev/ofw/ofw_cpu.c
index 0432560..250419f 100644
--- a/sys/dev/ofw/ofw_cpu.c
+++ b/sys/dev/ofw/ofw_cpu.c
@@ -244,6 +244,7 @@ ofw_cpu_attach(device_t dev)
static int
ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
{
+ struct ofw_cpulist_softc *psc;
struct ofw_cpu_softc *sc;
sc = device_get_softc(dev);
@@ -258,6 +259,16 @@ ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
return (0);
}
break;
+ case CPU_IVAR_CPUID_SIZE:
+ psc = device_get_softc(device_get_parent(dev));
+ *result = psc->sc_addr_cells;
+ return (0);
+ case CPU_IVAR_CPUID:
+ if (sc->sc_reg_valid) {
+ *result = (uintptr_t)sc->sc_reg;
+ return (0);
+ }
+ break;
}
return (ENOENT);
OpenPOWER on IntegriCloud