From 2c9de49a971497fadaf5272fd1bacee7a316dbfc Mon Sep 17 00:00:00 2001 From: Felix Held Date: Thu, 23 Mar 2023 23:57:44 +0100 Subject: soc/amd: introduce and use get_pstate_core_uvolts for SVI2 and SVI3 Since SVI3 has the CPU voltage ID split into two parts, a serial voltage ID version specific function is needed to get the raw core VID value. This will allow making get_pstate_core_power common for all AMD CPUs in a follow-up patch. Signed-off-by: Felix Held Change-Id: I71ca88c38b307558905a26cce8be1e8ffc5fbed4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73996 Reviewed-by: Eric Lai Reviewed-by: Fred Reitberger Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/soc/amd/mendocino/acpi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/soc/amd/mendocino/acpi.c') diff --git a/src/soc/amd/mendocino/acpi.c b/src/soc/amd/mendocino/acpi.c index 0574ba7627..519283f7d5 100644 --- a/src/soc/amd/mendocino/acpi.c +++ b/src/soc/amd/mendocino/acpi.c @@ -136,10 +136,10 @@ uint32_t get_pstate_core_freq(union pstate_msr pstate_reg) uint32_t get_pstate_core_power(union pstate_msr pstate_reg) { - uint32_t voltage_in_uvolts, core_vid, current_value_amps, current_divisor, power_in_mw; + uint32_t voltage_in_uvolts, current_value_amps, current_divisor, power_in_mw; - /* Core voltage ID */ - core_vid = pstate_reg.cpu_vid_0_7 | pstate_reg.cpu_vid_8 << 8; + /* Get Voltage from core voltage ID */ + voltage_in_uvolts = get_pstate_core_uvolts(pstate_reg); /* Current value in amps */ current_value_amps = pstate_reg.idd_value; @@ -147,9 +147,6 @@ uint32_t get_pstate_core_power(union pstate_msr pstate_reg) /* Current divisor */ current_divisor = pstate_reg.idd_div; - /* Voltage */ - voltage_in_uvolts = get_uvolts_from_vid(core_vid); - /* Power in mW */ power_in_mw = (voltage_in_uvolts) / 10 * current_value_amps; -- cgit v1.2.3