summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c13
-rw-r--r--Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/PlatformConfiguration.c12
2 files changed, 23 insertions, 2 deletions
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
index f6ab5c91bd..8843c14ddb 100644
--- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
+++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c
@@ -149,6 +149,11 @@ AddMemRegionHobs (
}
for (Index = 0; Index < MemRegionsCnt; Index++) {
+ // Skip zero-length regions so no empty resource or allocation HOBs are built.
+ if (MemRegions[Index].MemSize == 0) {
+ continue;
+ }
+
switch (MemRegions[Index].BuildHobOption) {
case AllocOnly:
BuildMemoryHob (&MemRegions[Index]);
@@ -221,9 +226,15 @@ GeneratePageTableRegionMap (
CacheAttributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
for (MemoryRegionCount = 0; MemoryRegionCount < RegionsCnt; MemoryRegionCount++) {
+ BUILD_HOB_OPTION_TYPE HobValue = MemRegions[MemoryRegionCount].BuildHobOption;
+
+ // Skip zero-length regions; a zero Length terminates the MMU table.
+ if (MemRegions[MemoryRegionCount].MemSize == 0) {
+ continue;
+ }
+
// Skip entries which explicitly ask to be added as HOB only
// Also skip entries that are marked as NoMap so a hole is created.
- BUILD_HOB_OPTION_TYPE HobValue = MemRegions[MemoryRegionCount].BuildHobOption;
if ((HobValue == HobOnlyNoCacheSetting) || (HobValue == NoMap) || (HobValue == AddDynamicMem)) {
continue;
}
diff --git a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/PlatformConfiguration.c b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/PlatformConfiguration.c
index 8b006c135a..9ad35ca928 100644
--- a/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/PlatformConfiguration.c
+++ b/Platform/Qualcomm/QualcommMinPlatformPkg/Library/ArmPlatformLib/PlatformConfiguration.c
@@ -881,6 +881,10 @@ AddNonFdRegions (
DDRMemSize = 0;
for (EntryIndex = 0; EntryIndex < EntryCount; EntryIndex++) {
+ if (EntryTable[EntryIndex].MemSize == 0) {
+ continue;
+ }
+
DDRMemSize += EntryTable[EntryIndex].MemSize;
RegionEndAddr = EntryTable[EntryIndex].MemBase + EntryTable[EntryIndex].MemSize;
@@ -1064,6 +1068,10 @@ UpdateDynamicMemoryRegions (
for (RamPartIndex = 0; RamPartIndex < RamPartTableEntryCount; RamPartIndex++) {
UINT64 RamPartitionEntryEndAddress;
+ if (RamPartTableEntry[RamPartIndex].MemSize == 0) {
+ continue;
+ }
+
RamPartitionEntryEndAddress = RamPartTableEntry[RamPartIndex].MemBase +
RamPartTableEntry[RamPartIndex].MemSize;
if ((RamPartitionEntryEndAddress >= mMemRegions[MemRgnCnt].MemBase) &&
@@ -1133,7 +1141,9 @@ AddUpperMemoryFromRamPartitions (
HighestIndex = EntryCount; /* sentinel: no match */
for (Index = 0; Index < EntryCount; Index++) {
- if (EntryList[Index].MemBase > HighestBase) {
+ if ((EntryList[Index].MemSize != 0) &&
+ (EntryList[Index].MemBase > HighestBase))
+ {
HighestBase = EntryList[Index].MemBase;
HighestSize = EntryList[Index].MemSize;
HighestIndex = Index;