summaryrefslogtreecommitdiffstats
path: root/sys/sys/cpu.h
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-05-31 08:59:15 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-05-31 08:59:15 +0000
commit71b3aa67385738a9468cd53579db0bab9d9e1b11 (patch)
tree030b83e49101bf16a03e903c30d999414d9ed8e8 /sys/sys/cpu.h
parent30e73eac6de760d0293a34ebc877732430398679 (diff)
downloadFreeBSD-src-71b3aa67385738a9468cd53579db0bab9d9e1b11.zip
FreeBSD-src-71b3aa67385738a9468cd53579db0bab9d9e1b11.tar.gz
Provide a new CPU device driver ivar to report the nominal speed of the
CPU, if available. This is meant to solve the issue of cpufreq misreporting speeds on CPUs that boot in a reduced power mode and have only relative speed control.
Diffstat (limited to 'sys/sys/cpu.h')
-rw-r--r--sys/sys/cpu.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h
index d282d30..c16091e 100644
--- a/sys/sys/cpu.h
+++ b/sys/sys/cpu.h
@@ -36,6 +36,7 @@
*/
#define CPU_IVAR_PCPU 1
+#define CPU_IVAR_NOMINAL_MHZ 2
static __inline struct pcpu *cpu_get_pcpu(device_t dev)
{
@@ -44,6 +45,15 @@ static __inline struct pcpu *cpu_get_pcpu(device_t dev)
return ((struct pcpu *)v);
}
+static __inline int32_t cpu_get_nominal_mhz(device_t dev)
+{
+ uintptr_t v = 0;
+ if (BUS_READ_IVAR(device_get_parent(dev), dev,
+ CPU_IVAR_NOMINAL_MHZ, &v) != 0)
+ return (-1);
+ return ((int32_t)v);
+}
+
/*
* CPU frequency control interface.
*/
OpenPOWER on IntegriCloud