diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-03-21 09:12:56 +0000 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-03-21 10:41:25 +0000 |
commit | 5d5a19028a55a1fb42c9e4304fc84108d3206296 (patch) | |
tree | efb2f857bb8007c9bc8340e3bfbca74c77642994 | |
parent | 60bd1e1269ff93390a90014144a835ad71fe2fa0 (diff) | |
download | edk2-5d5a19028a55a1fb42c9e4304fc84108d3206296.tar.gz edk2-5d5a19028a55a1fb42c9e4304fc84108d3206296.tar.bz2 edk2-5d5a19028a55a1fb42c9e4304fc84108d3206296.zip |
ArmVirtPkg/HighMemDxe: check new regions against GCD memory space map
Instead of looking at the PCD gArmTokenSpaceGuid.PcdSystemMemoryBase
to decide which DT node covers the memory we are already using, query
the GCD memory space map, which is the authoritative source for this
kind of information
This fixes a problem observed by Michael on platforms where this PCD
is of the 'Patchable' type, which means updates to its value do not
propagate to other modules.
Reported-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r-- | ArmVirtPkg/HighMemDxe/HighMemDxe.c | 30 | ||||
-rw-r--r-- | ArmVirtPkg/HighMemDxe/HighMemDxe.inf | 1 |
2 files changed, 19 insertions, 12 deletions
diff --git a/ArmVirtPkg/HighMemDxe/HighMemDxe.c b/ArmVirtPkg/HighMemDxe/HighMemDxe.c index 4e41120def..aa3f5f6d89 100644 --- a/ArmVirtPkg/HighMemDxe/HighMemDxe.c +++ b/ArmVirtPkg/HighMemDxe/HighMemDxe.c @@ -30,16 +30,17 @@ InitializeHighMemDxe ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- FDT_CLIENT_PROTOCOL *FdtClient;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
- EFI_STATUS Status, FindNodeStatus;
- INT32 Node;
- CONST UINT32 *Reg;
- UINT32 RegSize;
- UINTN AddressCells, SizeCells;
- UINT64 CurBase;
- UINT64 CurSize;
- UINT64 Attributes;
+ FDT_CLIENT_PROTOCOL *FdtClient;
+ EFI_CPU_ARCH_PROTOCOL *Cpu;
+ EFI_STATUS Status, FindNodeStatus;
+ INT32 Node;
+ CONST UINT32 *Reg;
+ UINT32 RegSize;
+ UINTN AddressCells, SizeCells;
+ UINT64 CurBase;
+ UINT64 CurSize;
+ UINT64 Attributes;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,
(VOID **)&FdtClient);
@@ -73,7 +74,14 @@ InitializeHighMemDxe ( }
RegSize -= (AddressCells + SizeCells) * sizeof (UINT32);
- if (PcdGet64 (PcdSystemMemoryBase) != CurBase) {
+ Status = gDS->GetMemorySpaceDescriptor (CurBase, &GcdDescriptor);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_WARN,
+ "%a: Region 0x%lx - 0x%lx not found in the GCD memory space map\n",
+ __FUNCTION__, CurBase, CurBase + CurSize - 1));
+ continue;
+ }
+ if (GcdDescriptor.GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
Status = gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, CurBase,
CurSize, EFI_MEMORY_WB);
diff --git a/ArmVirtPkg/HighMemDxe/HighMemDxe.inf b/ArmVirtPkg/HighMemDxe/HighMemDxe.inf index ac1761974f..a7072e38d0 100644 --- a/ArmVirtPkg/HighMemDxe/HighMemDxe.inf +++ b/ArmVirtPkg/HighMemDxe/HighMemDxe.inf @@ -45,7 +45,6 @@ gFdtClientProtocolGuid ## CONSUMES
[Pcd]
- gArmTokenSpaceGuid.PcdSystemMemoryBase
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
[Depex]
|