From 72f1e62bbbdd0ed5f45765e3c6cd5ef45a18e028 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 1 Sep 2021 12:35:15 +0530 Subject: arch/x86: Skip returning default leaf value as `0` `cpu_get_cache_info_leaf()` function is responsible to report leaf value for CPU that have support for deterministic cache cpuid. As per available datasheets from AMD and Intel the supported CPUID leafs are 0x8000_001d for AMD and 0x04 for Intel. Hence, this CL skips returning default leaf value as `0`. TEST=Verified fixes: e2b5fee3b006 (arch/x86: smbios write 7 table using deterministic cache functions) hang issue on ASRock E350M1. Change-Id: Iee33b39298e7821ac5280d998172b58a70c8715b Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/57305 Reviewed-by: Paul Menzel Reviewed-by: Tim Wawrzynczak Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/arch/x86/cpu_common.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/arch/x86/cpu_common.c b/src/arch/x86/cpu_common.c index 835cddd686..302a14e6d2 100644 --- a/src/arch/x86/cpu_common.c +++ b/src/arch/x86/cpu_common.c @@ -109,14 +109,11 @@ enum cpu_type cpu_check_deterministic_cache_cpuid_supported(void) static uint32_t cpu_get_cache_info_leaf(void) { - switch (cpu_check_deterministic_cache_cpuid_supported()) { - case CPUID_TYPE_AMD: - return DETERMINISTIC_CACHE_PARAMETERS_CPUID_AMD; - case CPUID_TYPE_INTEL: - return DETERMINISTIC_CACHE_PARAMETERS_CPUID_IA; - default: - return 0; - } + uint32_t leaf = (cpu_check_deterministic_cache_cpuid_supported() == CPUID_TYPE_AMD) ? + DETERMINISTIC_CACHE_PARAMETERS_CPUID_AMD : + DETERMINISTIC_CACHE_PARAMETERS_CPUID_IA; + + return leaf; } size_t cpu_get_cache_ways_assoc_info(const struct cpu_cache_info *info) -- cgit v1.2.3