From 53b08c347f54970cf5f6ce35b8e1a1fe5f8a11f9 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Mon, 10 Dec 2018 14:11:35 +0530 Subject: cpuid: Add helper function for cpuid(1) functions This patch introduces 3 helper function for cpuid(1) : 1. cpu_get_cpuid() -> to get processor id (from cpuid.eax) 2. cpu_get_feature_flags_ecx -> to get processor feature flag (from cpuid.ecx) 3. cpu_get_feature_flags_edx -> to get processor feature flag (from cpuid.edx) Above 3 helper functions are targeted to replace majority of cpuid(1) references. Change-Id: Ib96a7c79dadb1feff0b8d58aa408b355fbb3bc50 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/30123 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/intel/quark/romstage/report_platform.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/soc/intel/quark') diff --git a/src/soc/intel/quark/romstage/report_platform.c b/src/soc/intel/quark/romstage/report_platform.c index 5ed8a5f9cb..640f5b0594 100644 --- a/src/soc/intel/quark/romstage/report_platform.c +++ b/src/soc/intel/quark/romstage/report_platform.c @@ -67,14 +67,13 @@ static uint32_t fuse_port_read(uint32_t offset) static void report_cpu_info(void) { - struct cpuid_result cpuidr; const char *cpu_type = "Unknown"; u32 d_variant; u32 ecc_enabled; u32 extended_temp; u32 i; u8 revision; - u32 secure_boot; + u32 secure_boot, cpu_id; const char *stepping = "Unknown"; /* Determine if ECC is enabled */ @@ -94,9 +93,9 @@ static void report_cpu_info(void) extended_temp = 0; /* Look for string to match the CPU ID value */ - cpuidr = cpuid(1); + cpu_id = cpu_get_cpuid(); for (i = 0; i < ARRAY_SIZE(cpu_table); i++) { - if ((cpu_table[i].cpuid == cpuidr.eax) + if ((cpu_table[i].cpuid == cpu_id) && (cpu_table[i].extended_temp == extended_temp) && (cpu_table[i].ecc == ecc_enabled) && (cpu_table[i].secure_boot == secure_boot) @@ -118,7 +117,7 @@ static void report_cpu_info(void) } } - printk(BIOS_DEBUG, "CPU: ID %x:%x, %s %s Stepping\n", cpuidr.eax, + printk(BIOS_DEBUG, "CPU: ID %x:%x, %s %s Stepping\n", cpu_id, revision, cpu_type, stepping); } -- cgit v1.2.3