Revision: 18427
          http://sourceforge.net/p/edk2/code/18427
Author:   abiesheuvel
Date:     2015-09-09 14:48:33 +0000 (Wed, 09 Sep 2015)
Log Message:
-----------
ArmVirtPkg/ArmVirtMemoryInitPeiLib: handle memory above 4 GB on 32-bit ARM

On 32-bit ARM, split system memory into a region below (and up to) 4 GB
and a region above 4 GB. This is necessary to get the DXE core to consider
the former as the resource descriptor that describes the primary memory
region that also covers the PHIT region.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c

Modified: 
trunk/edk2/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c
===================================================================
--- 
trunk/edk2/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c 
    2015-09-09 14:48:25 UTC (rev 18426)
+++ 
trunk/edk2/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c 
    2015-09-09 14:48:33 UTC (rev 18427)
@@ -56,6 +56,7 @@
   )
 {
   EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
+  UINT64                      SystemMemoryTop;
 
   // Ensure PcdSystemMemorySize has been set
   ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);
@@ -73,13 +74,31 @@
       EFI_RESOURCE_ATTRIBUTE_TESTED
   );
 
-  BuildResourceDescriptorHob (
-      EFI_RESOURCE_SYSTEM_MEMORY,
-      ResourceAttributes,
-      PcdGet64 (PcdSystemMemoryBase),
-      PcdGet64 (PcdSystemMemorySize)
-  );
+  SystemMemoryTop = PcdGet64 (PcdSystemMemoryBase) +
+                    PcdGet64 (PcdSystemMemorySize);
 
+  if (SystemMemoryTop - 1 > MAX_ADDRESS) {
+    BuildResourceDescriptorHob (
+        EFI_RESOURCE_SYSTEM_MEMORY,
+        ResourceAttributes,
+        PcdGet64 (PcdSystemMemoryBase),
+        (UINT64)MAX_ADDRESS - PcdGet64 (PcdSystemMemoryBase) + 1
+        );
+    BuildResourceDescriptorHob (
+        EFI_RESOURCE_SYSTEM_MEMORY,
+        ResourceAttributes,
+        (UINT64)MAX_ADDRESS + 1,
+        SystemMemoryTop - MAX_ADDRESS - 1
+        );
+  } else {
+    BuildResourceDescriptorHob (
+        EFI_RESOURCE_SYSTEM_MEMORY,
+        ResourceAttributes,
+        PcdGet64 (PcdSystemMemoryBase),
+        PcdGet64 (PcdSystemMemorySize)
+        );
+  }
+
   //
   // When running under virtualization, the PI/UEFI memory region may be
   // clean but not invalidated in system caches or in lower level caches


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to