From c6cd5d4ed50a95656ec2eb0e68242e43859b578c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 28 Oct 2015 17:13:28 -0500 Subject: cpu/amd/model_fxx: Fix invalid P-state power values Change-Id: Ifdb1d1f267af289d962effe1150c7bc0a39cb5d2 Signed-off-by: Timothy Pearson Reviewed-on: http://review.coreboot.org/12233 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/cpu/amd/model_fxx/powernow_acpi.c | 46 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'src/cpu/amd') diff --git a/src/cpu/amd/model_fxx/powernow_acpi.c b/src/cpu/amd/model_fxx/powernow_acpi.c index 1ce746d17a..53330f9933 100644 --- a/src/cpu/amd/model_fxx/powernow_acpi.c +++ b/src/cpu/amd/model_fxx/powernow_acpi.c @@ -250,17 +250,17 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP) Pstate_vid[1] = Pstate_vid[0] + 0x1; Pstate_volt[1] = 1550 - Pstate_vid[1] * 25; Pstate_power[1] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1] / - (Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); } if (((Pstate_vid[0] & 0x1) == 0) && ((Pstate_vid[0] - 0x1) < Min_vid)) { /* even value */ Pstate_vid[1] = Pstate_vid[0] + PstateStep_coef; Pstate_volt[1] = 1550 - Pstate_vid[1] * 25; Pstate_power[1] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1] / - (Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); } Pstate_num++; } @@ -274,17 +274,17 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP) Pstate_vid[1] = Pstate_vid[0] + 0x1; Pstate_volt[1] = 1550 - Pstate_vid[1] * 25; Pstate_power[1] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1] / - (Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); } if (((Pstate_vid[0] & 0x1) == 0) && ((Pstate_vid[0] - 0x1) < Min_vid)) { /* even value */ Pstate_vid[1] = Pstate_vid[0] + PstateStep_coef; Pstate_volt[1] = 1550 - Pstate_vid[1] * 25; Pstate_power[1] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1] / - (Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[1] * Pstate_volt[1] * Pstate_volt[1]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); } Pstate_num++; @@ -309,11 +309,9 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP) Pstate_volt[Pstate_num] = 1550 - Pstate_vid[Pstate_num] * 25; Pstate_power[Pstate_num] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * - Pstate_volt[Pstate_num] / (Pstate_feq[0] * - Pstate_volt[0] * - Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * Pstate_volt[Pstate_num]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); } Pstate_num++; } @@ -327,10 +325,9 @@ nointpstatesup: Pstate_vid[Pstate_num] = Min_vid; Pstate_volt[Pstate_num] = 1550 - Pstate_vid[Pstate_num] * 25; Pstate_power[Pstate_num] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * - Pstate_volt[Pstate_num] / (Pstate_feq[0] * Pstate_volt[0] * - Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * Pstate_volt[Pstate_num]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); Pstate_num++; } else { Pstate_fid[Pstate_num] = Start_fid; @@ -339,10 +336,9 @@ nointpstatesup: Pstate_vid[Pstate_num] = Min_vid; Pstate_volt[Pstate_num] = 1550 - Pstate_vid[Pstate_num] * 25; Pstate_power[Pstate_num] = - (unsigned long long)Pstate_power[0] * - Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * - Pstate_volt[Pstate_num] / (Pstate_feq[0] * Pstate_volt[0] * - Pstate_volt[0]); + ((unsigned long long)Pstate_power[0] * + Pstate_feq[Pstate_num] * Pstate_volt[Pstate_num] * Pstate_volt[Pstate_num]) / + ((unsigned long long)Pstate_feq[0] * Pstate_volt[0] * Pstate_volt[0]); Pstate_num++; } -- cgit v1.2.3