soc/intel/common: Simply code accessing scaling factors

This commit streamlines the call to the
soc_read_core_scaling_factors() function. When runtime access to the
core scaling factors is not available, a static fallback is used based
on the CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR and
CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR options.

TEST=Successfully read performance and efficient scaling factors on a
     fatcat board.

Change-Id: I62e903bea07f2981dfcbaf61d3b918e7c332afc5
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Suggested-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85897
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Jeremy Compostella 2025-01-08 09:17:02 -08:00 committed by Jérémy Compostella
commit ac02ae15d8
2 changed files with 20 additions and 16 deletions

View file

@ -110,22 +110,8 @@ static void acpi_get_cpu_nomi_perf(u16 *eff_core_nom_perf, u16 *perf_core_nom_pe
u8 max_non_turbo_ratio = cpu_get_max_non_turbo_ratio();
static u16 performance, efficient;
_Static_assert(CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS) ||
CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR must not be zero");
_Static_assert(CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS) ||
CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR must not be zero");
if (!performance) {
if (CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS)) {
soc_read_core_scaling_factors(&performance, &efficient);
} else {
performance = CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR;
efficient = CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR;
}
}
if (!performance)
soc_read_core_scaling_factors(&performance, &efficient);
*perf_core_nom_perf = (u16)((max_non_turbo_ratio * performance) / 100);
*eff_core_nom_perf = (u16)((max_non_turbo_ratio * efficient) / 100);

View file

@ -26,12 +26,30 @@ enum cpu_perf_eff_type {
unsigned long acpi_create_madt_lapics_with_nmis_hybrid(unsigned long current);
#if CONFIG(SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID)
/*
* Read the performance and efficient core ratios.
* This is to be implemented by the SoC specific code if
* SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS is selected.
*/
#if CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS)
enum cb_err soc_read_core_scaling_factors(u16 *performance, u16 *efficient);
#else
static inline enum cb_err soc_read_core_scaling_factors(u16 *performance, u16 *efficient)
{
_Static_assert(CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR must not be zero");
_Static_assert(CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR must not be zero");
*performance = CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR;
*efficient = CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR;
return CB_SUCCESS;
}
#endif
#endif /* SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID */
/* Generates ACPI code to define _CPC control method */
void acpigen_write_CPPC_hybrid_method(int core_id);