Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85897?usp=email )
Change subject: soc/intel/common: Simply code accessing scaling factors ......................................................................
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 --- M src/soc/intel/common/block/acpi/cpu_hybrid.c M src/soc/intel/common/block/include/intelblocks/acpi.h 2 files changed, 18 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/85897/1
diff --git a/src/soc/intel/common/block/acpi/cpu_hybrid.c b/src/soc/intel/common/block/acpi/cpu_hybrid.c index 2c3b84c..ee4777a 100644 --- a/src/soc/intel/common/block/acpi/cpu_hybrid.c +++ b/src/soc/intel/common/block/acpi/cpu_hybrid.c @@ -110,22 +110,8 @@ 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); diff --git a/src/soc/intel/common/block/include/intelblocks/acpi.h b/src/soc/intel/common/block/include/intelblocks/acpi.h index a3f8248..4dfd3be 100644 --- a/src/soc/intel/common/block/include/intelblocks/acpi.h +++ b/src/soc/intel/common/block/include/intelblocks/acpi.h @@ -31,7 +31,23 @@ * 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
/* Generates ACPI code to define _CPC control method */ void acpigen_write_CPPC_hybrid_method(int core_id);