diff options
author | andrew <andrew@FreeBSD.org> | 2016-09-21 09:45:14 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2016-09-21 09:45:14 +0000 |
commit | 36f7b8535d10884b8dd31f0e959b765ada1feb3c (patch) | |
tree | 2e6419c924d2b2715ad1de51c4720c23001fa80e /sys/arm64 | |
parent | ecb7e500a3f21e0a1cd560ef95bccaaa57c05c09 (diff) | |
download | FreeBSD-src-36f7b8535d10884b8dd31f0e959b765ada1feb3c.zip FreeBSD-src-36f7b8535d10884b8dd31f0e959b765ada1feb3c.tar.gz |
MFC 305285:
Add a pc_clock pcpu field and use it to implement cpu_est_clockrate. This
will allow drivers that manage the clock frequency to communicate this with
the reset of the kernel.
Sponsored by: ABT Systems Ltd
Diffstat (limited to 'sys/arm64')
-rw-r--r-- | sys/arm64/arm64/machdep.c | 11 | ||||
-rw-r--r-- | sys/arm64/include/pcpu.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 23839ff..dd2186b 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -407,8 +407,17 @@ cpu_flush_dcache(void *ptr, size_t len) int cpu_est_clockrate(int cpu_id, uint64_t *rate) { + struct pcpu *pc; - panic("ARM64TODO: cpu_est_clockrate"); + pc = pcpu_find(cpu_id); + if (pc == NULL || rate == NULL) + return (EINVAL); + + if (pc->pc_clock == 0) + return (EOPNOTSUPP); + + *rate = pc->pc_clock; + return (0); } void diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h index 21b58db..53f4e7b 100644 --- a/sys/arm64/include/pcpu.h +++ b/sys/arm64/include/pcpu.h @@ -38,7 +38,8 @@ #define PCPU_MD_FIELDS \ u_int pc_acpi_id; /* ACPI CPU id */ \ u_int pc_midr; /* stored MIDR value */ \ - char __pad[121] + uint64_t pc_clock; \ + char __pad[113] #ifdef _KERNEL |