From ba91cd33b69d8cf28b6813c5a8ed29961f42964e Mon Sep 17 00:00:00 2001 From: Mario Scheithauer Date: Tue, 10 Apr 2018 12:32:07 +0200 Subject: soc/intel/common/block/cpu: Fix cpu_get_power_max To avoid rounding errors with the current data types, the formula in this function must be converted. Change-Id: I75d05165fd9e5a0992330df00f8665a05d2daeb3 Signed-off-by: Mario Scheithauer Reviewed-on: https://review.coreboot.org/25584 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi Reviewed-by: Aaron Durbin --- src/soc/intel/common/block/cpu/cpulib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/soc') diff --git a/src/soc/intel/common/block/cpu/cpulib.c b/src/soc/intel/common/block/cpu/cpulib.c index ed1ba0fa7b..0b1599a804 100644 --- a/src/soc/intel/common/block/cpu/cpulib.c +++ b/src/soc/intel/common/block/cpu/cpulib.c @@ -287,7 +287,7 @@ uint32_t cpu_get_power_max(void) msr = rdmsr(MSR_PKG_POWER_SKU_UNIT); power_unit = 2 << ((msr.lo & 0xf) - 1); msr = rdmsr(MSR_PKG_POWER_SKU); - return ((msr.lo & 0x7fff) / power_unit) * 1000; + return (msr.lo & 0x7fff) * 1000 / power_unit; } uint32_t cpu_get_max_turbo_ratio(void) -- cgit v1.2.3