From d5ab24cd48006022ca60fe35f0f0366f3edce748 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 8 Aug 2022 22:57:31 +0200 Subject: [PATCH] soc/amd/common/acpi/cppc: add nominal and minimum frequencies Now that we have functionality to get the minimal and nominal frequencies, the corresponding fields in the CPPC config can now be populated. If the HOB isn't present and/or the frequency values could not be obtained, CPPC_UNSUPPORTED is still used; otherwise the HOB-provided frequency in MHz is used for those two fields. Signed-off-by: Felix Held Signed-off-by: Matt DeVillier Change-Id: Id3257690a3388d44ceceb7ac4f1db3d49e195caa Reviewed-on: https://review.coreboot.org/c/coreboot/+/66551 Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/cezanne/Kconfig | 1 + src/soc/amd/common/block/acpi/cppc.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/soc/amd/cezanne/Kconfig b/src/soc/amd/cezanne/Kconfig index d40c37c757..ce1688941a 100644 --- a/src/soc/amd/cezanne/Kconfig +++ b/src/soc/amd/cezanne/Kconfig @@ -68,6 +68,7 @@ config SOC_SPECIFIC_OPTIONS select SOC_AMD_COMMON_BLOCK_TSC_FAM17H_19H select SOC_AMD_COMMON_BLOCK_UART select SOC_AMD_COMMON_BLOCK_UCODE + select SOC_AMD_COMMON_FSP_CCX_CPPC_HOB select SOC_AMD_COMMON_FSP_DMI_TABLES select SOC_AMD_COMMON_FSP_PCI select SSE2 diff --git a/src/soc/amd/common/block/acpi/cppc.c b/src/soc/amd/common/block/acpi/cppc.c index 224034d159..f1167e8d27 100644 --- a/src/soc/amd/common/block/acpi/cppc.c +++ b/src/soc/amd/common/block/acpi/cppc.c @@ -5,6 +5,7 @@ #include #include #include +#include /* * version 2 is expected to be the typical use case. @@ -13,6 +14,9 @@ */ static void cpu_init_cppc_config(struct cppc_config *config, u32 version) { + uint32_t lowest_freq_mhz; + uint32_t nominal_freq_mhz; + config->version = version; config->entries[CPPC_HIGHEST_PERF] = CPPC_REG_MSR(MSR_CPPC_CAPABILITY_1, SHIFT_CPPC_CAPABILITY_1_HIGHEST_PERF, 8); @@ -42,8 +46,12 @@ static void cpu_init_cppc_config(struct cppc_config *config, u32 version) if (version < 3) return; - config->entries[CPPC_LOWEST_FREQ] = CPPC_UNSUPPORTED; - config->entries[CPPC_NOMINAL_FREQ] = CPPC_UNSUPPORTED; + config->entries[CPPC_LOWEST_FREQ] = + get_ccx_cppc_min_frequency(&lowest_freq_mhz) == CB_SUCCESS ? + CPPC_DWORD(lowest_freq_mhz) : CPPC_UNSUPPORTED; + config->entries[CPPC_NOMINAL_FREQ] = + get_ccx_cppc_nom_frequency(&nominal_freq_mhz) == CB_SUCCESS ? + CPPC_DWORD(nominal_freq_mhz) : CPPC_UNSUPPORTED; } void generate_cppc_entries(unsigned int core_id)