soc/amd: introduce and use get_uvolts_from_vid for SVI2 and SVI3

Instead of implementing the conversion from the raw serial voltage ID
value to the voltage in microvolts in every SoC, introduce the
SOC_AMD_COMMON_BLOCK_SVI[2,3] Kconfig options for the SoC to select the
correct version, implement get_uvolts_from_vid for both cases and only
include the selected implementation in the build.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I344641217e6e4654fd281d434b88e346e0482f57
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73995
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held
2023-03-23 23:44:03 +01:00
parent fd5d26522c
commit 23a398e001
20 changed files with 64 additions and 55 deletions

View File

@@ -149,13 +149,7 @@ uint32_t get_pstate_core_power(union pstate_msr pstate_reg)
current_divisor = pstate_reg.idd_div;
/* Voltage */
if (core_vid == 0x00) {
/* Voltage off for VID code 0x00 */
voltage_in_uvolts = 0;
} else {
voltage_in_uvolts = SERIAL_VID_3_BASE_MICROVOLTS +
(SERIAL_VID_3_DECODE_MICROVOLTS * core_vid);
}
voltage_in_uvolts = get_uvolts_from_vid(core_vid);
/* Power in mW */
power_in_mw = (voltage_in_uvolts) / 10 * current_value_amps;