]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 7 Dec 2018 11:01:25 +0000 (12:01 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 20 Dec 2018 10:02:40 +0000 (11:02 +0100)
The current ArmVirtMemoryInitPeiLib code splits the memory region passed
via PcdSystemMemoryBase/PcdSystemMemorySize in two if the region extends
beyond the MAX_ADDRESS limit. This was introduced for 32-bit ARM, which
may support more than 4 GB of physical address space, but cannot address
all of it via a 1:1 mapping, and a single region that is not mappable
in its entirety is unusable by the PEI core.

AArch64 is in a similar situation now: platforms may support more than
256 TB of physical address space, but only 256 TB is addressable by the
CPU, and so a memory region that extends from below this limit to above
it should be split.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c

index 05afd128242251d3fbe8bb110b2cea67a138a478..66925fc05ebd29511c3470658ad298785d1dec5e 100644 (file)
@@ -75,18 +75,18 @@ MemoryPeim (
   SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +\r
                     PcdGet64 (PcdSystemMemorySize);\r
 \r
   SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +\r
                     PcdGet64 (PcdSystemMemorySize);\r
 \r
-  if (SystemMemoryTop - 1 > MAX_ADDRESS) {\r
+  if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) {\r
     BuildResourceDescriptorHob (\r
         EFI_RESOURCE_SYSTEM_MEMORY,\r
         ResourceAttributes,\r
         PcdGet64 (PcdSystemMemoryBase),\r
     BuildResourceDescriptorHob (\r
         EFI_RESOURCE_SYSTEM_MEMORY,\r
         ResourceAttributes,\r
         PcdGet64 (PcdSystemMemoryBase),\r
-        (UINT64)MAX_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1\r
+        (UINT64)MAX_ALLOC_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1\r
         );\r
     BuildResourceDescriptorHob (\r
         EFI_RESOURCE_SYSTEM_MEMORY,\r
         ResourceAttributes,\r
         );\r
     BuildResourceDescriptorHob (\r
         EFI_RESOURCE_SYSTEM_MEMORY,\r
         ResourceAttributes,\r
-        (UINT64)MAX_ADDRESS + 1,\r
-        SystemMemoryTop - MAX_ADDRESS - 1\r
+        (UINT64)MAX_ALLOC_ADDRESS + 1,\r
+        SystemMemoryTop - MAX_ALLOC_ADDRESS - 1\r
         );\r
   } else {\r
     BuildResourceDescriptorHob (\r
         );\r
   } else {\r
     BuildResourceDescriptorHob (\r