summaryrefslogtreecommitdiff
path: root/src/cpu/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/intel')
-rw-r--r--src/cpu/intel/common/Kconfig3
-rw-r--r--src/cpu/intel/common/Makefile.inc1
-rw-r--r--src/cpu/intel/common/voltage.c12
-rw-r--r--src/cpu/intel/haswell/Kconfig1
4 files changed, 17 insertions, 0 deletions
diff --git a/src/cpu/intel/common/Kconfig b/src/cpu/intel/common/Kconfig
index 01f2721b59..7f9033cf65 100644
--- a/src/cpu/intel/common/Kconfig
+++ b/src/cpu/intel/common/Kconfig
@@ -32,6 +32,9 @@ config CPU_INTEL_COMMON_TIMEBASE
endif
+config CPU_INTEL_COMMON_VOLTAGE
+ bool
+
config CPU_INTEL_COMMON_SMM
bool
default y if CPU_INTEL_COMMON
diff --git a/src/cpu/intel/common/Makefile.inc b/src/cpu/intel/common/Makefile.inc
index 8b81a121d3..530ecee009 100644
--- a/src/cpu/intel/common/Makefile.inc
+++ b/src/cpu/intel/common/Makefile.inc
@@ -1,5 +1,6 @@
ramstage-$(CONFIG_CPU_INTEL_COMMON) += common_init.c
ramstage-$(CONFIG_CPU_INTEL_COMMON) += hyperthreading.c
+ramstage-$(CONFIG_CPU_INTEL_COMMON_VOLTAGE) += voltage.c
ifeq ($(CONFIG_CPU_INTEL_COMMON_TIMEBASE),y)
bootblock-y += fsb.c
diff --git a/src/cpu/intel/common/voltage.c b/src/cpu/intel/common/voltage.c
new file mode 100644
index 0000000000..38951a06db
--- /dev/null
+++ b/src/cpu/intel/common/voltage.c
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/x86/msr.h>
+#include <smbios.h>
+
+/* This is not an architectural MSR. */
+#define MSR_PERF_STATUS 0x198
+
+unsigned int smbios_cpu_get_voltage(void)
+{
+ return (rdmsr(MSR_PERF_STATUS).hi & 0xffff) * 10 / 8192;
+}
diff --git a/src/cpu/intel/haswell/Kconfig b/src/cpu/intel/haswell/Kconfig
index fbfa71456b..0d3d132006 100644
--- a/src/cpu/intel/haswell/Kconfig
+++ b/src/cpu/intel/haswell/Kconfig
@@ -20,6 +20,7 @@ config CPU_SPECIFIC_OPTIONS
select CPU_INTEL_COMMON
select CPU_INTEL_COMMON_TIMEBASE
select HAVE_ASAN_IN_ROMSTAGE
+ select CPU_INTEL_COMMON_VOLTAGE
config SMM_TSEG_SIZE
hex