Attention is currently required from: Tim Wawrzynczak, Patrick Rudolph. Sridhar Siricilla has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59361 )
Change subject: soc/intel/alderlake: Define a method to return a cpu type ......................................................................
soc/intel/alderlake: Define a method to return a cpu type
The patch implements get_cpu_type() function returns the type of cpu that executing the function.
TEST=Verified on Brya
Signed-off-by: Sridhar Siricilla sridhar.siricilla@intel.com Change-Id: Ifecedac822de71ebbdd43afe8431fd8aa1cdba4c --- M src/soc/intel/alderlake/cpu.c M src/soc/intel/alderlake/include/soc/cpu.h 2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/59361/1
diff --git a/src/soc/intel/alderlake/cpu.c b/src/soc/intel/alderlake/cpu.c index 59f50f1..be8b011 100644 --- a/src/soc/intel/alderlake/cpu.c +++ b/src/soc/intel/alderlake/cpu.c @@ -62,6 +62,31 @@ wrmsr(MSR_POWER_CTL, msr); }
+static uint32_t cpu_get_family(void) +{ + return cpuid_eax(1) & 0x0FFF0FF0; +} + +uint8_t get_cpu_type(void) +{ + if (cpu_is_hybrid_supported()) { + union cpuid_nat_model_id_and_core_type { + struct { + unsigned int native_mode_id:24; + unsigned int core_type:8; + } bits; + unsigned int hybrid_info; + }; + union cpuid_nat_model_id_and_core_type eax; + + eax.hybrid_info = cpuid_eax(CPUID_HYBRID_INFORMATION); + return (UINT8) eax.bits.core_type & 0xFF; + } else if (cpu_get_family() == CPUID_FULL_FAMILY_MODEL_ALDERLAKE_ATOM) + 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) { diff --git a/src/soc/intel/alderlake/include/soc/cpu.h b/src/soc/intel/alderlake/include/soc/cpu.h index 233e0c2..06b44a2 100644 --- a/src/soc/intel/alderlake/include/soc/cpu.h +++ b/src/soc/intel/alderlake/include/soc/cpu.h @@ -31,4 +31,6 @@ /* Get a bitmask of supported LPM states */ uint8_t get_supported_lpm_mask(void);
+/* It returns the cpu type - big or small core */ +uint8_t get_cpu_type(void); #endif