From 97675f2fc495e85b8b595467b5b39cf4467d1322 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sun, 07 Dec 2025 22:22:04 +0100 Subject: [PATCH] arm: relocate UART when remapping virtual memory The uart virtual address changes as soon as we apply the kernel memory map. gUART is used only after that, from serial_init() onwards. So it should use the virtual address, and not the physical address it was previously created with while parsing the FDT. Change-Id: I8c8a024fe564b49d6555f8e48f5ab31652d30708 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10068 Reviewed-by: Fredrik Holmqvist Tested-by: Commit checker robot Reviewed-by: waddlesplash --- headers/private/kernel/arch/generic/debug_uart.h | 1 + src/system/boot/platform/efi/arch/arm/arch_mmu.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/headers/private/kernel/arch/generic/debug_uart.h b/headers/private/kernel/arch/generic/debug_uart.h index c6a660e..862f8c1 100644 --- a/headers/private/kernel/arch/generic/debug_uart.h +++ b/headers/private/kernel/arch/generic/debug_uart.h @@ -35,6 +35,7 @@ virtual void FlushTx() = 0; virtual void FlushRx() = 0; + void SetBase(addr_t base) { fBase = base; } addr_t Base() const { return fBase; } int64 Clock() const { return fClock; } bool Enabled() const { return fEnabled; } diff --git a/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp b/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp index 54897ed..1acd293 100644 --- a/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp +++ b/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp @@ -8,12 +8,14 @@ #include #include +#include #include #include #include #include #include + #include "efi_platform.h" #include "generic_mmu.h" #include "mmu.h" @@ -29,6 +31,8 @@ static constexpr bool kTraceMemoryMap = false; static constexpr bool kTracePageDirectory = false; + +extern DebugUART* gUART; // Ignore memory above 512GB @@ -281,6 +285,7 @@ map_range_to_new_area(gKernelArgs.arch_args.uart.regs, ARM_MMU_L2_FLAG_B | ARM_MMU_L2_FLAG_HAIKU_KERNEL_RW | ARM_MMU_L2_FLAG_XN); + gUART->SetBase(gKernelArgs.arch_args.uart.regs.start); sort_address_ranges(gKernelArgs.virtual_allocated_range, gKernelArgs.num_virtual_allocated_ranges); -- gitore 0.2.3