[riscv] Add support for writing prefix debug messages direct to a UART

Some platforms (such as the Sipeed Lichee Pi 4A) do not provide a
functional SBI debug console.  We can obtain early debug messages on
these systems by writing directly to the UART used by the vendor
firmware.

There is no viable way to parse the UART address from the device tree,
since the prefix debug messages occur extremely early, before the C
runtime environment is available and therefore before any information
has been parsed from the device tree.  The early UART model and
register addresses must be configured by editing config/serial.h if
needed.  (This is an acceptable limitation, since prefix debugging is
an extremely specialised use case.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-27 14:49:06 +01:00
parent 2e8d45aeef
commit 98fdfdd255
2 changed files with 84 additions and 0 deletions

View File

@@ -27,6 +27,11 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define COMSTOP 1 /* Stop bits */
#endif
/* Early UART configuration (for bare metal prefix debugging only) */
//#define EARLY_UART_MODEL 8250
//#define EARLY_UART_REG_BASE 0x10000000
//#define EARLY_UART_REG_SHIFT 0
#include <config/named.h>
#include NAMED_CONFIG(serial.h)
#include <config/local/serial.h>