[PATCH] lib: serial: sifive-uart: add shared memory region for SiFive UART
Yu-Chien Peter Lin
peter.lin at sifive.com
Thu Aug 14 04:10:12 PDT 2025
Add shared memory region so the driver has permission
to access it in OpenSBI.
Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
---
lib/utils/serial/sifive-uart.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/utils/serial/sifive-uart.c b/lib/utils/serial/sifive-uart.c
index 3581d47a..55637137 100644
--- a/lib/utils/serial/sifive-uart.c
+++ b/lib/utils/serial/sifive-uart.c
@@ -9,6 +9,7 @@
#include <sbi/riscv_io.h>
#include <sbi/sbi_console.h>
+#include <sbi/sbi_domain.h>
#include <sbi_utils/serial/sifive-uart.h>
/* clang-format off */
@@ -111,5 +112,7 @@ int sifive_uart_init(unsigned long base, u32 in_freq, u32 baudrate)
sbi_console_set_device(&sifive_console);
- return 0;
+ return sbi_domain_root_add_memrange(base, PAGE_SIZE, PAGE_SIZE,
+ (SBI_DOMAIN_MEMREGION_MMIO |
+ SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW));
}
--
2.48.0
More information about the opensbi
mailing list