summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Scheithauer <mario.scheithauer@siemens.com>2018-04-10 12:32:07 +0200
committerMartin Roth <martinroth@google.com>2018-04-11 14:09:48 +0000
commitba91cd33b69d8cf28b6813c5a8ed29961f42964e (patch)
treeccb1677125118c9e8788c65d8cb2e03415a02814
parent79efe52e7dbb70b02cdf448de32e895729ddde7e (diff)
downloadcoreboot-ba91cd33b69d8cf28b6813c5a8ed29961f42964e.tar.xz
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 <mario.scheithauer@siemens.com> Reviewed-on: https://review.coreboot.org/25584 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/soc/intel/common/block/cpu/cpulib.c2
1 files changed, 1 insertions, 1 deletions
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)