git: 4b9057dbb7c1 - stable/15 - uart: Set the bus space tag before parsing hw.uart.console
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 16:21:53 UTC
The branch stable/15 has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=4b9057dbb7c1c87e74921403c2f6e1dea0efd103
commit 4b9057dbb7c1c87e74921403c2f6e1dea0efd103
Author: Rick Richard <rick@sloservers.com>
AuthorDate: 2026-10-03 16:00:00 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-11-12 16:21:46 +0000
uart: Set the bus space tag before parsing hw.uart.console
uart_cpu_getdev() lets hw.uart.console override the FDT, but
uart_getenv() maps an "mm:" address with uart_bus_space_mem, which is
only assigned after the FDT probe. On riscv and arm it is still NULL
at that point, so bus_space_map() faults before there is a console.
On riscv this happens on any EFI boot where the firmware provides an
SPCR table, since the loader turns it into hw.uart.console.
Initialize uart_bus_space_mem to fdtbus_bs_tag, as uart_cpu_arm64.c
does with &memmap_bus (See also 0624eddcffefe).
PR: 299089
Reviewed by: mhorne
MFC after: 1 week
Signed-off-by: Rick Richard <rick@sloservers.com>
(cherry picked from commit 9db8ae83e62e9a1391674a14b0b7d76de2e3c3f7)
---
sys/dev/uart/uart_cpu_fdt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c
index fd1647cd78aa..bc7b9e2cb016 100644
--- a/sys/dev/uart/uart_cpu_fdt.c
+++ b/sys/dev/uart/uart_cpu_fdt.c
@@ -50,6 +50,8 @@
#include <dev/uart/uart_cpu.h>
#include <dev/uart/uart_cpu_fdt.h>
+extern bus_space_tag_t fdtbus_bs_tag;
+
/*
* UART console routines.
*/
@@ -78,6 +80,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
u_int shift, iowidth, rclk;
int br, err;
+ uart_bus_space_mem = fdtbus_bs_tag;
+
/* Allow overriding the FDT using the environment. */
class = &uart_ns8250_class;
err = uart_getenv(devtype, di, class);