summaryrefslogtreecommitdiff
path: root/src/cpu/intel/common/voltage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/intel/common/voltage.c')
-rw-r--r--src/cpu/intel/common/voltage.c12
1 files changed, 12 insertions, 0 deletions
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;
+}