MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS

Update the GCD memory map initialization code so it disregards
memory that is not addressable by the CPU at boot time. This
only affects the first memory descriptor that is added, other
memory descriptors are permitted that describe memory ranges
that may be accessible to the CPU itself only when executing
under the OS.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
Ard Biesheuvel 2018-12-07 11:52:49 +01:00
parent 67b8f806d2
commit 36b0754712
1 changed files with 4 additions and 4 deletions

View File

@ -2284,7 +2284,7 @@ CoreInitializeMemoryServices (
// region that is big enough to initialize the DXE core. Always skip the PHIT Resource HOB. // region that is big enough to initialize the DXE core. Always skip the PHIT Resource HOB.
// The max address must be within the physically addressible range for the processor. // The max address must be within the physically addressible range for the processor.
// //
HighAddress = MAX_ADDRESS; HighAddress = MAX_ALLOC_ADDRESS;
for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
// //
// Skip the Resource Descriptor HOB that contains the PHIT // Skip the Resource Descriptor HOB that contains the PHIT
@ -2300,7 +2300,7 @@ CoreInitializeMemoryServices (
} }
// //
// Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ADDRESS // Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ALLOC_ADDRESS
// //
ResourceHob = Hob.ResourceDescriptor; ResourceHob = Hob.ResourceDescriptor;
if (ResourceHob->ResourceType != EFI_RESOURCE_SYSTEM_MEMORY) { if (ResourceHob->ResourceType != EFI_RESOURCE_SYSTEM_MEMORY) {
@ -2309,14 +2309,14 @@ CoreInitializeMemoryServices (
if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) != TESTED_MEMORY_ATTRIBUTES) { if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) != TESTED_MEMORY_ATTRIBUTES) {
continue; continue;
} }
if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS) { if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS) {
continue; continue;
} }
// //
// Skip Resource Descriptor HOBs that are below a previously found Resource Descriptor HOB // Skip Resource Descriptor HOBs that are below a previously found Resource Descriptor HOB
// //
if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) { if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) {
continue; continue;
} }