From 5630506fc9810735a1ffca7e7b1cd533c5d689d5 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 22 Mar 2023 23:46:34 +0100 Subject: soc/amd: pass pstate_msr union to get_pstate_core_[freq,power] Since we already have and use the pstate_msr union in get_pstate_info, also pass it directly to the get_pstate_core_freq and get_pstate_core_power function calls avoids having to sort-of convert the msr_t type parameter in the implementations of those two functions. In amdblocks/cpu.h a forward declaration of the pstate_msr union is used since soc/msr.h doesn't exist in the two pre-Zen SoCs that also include amdblocks/cpu.h. Signed-off-by: Felix Held Change-Id: I112030a15211587ccdc949807d1a1d552fe662b4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73926 Reviewed-by: Fred Reitberger Reviewed-by: Matt DeVillier Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/soc/amd/glinda/acpi.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/soc/amd/glinda/acpi.c') diff --git a/src/soc/amd/glinda/acpi.c b/src/soc/amd/glinda/acpi.c index b6830a48aa..ce0c7e6001 100644 --- a/src/soc/amd/glinda/acpi.c +++ b/src/soc/amd/glinda/acpi.c @@ -98,12 +98,9 @@ void acpi_fill_fadt(acpi_fadt_t *fadt) fadt->flags |= cfg->common_config.fadt_flags; /* additional board-specific flags */ } -uint32_t get_pstate_core_freq(msr_t pstate_def) +uint32_t get_pstate_core_freq(union pstate_msr pstate_reg) { uint32_t core_freq_mul; - union pstate_msr pstate_reg; - - pstate_reg.raw = pstate_def.raw; /* Core frequency multiplier */ core_freq_mul = pstate_reg.cpu_fid_0_11; @@ -112,12 +109,9 @@ uint32_t get_pstate_core_freq(msr_t pstate_def) return PSTATE_DEF_LO_CORE_FREQ_BASE * core_freq_mul; } -uint32_t get_pstate_core_power(msr_t pstate_def) +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; - union pstate_msr pstate_reg; - - pstate_reg.raw = pstate_def.raw; /* Core voltage ID */ core_vid = pstate_reg.cpu_vid_0_7 | pstate_reg.cpu_vid_8 << 8; -- cgit v1.2.3