soc/amd: Recalculate the field power in PSS table entry
Being divided by 1000 causes data loss and the loss is expand by muliplication. So we just set a lower divisor before muliplication. BUG=b:185922528 Change-Id: Ib43103cc62c18debea3fd2c23d9c30fb0ecd781b Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67050 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
41a8043bdf
commit
62cd5e8603
|
@ -195,16 +195,17 @@ static uint32_t get_pstate_core_power(msr_t pstate_def)
|
|||
}
|
||||
|
||||
/* Power in mW */
|
||||
power_in_mw = (voltage_in_uvolts) / 1000 * current_value_amps;
|
||||
power_in_mw = (voltage_in_uvolts) / 10 * current_value_amps;
|
||||
|
||||
switch (current_divisor) {
|
||||
case 0:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
break;
|
||||
case 1:
|
||||
power_in_mw = power_in_mw / 10L;
|
||||
power_in_mw = power_in_mw / 1000L;
|
||||
break;
|
||||
case 2:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
power_in_mw = power_in_mw / 10000L;
|
||||
break;
|
||||
case 3:
|
||||
/* current_divisor is set to an undefined value.*/
|
||||
|
|
|
@ -197,16 +197,17 @@ static uint32_t get_pstate_core_power(msr_t pstate_def)
|
|||
}
|
||||
|
||||
/* Power in mW */
|
||||
power_in_mw = (voltage_in_uvolts) / 1000 * current_value_amps;
|
||||
power_in_mw = (voltage_in_uvolts) / 10 * current_value_amps;
|
||||
|
||||
switch (current_divisor) {
|
||||
case 0:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
break;
|
||||
case 1:
|
||||
power_in_mw = power_in_mw / 10L;
|
||||
power_in_mw = power_in_mw / 1000L;
|
||||
break;
|
||||
case 2:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
power_in_mw = power_in_mw / 10000L;
|
||||
break;
|
||||
case 3:
|
||||
/* current_divisor is set to an undefined value.*/
|
||||
|
|
|
@ -203,16 +203,17 @@ static uint32_t get_pstate_core_power(msr_t pstate_def)
|
|||
}
|
||||
|
||||
/* Power in mW */
|
||||
power_in_mw = (voltage_in_uvolts) / 1000 * current_value_amps;
|
||||
power_in_mw = (voltage_in_uvolts) / 10 * current_value_amps;
|
||||
|
||||
switch (current_divisor) {
|
||||
case 0:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
break;
|
||||
case 1:
|
||||
power_in_mw = power_in_mw / 10L;
|
||||
power_in_mw = power_in_mw / 1000L;
|
||||
break;
|
||||
case 2:
|
||||
power_in_mw = power_in_mw / 100L;
|
||||
power_in_mw = power_in_mw / 10000L;
|
||||
break;
|
||||
case 3:
|
||||
/* current_divisor is set to an undefined value.*/
|
||||
|
|
Loading…
Reference in New Issue