aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/sabrina/psp_verstage/uart.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/soc/amd/sabrina/psp_verstage/uart.c b/src/soc/amd/sabrina/psp_verstage/uart.c
index 1c89f10c99..2767b2eb27 100644
--- a/src/soc/amd/sabrina/psp_verstage/uart.c
+++ b/src/soc/amd/sabrina/psp_verstage/uart.c
@@ -4,8 +4,23 @@
#include <amdblocks/uart.h>
#include <types.h>
+static void *uart_bars[FCH_UART_ID_MAX];
+
uintptr_t get_uart_base(unsigned int idx)
{
- /* Mapping the UART is not supported. */
- return 0;
+ 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];
}