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>
This commit is contained in:
Mario Scheithauer 2018-04-10 12:32:07 +02:00 committed by Martin Roth
parent 79efe52e7d
commit ba91cd33b6
1 changed files with 1 additions and 1 deletions

View File

@ -287,7 +287,7 @@ uint32_t cpu_get_power_max(void)
msr = rdmsr(MSR_PKG_POWER_SKU_UNIT); msr = rdmsr(MSR_PKG_POWER_SKU_UNIT);
power_unit = 2 << ((msr.lo & 0xf) - 1); power_unit = 2 << ((msr.lo & 0xf) - 1);
msr = rdmsr(MSR_PKG_POWER_SKU); 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) uint32_t cpu_get_max_turbo_ratio(void)