diff options
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/power_limit.h | 2 | ||||
-rw-r--r-- | src/soc/intel/common/block/power_limit/power_limit.c | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/include/intelblocks/power_limit.h b/src/soc/intel/common/block/include/intelblocks/power_limit.h index 2fa25de5be..934eaa4be7 100644 --- a/src/soc/intel/common/block/include/intelblocks/power_limit.h +++ b/src/soc/intel/common/block/include/intelblocks/power_limit.h @@ -38,4 +38,6 @@ struct soc_power_limits_config { void set_power_limits(u8 power_limit_1_time, struct soc_power_limits_config *config); +u8 get_cpu_tdp(void); + #endif /* _SOC_INTEL_COMMON_BLOCK_POWER_LIMIT_H_ */ diff --git a/src/soc/intel/common/block/power_limit/power_limit.c b/src/soc/intel/common/block/power_limit/power_limit.c index e6c65c3a82..417dd04672 100644 --- a/src/soc/intel/common/block/power_limit/power_limit.c +++ b/src/soc/intel/common/block/power_limit/power_limit.c @@ -195,3 +195,18 @@ void set_power_limits(u8 power_limit_1_time, wrmsr(MSR_TURBO_ACTIVATION_RATIO, limit); } } + +u8 get_cpu_tdp(void) +{ + unsigned int power_unit, cpu_tdp; + + /* Get units */ + msr_t msr = rdmsr(MSR_PKG_POWER_SKU_UNIT); + power_unit = 1 << (msr.lo & 0xf); + + /* Get power defaults for this SKU */ + msr = rdmsr(MSR_PKG_POWER_SKU); + cpu_tdp = msr.lo & 0x7fff; + + return cpu_tdp / power_unit; +} |