diff options
Diffstat (limited to 'na/drivers/uart.cc')
| -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); } } |
