From b6969db5c2313b60dcfe0c318c06e5b97780e880 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 6 Feb 2023 19:47:11 +0100 Subject: soc/amd/picasso/soc_util: use cpuid_match Now that there is a cpuid_match function, we can use it instead of doing basically the same thing manually. In the functions is_fam17_1x and is_fam17_2x both the stepping number and the lower nibble of the model number are masked out. To avoid having magic constants in the code, introduce the CPUID_ALL_STEPPINGS_AND_BASE_MODELS_MASK definition. Signed-off-by: Felix Held Change-Id: I758f9564c08c62c747cc4f93a8d6b540a1834a62 Reviewed-on: https://review.coreboot.org/c/coreboot/+/72860 Reviewed-by: Fred Reitberger Reviewed-by: Martin Roth Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/soc/amd/picasso/soc_util.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/soc/amd/picasso/soc_util.c') diff --git a/src/soc/amd/picasso/soc_util.c b/src/soc/amd/picasso/soc_util.c index 59c82c65cd..d2ac6db7cd 100644 --- a/src/soc/amd/picasso/soc_util.c +++ b/src/soc/amd/picasso/soc_util.c @@ -93,32 +93,29 @@ static bool is_mystery_silicon(void) static bool is_fam17_1x(void) { - /* mask lower model number nibble and stepping */ - return cpuid_eax(1) >> 8 == PICASSO_B0_CPUID >> 8; + return cpuid_match(cpuid_eax(1), PICASSO_B0_CPUID, + CPUID_ALL_STEPPINGS_AND_BASE_MODELS_MASK); } static bool is_fam17_11(void) { - /* only mask stepping */ - return cpuid_eax(1) >> 4 == RAVEN1_B0_CPUID >> 4; + return cpuid_match(cpuid_eax(1), RAVEN1_B0_CPUID, CPUID_ALL_STEPPINGS_MASK); } static bool is_fam17_18(void) { - /* only mask stepping */ - return cpuid_eax(1) >> 4 == PICASSO_B0_CPUID >> 4; + return cpuid_match(cpuid_eax(1), PICASSO_B0_CPUID, CPUID_ALL_STEPPINGS_MASK); } static bool is_fam17_2x(void) { - /* mask lower model number nibble and stepping */ - return cpuid_eax(1) >> 8 == RAVEN2_A0_CPUID >> 8; + return cpuid_match(cpuid_eax(1), RAVEN2_A0_CPUID, + CPUID_ALL_STEPPINGS_AND_BASE_MODELS_MASK); } static bool is_fam17_20(void) { - /* only mask stepping */ - return cpuid_eax(1) >> 4 == RAVEN2_A0_CPUID >> 4; + return cpuid_match(cpuid_eax(1), RAVEN2_A0_CPUID, CPUID_ALL_STEPPINGS_MASK); } enum silicon_type get_silicon_type(void) -- cgit v1.2.3