diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/amd/cezanne/psp_verstage/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/amd/cezanne/psp_verstage/uart.c | 26 |
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]; +} |