summaryrefslogtreecommitdiff
path: root/src/soc/amd/glinda
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-03-23 23:44:03 +0100
committerFelix Held <felix-coreboot@felixheld.de>2023-03-27 12:02:21 +0000
commit23a398e001b55950f7759aa7ffa2ec966e2ea917 (patch)
tree87e4cf413dd987a8b3b6f1cee6211cdd28bda6bd /src/soc/amd/glinda
parentfd5d26522c021c8f7a3242609f3b54cf209a8767 (diff)
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>
Diffstat (limited to 'src/soc/amd/glinda')
-rw-r--r--src/soc/amd/glinda/Kconfig1
-rw-r--r--src/soc/amd/glinda/acpi.c8
-rw-r--r--src/soc/amd/glinda/include/soc/msr.h4
3 files changed, 2 insertions, 11 deletions
diff --git a/src/soc/amd/glinda/Kconfig b/src/soc/amd/glinda/Kconfig
index 3ffee09d4f..5e9b7f95bb 100644
--- a/src/soc/amd/glinda/Kconfig
+++ b/src/soc/amd/glinda/Kconfig
@@ -69,6 +69,7 @@ config SOC_AMD_GLINDA
select SOC_AMD_COMMON_BLOCK_SMU # TODO: Check if this is still correct
select SOC_AMD_COMMON_BLOCK_SMU_SX_ENTRY # TODO: Check if this is still correct
select SOC_AMD_COMMON_BLOCK_SPI # TODO: Check if this is still correct
+ select SOC_AMD_COMMON_BLOCK_SVI3
select SOC_AMD_COMMON_BLOCK_TSC_FAM17H_19H # FIXME: This is likely incompatible
select SOC_AMD_COMMON_BLOCK_UART # TODO: Check if this is still correct
select SOC_AMD_COMMON_BLOCK_UCODE # TODO: Check if this is still correct
diff --git a/src/soc/amd/glinda/acpi.c b/src/soc/amd/glinda/acpi.c
index 37349c15ae..b9ea0eb784 100644
--- a/src/soc/amd/glinda/acpi.c
+++ b/src/soc/amd/glinda/acpi.c
@@ -123,13 +123,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;
diff --git a/src/soc/amd/glinda/include/soc/msr.h b/src/soc/amd/glinda/include/soc/msr.h
index 7b6889709e..ad4d9d0445 100644
--- a/src/soc/amd/glinda/include/soc/msr.h
+++ b/src/soc/amd/glinda/include/soc/msr.h
@@ -22,10 +22,6 @@ union pstate_msr {
#define PSTATE_DEF_CORE_FREQ_BASE 5
-/* Value defined in Serial VID Interface 3.0 spec (#56413, NDA only) */
-#define SERIAL_VID_3_DECODE_MICROVOLTS 5000
-#define SERIAL_VID_3_BASE_MICROVOLTS 245000L
-
#define MSR_CPPC_CAPABILITY_1 0xc00102b0
#define SHIFT_CPPC_CAPABILITY_1_HIGHEST_PERF 24
#define SHIFT_CPPC_CAPABILITY_1_NOMINAL_PERF 16