From c168f115e4eef82cef44d0c757fb03c6cb97fb95 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Thu, 3 Feb 2022 15:35:02 -0700 Subject: [PATCH] soc/amd/common/psp_verstage: Add UART support to PSP console This will allow PSP verstage to write logs to the serial console. We are no longer dependent on using a serial enabled PSP boot loader. Ideally we would delete this psp printk and use the standard printk. Since picasso doesn't currently support mapping the UART though, I'll keep it for now. BUG=b:215599230 TEST=Boot guybrush and verify PSP logs are output on serial console Signed-off-by: Raul E Rangel Change-Id: Ibd77cc754fae5baccebe7adc5ae0790c79236d26 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61610 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/soc/amd/common/psp_verstage/printk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/soc/amd/common/psp_verstage/printk.c b/src/soc/amd/common/psp_verstage/printk.c index c56f78c298..526b8e7a09 100644 --- a/src/soc/amd/common/psp_verstage/printk.c +++ b/src/soc/amd/common/psp_verstage/printk.c @@ -4,11 +4,13 @@ #include #include #include +#include #include void console_hw_init(void) { __cbmemc_init(); + __uart_init(); } int printk(int msg_level, const char *fmt, ...) @@ -33,8 +35,13 @@ int vprintk(int msg_level, const char *fmt, va_list args) return 0; cnt = vsnprintf(buf, sizeof(buf), fmt, args); - for (i = 0; i < cnt; i++) + for (i = 0; i < cnt; i++) { __cbmemc_tx_byte(buf[i]); + + if (buf[i] == '\n') + __uart_tx_byte('\r'); + __uart_tx_byte(buf[i]); + } svc_debug_print(buf); return i; }