From 23e2cde59791500c32765c5c53b37279347c1c95 Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Fri, 14 Jan 2022 19:20:15 +0530 Subject: soc/intel/alderlake: Implement get_soc_cpu_type helper function The patch implements get_soc_cpu_type() helper function which determines whether the executing CPU is a small or a big core. This is the SoC-specific callback that must be implemented for SoCs that select SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID. It will be called from set_cpu_type(). TEST=verified on Brya Signed-off-by: Sridhar Siricilla Change-Id: Icd0d7e8a42c4b20d3e1d34998bca6321509df2d8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61075 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/soc/intel/alderlake/cpu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/soc/intel/alderlake/cpu.c') diff --git a/src/soc/intel/alderlake/cpu.c b/src/soc/intel/alderlake/cpu.c index 92ffe87043..ed9c245234 100644 --- a/src/soc/intel/alderlake/cpu.c +++ b/src/soc/intel/alderlake/cpu.c @@ -19,12 +19,18 @@ #include #include #include +#include #include #include #include #include #include +enum alderlake_model { + ADL_MODEL_P_M = 0x9A, + ADL_MODEL_N = 0xBE, +}; + bool cpu_soc_is_in_untrusted_mode(void) { msr_t msr; @@ -69,6 +75,21 @@ static void configure_misc(void) wrmsr(MSR_POWER_CTL, msr); } +enum core_type get_soc_cpu_type(void) +{ + struct cpuinfo_x86 cpuinfo; + + if (cpu_is_hybrid_supported()) + return cpu_get_cpu_type(); + + get_fms(&cpuinfo, cpuid_eax(1)); + + if (cpuinfo.x86 == 0x6 && cpuinfo.x86_model == ADL_MODEL_N) + return CPUID_CORE_TYPE_INTEL_ATOM; + else + return CPUID_CORE_TYPE_INTEL_CORE; +} + /* All CPUs including BSP will run the following function. */ void soc_core_init(struct device *cpu) { -- cgit v1.2.3