diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index 91411b5264..b91a64a0e0 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -227,6 +227,7 @@ HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + NULL|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortProbeLib.inf } # diff --git a/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.c b/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.c index 79412897f2..e5612bb75d 100644 --- a/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.c @@ -1,7 +1,7 @@ /** @file Kvmtool virtual memory map library. - Copyright (c) 2018 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2018 - 2026, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,8 +9,6 @@ #include #include -#include -#include #include #include @@ -37,12 +35,9 @@ ArmVirtGetMemoryMap ( { ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; UINTN Idx; - EFI_PHYSICAL_ADDRESS TopOfAddressSpace; ASSERT (VirtualMemoryMap != NULL); - TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()); - VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR *) AllocatePages ( EFI_SIZE_TO_PAGES ( @@ -66,20 +61,13 @@ ArmVirtGetMemoryMap ( VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemorySize); VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; - // Peripheral space before DRAM - VirtualMemoryTable[++Idx].PhysicalBase = 0x0; - VirtualMemoryTable[Idx].VirtualBase = 0x0; - VirtualMemoryTable[Idx].Length = PcdGet64 (PcdSystemMemoryBase); + // Map the UART + ASSERT (IS_ALIGNED (PcdGet64 (PcdSerialRegisterBase), EFI_PAGE_SIZE)); + VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdSerialRegisterBase); + VirtualMemoryTable[Idx].VirtualBase = PcdGet64 (PcdSerialRegisterBase); + VirtualMemoryTable[Idx].Length = EFI_PAGE_SIZE; VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - // Peripheral space after DRAM - VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdSystemMemoryBase) + - PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase; - VirtualMemoryTable[Idx].Length = TopOfAddressSpace - - VirtualMemoryTable[Idx].PhysicalBase; - VirtualMemoryTable[Idx].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - // Map the FV region as normal executable memory VirtualMemoryTable[++Idx].PhysicalBase = PcdGet64 (PcdFvBaseAddress); VirtualMemoryTable[Idx].VirtualBase = VirtualMemoryTable[Idx].PhysicalBase; diff --git a/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf b/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf index a354e734ab..16b3564e48 100644 --- a/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf +++ b/ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/KvmtoolVirtMemInfoLib.inf @@ -27,8 +27,6 @@ [LibraryClasses] ArmLib - BaseLib - BaseMemoryLib DebugLib MemoryAllocationLib PcdLib @@ -37,6 +35,7 @@ gArmTokenSpaceGuid.PcdFvBaseAddress gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase [FixedPcd] gArmTokenSpaceGuid.PcdFvSize