diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2019-01-14 17:00:38 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2019-01-16 21:40:40 +0100 |
commit | 68de2a4996cd315b3fee7efbfa5822128f4146da (patch) | |
tree | ff61b6a7de1d6a73b89483377d9b14740142944b /Silicon/Socionext/SynQuacer/Library | |
parent | 248007cd73191289ca9b691a4626366fc8fd693c (diff) |
Silicon/SynQuacerMemoryInitPeiLib: don't map memory above MAX_ALLOC_ADDRESS
When encountering memory that is above the threshold of what we can
map, don't add it to the virtual memory table. This table is only
used by the early MMU code that creates the 1:1 mapping, and since
it cannot be mapped in the first place, there is no point.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'Silicon/Socionext/SynQuacer/Library')
-rw-r--r-- | Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c index e68997e0..406793c2 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerMemoryInitPeiLib/SynQuacerMemoryInitPeiLib.c @@ -159,17 +159,22 @@ DeclareDram ( DramDescriptor = *VirtualMemoryTable + ARRAY_SIZE (mVirtualMemoryTable);
- for (Idx = 0; Idx < RegionCount; Idx++, DramDescriptor++) {
+ for (Idx = 0; Idx < RegionCount; Idx++) {
Status = DramInfo->GetRegion (Idx, &Base, &Size);
ASSERT_EFI_ERROR (Status);
BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,
mDramResourceAttributes, Base, Size);
+ if (Base > MAX_ALLOC_ADDRESS - Size + 1) {
+ continue;
+ }
+
DramDescriptor->PhysicalBase = Base;
DramDescriptor->VirtualBase = Base;
- DramDescriptor->Length = Size;
+ DramDescriptor->Length = MIN (Size, MAX_ALLOC_ADDRESS - Base + 1);
DramDescriptor->Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+ DramDescriptor++;
}
DramDescriptor->PhysicalBase = 0;
|