diff options
author | Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> | 2021-08-25 19:48:02 +0530 |
---|---|---|
committer | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-09-03 16:14:15 +0000 |
commit | dc0e066406d2ac36c83d4abd871f20e3121f7cc5 (patch) | |
tree | 4c0364d3251d46f24869d856b0b1cf5cd6ebac2a /src/soc/intel | |
parent | 2909b487a298e003e8bb433a0ac80e19ec322bdf (diff) |
soc/intel/common: get tdp of CPU for different SKUs
Get tdp value of CPU for different SKUs based on PKG POWER MSR.
BUG=b:194745919
BRANCH=None
TEST=Build FW and test on brya0 board
Change-Id: I9fba0a64da2f1d79d633054dddd9fdf1d3d8e258
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57143
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
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; +} |