diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-05-02 01:48:10 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-05-02 01:48:10 +0800 |
| commit | ae72f8dcb029eed0f054b4c8b845868229b07038 (patch) | |
| tree | b85a0288afde4f5350e424e6cc0e12a4bad13a95 /na/drivers | |
| parent | 12bd3efdbbabde0fda7d56ee82def083006e0c26 (diff) | |
| download | lume-ae72f8dcb029eed0f054b4c8b845868229b07038.tar.gz lume-ae72f8dcb029eed0f054b4c8b845868229b07038.tar.xz | |
feat: update UART handling and memory management parameters for improved functionality
Diffstat (limited to 'na/drivers')
| -rw-r--r-- | na/drivers/uart.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/na/drivers/uart.cc b/na/drivers/uart.cc index 802e88d..97c3e38 100644 --- a/na/drivers/uart.cc +++ b/na/drivers/uart.cc @@ -13,7 +13,8 @@ #include <lume/addr.h> #include <arch/config.h> -static uint64 g_uart_pa = arch::kDefaultUartPA; +static uint64 g_uart_pa = 0; +static uint64 g_uart_size = 0; extern "C" void early_putc(char c) { if (!g_uart_pa) return; @@ -27,9 +28,11 @@ extern "C" void early_puts(const char* s) { void console_early_init(uint64 fdt_paddr) { uint64 pa = 0; - FdtManager::early_scan_uart(fdt_paddr, &pa); + uint64 size = 0; + FdtManager::early_scan_uart(fdt_paddr, &pa, &size); if (pa != 0) { g_uart_pa = pa; + if (size != 0) g_uart_size = size; } } @@ -38,7 +41,7 @@ void console_init() { * Once vmm_init() activates the new page table, the 1GB identity map is dropped. * The UART must be explicitly registered into the active page table. */ - if (g_uart_pa != 0) { - vmm_map_kernel_mmio(g_uart_pa, 0x1000); + if (g_uart_pa != 0 && g_uart_size != 0) { + vmm_map_kernel_mmio(g_uart_pa, g_uart_size); } } |
