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 <rrangel@chromium.org>
Change-Id: Ibd77cc754fae5baccebe7adc5ae0790c79236d26
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61610
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
Raul E Rangel 2022-02-03 15:35:02 -07:00 committed by Raul Rangel
parent 83bc408416
commit c168f115e4
1 changed files with 8 additions and 1 deletions

View File

@ -4,11 +4,13 @@
#include <console/console.h> #include <console/console.h>
#include <console/cbmem_console.h> #include <console/cbmem_console.h>
#include <console/streams.h> #include <console/streams.h>
#include <console/uart.h>
#include <stdarg.h> #include <stdarg.h>
void console_hw_init(void) void console_hw_init(void)
{ {
__cbmemc_init(); __cbmemc_init();
__uart_init();
} }
int printk(int msg_level, const char *fmt, ...) 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; return 0;
cnt = vsnprintf(buf, sizeof(buf), fmt, args); cnt = vsnprintf(buf, sizeof(buf), fmt, args);
for (i = 0; i < cnt; i++) for (i = 0; i < cnt; i++) {
__cbmemc_tx_byte(buf[i]); __cbmemc_tx_byte(buf[i]);
if (buf[i] == '\n')
__uart_tx_byte('\r');
__uart_tx_byte(buf[i]);
}
svc_debug_print(buf); svc_debug_print(buf);
return i; return i;
} }