summaryrefslogtreecommitdiff
path: root/arch/x86/cpu/intel_common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-09-25 08:56:36 -0600
committerBin Meng <bmeng.cn@gmail.com>2019-10-08 13:57:46 +0800
commit246ac08b037befab08805750049df75044ab7f6c (patch)
treea27f7ed04b34bfb7062f697d98eaf32630b9b2fd /arch/x86/cpu/intel_common
parente2493a7f5a06854d45175a4aa356ba3a2d810300 (diff)
x86: Add a common function to set CPU thermal target
This code appears in a few places, so move it to a common file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86/cpu/intel_common')
-rw-r--r--arch/x86/cpu/intel_common/cpu.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/cpu/intel_common/cpu.c b/arch/x86/cpu/intel_common/cpu.c
index 3a0d505a32..7d0ed73b4b 100644
--- a/arch/x86/cpu/intel_common/cpu.c
+++ b/arch/x86/cpu/intel_common/cpu.c
@@ -123,3 +123,25 @@ int cpu_intel_get_info(struct cpu_info *info, int bclk)
return 0;
}
+
+int cpu_configure_thermal_target(struct udevice *dev)
+{
+ u32 tcc_offset;
+ msr_t msr;
+ int ret;
+
+ ret = dev_read_u32(dev, "tcc-offset", &tcc_offset);
+ if (!ret)
+ return -ENOENT;
+
+ /* Set TCC activaiton offset if supported */
+ msr = msr_read(MSR_PLATFORM_INFO);
+ if (msr.lo & (1 << 30)) {
+ msr = msr_read(MSR_TEMPERATURE_TARGET);
+ msr.lo &= ~(0xf << 24); /* Bits 27:24 */
+ msr.lo |= (tcc_offset & 0xf) << 24;
+ msr_write(MSR_TEMPERATURE_TARGET, msr);
+ }
+
+ return 0;
+}