[coreboot-gerrit] Change in coreboot[master]: soc/intel/common/block/cpu: Fix cpu_get_power_max

Mario Scheithauer (Code Review) gerrit at coreboot.org
Tue Apr 10 12:36:06 CEST 2018


Mario Scheithauer has uploaded this change for review. ( https://review.coreboot.org/25584


Change subject: soc/intel/common/block/cpu: Fix cpu_get_power_max
......................................................................

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 at siemens.com>
---
M src/soc/intel/common/block/cpu/cpulib.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/25584/1

diff --git a/src/soc/intel/common/block/cpu/cpulib.c b/src/soc/intel/common/block/cpu/cpulib.c
index ed1ba0f..0b1599a 100644
--- a/src/soc/intel/common/block/cpu/cpulib.c
+++ b/src/soc/intel/common/block/cpu/cpulib.c
@@ -287,7 +287,7 @@
 	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)

-- 
To view, visit https://review.coreboot.org/25584
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75d05165fd9e5a0992330df00f8665a05d2daeb3
Gerrit-Change-Number: 25584
Gerrit-PatchSet: 1
Gerrit-Owner: Mario Scheithauer <mario.scheithauer at siemens.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180410/7b05cff6/attachment.html>


More information about the coreboot-gerrit mailing list