summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2022-02-03 15:25:48 -0700
committerRaul Rangel <rrangel@chromium.org>2022-02-08 16:18:07 +0000
commit1828a541f158b0c518a4f6cfef6108a1fc4b885b (patch)
tree9ce6116eff798366e40ce5887e6a6e992ed6a08f
parente9665959edeba6ae2d5364c4f7339704b6b6fd42 (diff)
soc/amd/cezanne/psp_verstage: Implement get_uart_base
This will allow directly using the UART console. On PSP releases that don't support mapping the UART, we will just return NULL which is perfectly acceptable. BUG=b:215599230 TEST=Boot guybrush and verify verstage can print to the console Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: Ic8d7f0fe00794a715756f92e3fb32c6b512cb8aa Reviewed-on: https://review.coreboot.org/c/coreboot/+/61607 Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/soc/amd/cezanne/psp_verstage/Makefile.inc1
-rw-r--r--src/soc/amd/cezanne/psp_verstage/uart.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/soc/amd/cezanne/psp_verstage/Makefile.inc b/src/soc/amd/cezanne/psp_verstage/Makefile.inc
index ea9353d444..547650dcc6 100644
--- a/src/soc/amd/cezanne/psp_verstage/Makefile.inc
+++ b/src/soc/amd/cezanne/psp_verstage/Makefile.inc
@@ -9,6 +9,7 @@ subdirs-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += ../../common/psp_verstage
verstage-y += svc.c
verstage-y += chipset.c
+verstage-y += uart.c
verstage-y += $(top)/src/vendorcode/amd/fsp/cezanne/bl_uapp/bl_uapp_startup.S
verstage-y += $(top)/src/vendorcode/amd/fsp/cezanne/bl_uapp/bl_uapp_end.S
diff --git a/src/soc/amd/cezanne/psp_verstage/uart.c b/src/soc/amd/cezanne/psp_verstage/uart.c
new file mode 100644
index 0000000000..0f0baba07e
--- /dev/null
+++ b/src/soc/amd/cezanne/psp_verstage/uart.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <bl_uapp/bl_syscall_public.h>
+#include <amdblocks/uart.h>
+#include <types.h>
+
+static void *uart_bars[FCH_UART_ID_MAX - 1];
+
+uintptr_t get_uart_base(unsigned int idx)
+{
+ uint32_t err;
+
+ if (idx > ARRAY_SIZE(uart_bars))
+ return 0;
+
+ if (uart_bars[idx])
+ return (uintptr_t)uart_bars[idx];
+
+ err = svc_map_fch_dev(FCH_IO_DEVICE_UART, idx, 0, &uart_bars[idx]);
+ if (err) {
+ svc_debug_print("Failed to map UART\n");
+ return 0;
+ }
+
+ return (uintptr_t)uart_bars[idx];
+}