From 52e5c94314fa8e10efded82db85d181ed32f00bd Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 4 Jun 2023 00:48:15 +0300 Subject: visionfive2 boots until debugging is initialized --- common/debug.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'common/debug.c') diff --git a/common/debug.c b/common/debug.c index 2cd4570..346934a 100644 --- a/common/debug.c +++ b/common/debug.c @@ -123,6 +123,12 @@ static struct uart_8250 *port = 0; */ static int __serial_tx_empty() { + /** + * @todo visionfive2 loops on lsr indefinitely, why? + * answer: because apparently visionfive2 uart has reg-shift = 2, + * meaning the registers are spaced apart more in memory than my naive + * struct. + * */ return port->lsr & LSR_THRE; } @@ -177,7 +183,13 @@ static struct dbg_info __dbg_from_fdt(const void *fdt) const char *stdout = fdt_getprop(fdt, chosen_offset, "stdout-path", NULL); - int stdout_offset = fdt_path_offset(fdt, stdout); + /* discard options */ + size_t baselen = strlen(stdout); + const char *options = strchr(stdout, ':'); + if (options) + baselen = options - stdout; + + int stdout_offset = fdt_path_offset_namelen(fdt, stdout, baselen); /* get serial device type */ const char *dev_name = (const char *)fdt_getprop(fdt, stdout_offset, -- cgit v1.3