summaryrefslogtreecommitdiffstats
path: root/src/soc/amd/picasso/soc_util.c
diff options
context:
space:
mode:
authorFelix Held <felix.held@amd.corp-partner.google.com>2020-05-18 20:27:04 +0200
committerFelix Held <felix-coreboot@felixheld.de>2020-05-20 00:06:34 +0000
commitbf213087057f61b37d9586414e47a8cf2cfc23a1 (patch)
tree382ced2455ca3131fb2bcda49b03e41d4767bf0f /src/soc/amd/picasso/soc_util.c
parent4480dc1ca1fd6982a3b4cbc6cf1531992f517fb2 (diff)
downloadcoreboot-bf213087057f61b37d9586414e47a8cf2cfc23a1.tar.gz
coreboot-bf213087057f61b37d9586414e47a8cf2cfc23a1.tar.bz2
coreboot-bf213087057f61b37d9586414e47a8cf2cfc23a1.zip
soc/amd/picasso/soc_util: add socket type detection and printing
Change-Id: I643a4c5f8a42a5fb0603a1a049545b57d16493a6 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41517 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/picasso/soc_util.c')
-rw-r--r--src/soc/amd/picasso/soc_util.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/soc_util.c b/src/soc/amd/picasso/soc_util.c
index 94ebb6b066c6..a70d833d8037 100644
--- a/src/soc/amd/picasso/soc_util.c
+++ b/src/soc/amd/picasso/soc_util.c
@@ -1,8 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cpu.h>
+#include <console/console.h>
#include <soc/cpu.h>
#include <soc/soc_util.h>
+#include <types.h>
+
+#define SOCKET_TYPE_SHIFT 28
+#define SOCKET_TYPSE_MASK (0xf << SOCKET_TYPE_SHIFT)
+
+static enum socket_type get_socket_type(void)
+{
+ uint32_t ebx = cpuid_ebx(0x80000001);
+ ebx = (ebx & SOCKET_TYPSE_MASK) >> SOCKET_TYPE_SHIFT;
+ return (enum socket_type)ebx;
+}
+
+void print_socket_type(void)
+{
+ enum socket_type socket = get_socket_type();
+
+ printk(BIOS_INFO, "Socket type: ");
+
+ switch (socket) {
+ case SOCKET_FP5:
+ printk(BIOS_INFO, "FP5\n");
+ break;
+ case SOCKET_AM4:
+ printk(BIOS_INFO, "AM4\n");
+ break;
+ case SOCKET_FT5:
+ printk(BIOS_INFO, "FT5\n");
+ break;
+ default:
+ printk(BIOS_INFO, "unknown\n");
+ }
+}
int soc_is_pollock(void)
{