]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c
ArmVirtPkg/XenVirtMemInfoLib: refactor reading of the PA space size
[mirror_edk2.git] / ArmVirtPkg / Library / XenVirtMemInfoLib / XenVirtMemInfoLib.c
index 88ff3167cbfd4926049fb9414895686f3c01bc96..d40aad7804215fd6d704f4dec415f9347e72a724 100644 (file)
 \r
 #include <Base.h>\r
 #include <Library/ArmLib.h>\r
 \r
 #include <Base.h>\r
 #include <Library/ArmLib.h>\r
+#include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 \r
 STATIC ARM_MEMORY_REGION_DESCRIPTOR  mVirtualMemoryTable[2];\r
 \r
 #include <Library/DebugLib.h>\r
 \r
 STATIC ARM_MEMORY_REGION_DESCRIPTOR  mVirtualMemoryTable[2];\r
 \r
-EFI_PHYSICAL_ADDRESS\r
-ArmGetPhysAddrTop (\r
-  VOID\r
-  );\r
-\r
 /**\r
   Return the Virtual Memory Map of your platform\r
 \r
 /**\r
   Return the Virtual Memory Map of your platform\r
 \r
@@ -42,8 +38,12 @@ ArmVirtGetMemoryMap (
   OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap\r
   )\r
 {\r
   OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap\r
   )\r
 {\r
+  EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r
+\r
   ASSERT (VirtualMemoryMap != NULL);\r
 \r
   ASSERT (VirtualMemoryMap != NULL);\r
 \r
+  TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());\r
+\r
   //\r
   // Map the entire physical memory space as cached. The only device\r
   // we care about is the GIC, which will be stage 2 mapped as a device\r
   //\r
   // Map the entire physical memory space as cached. The only device\r
   // we care about is the GIC, which will be stage 2 mapped as a device\r
@@ -51,7 +51,7 @@ ArmVirtGetMemoryMap (
   //\r
   mVirtualMemoryTable[0].PhysicalBase = 0x0;\r
   mVirtualMemoryTable[0].VirtualBase  = 0x0;\r
   //\r
   mVirtualMemoryTable[0].PhysicalBase = 0x0;\r
   mVirtualMemoryTable[0].VirtualBase  = 0x0;\r
-  mVirtualMemoryTable[0].Length       = ArmGetPhysAddrTop ();\r
+  mVirtualMemoryTable[0].Length       = TopOfAddressSpace;\r
   mVirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
 \r
   mVirtualMemoryTable[1].PhysicalBase = 0x0;\r
   mVirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
 \r
   mVirtualMemoryTable[1].PhysicalBase = 0x0;\r