From 97bd2a7f33a784b63b8ede4efc23f39d4dfce37b Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Mon, 17 Feb 2020 13:17:19 -0700 Subject: soc/amd/picasso: Add helper functions for finding SOC type We're running into more and more situations where we need to tell one SOC type from another, and instead of rewriting them every time, just add some helper functions to the picasso SOC directory. Change-Id: I24b73145cdfa80c09fbe036d1fb6079696c6d013 Signed-off-by: Martin Roth Reviewed-on: https://chromium-review.googlesource.com/2051514 Reviewed-on: https://chromium-review.googlesource.com/2060904 Reviewed-on: https://chromium-review.googlesource.com/2060905 Reviewed-by: Martin Roth Reviewed-by: Eric Peers Reviewed-by: Raul E Rangel Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/39886 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel Reviewed-by: Angel Pons --- src/soc/amd/picasso/soc_util.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/soc/amd/picasso/soc_util.c (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 new file mode 100644 index 0000000000..893ff2570f --- /dev/null +++ b/src/soc/amd/picasso/soc_util.c @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* This file is part of the coreboot project. */ + +#include +#include +#include + +int soc_is_pollock(void) +{ + return soc_is_zen_plus() && CONFIG(AMD_FT5); +} + +int soc_is_dali(void) +{ + return soc_is_raven2() && CONFIG(AMD_FP5); +} + +int soc_is_picasso(void) +{ + return soc_is_zen_plus() && CONFIG(AMD_FP5); +} + +int soc_is_raven2(void) +{ + /* mask lower model number nibble and stepping */ + return cpuid_eax(1) >> 8 == RAVEN2_CPUID >> 8; +} + +int soc_is_zen_plus(void) +{ + /* mask lower model number nibble and stepping */ + return cpuid_eax(1) >> 8 == PICASSO_CPUID >> 8; +} -- cgit v1.2.3