--- /dev/null
+/** @file\r
+\r
+ Copyright (c) 2014-2017, Linaro Limited. All rights reserved.\r
+\r
+ This program and the accompanying materials are licensed and made available\r
+ under the terms and conditions of the BSD License which accompanies this\r
+ distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/ArmLib.h>\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
+ This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU\r
+ on your platform.\r
+\r
+ @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR\r
+ describing a Physical-to-Virtual Memory\r
+ mapping. This array must be ended by a\r
+ zero-filled entry. The allocated memory\r
+ will not be freed.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ArmVirtGetMemoryMap (\r
+ OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r
+ )\r
+{\r
+ ASSERT (VirtualMemoryMap != NULL);\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
+ // by the hypervisor, overriding the cached mapping we install here.\r
+ //\r
+ mVirtualMemoryTable[0].PhysicalBase = 0x0;\r
+ mVirtualMemoryTable[0].VirtualBase = 0x0;\r
+ mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop ();\r
+ mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
+\r
+ mVirtualMemoryTable[1].PhysicalBase = 0x0;\r
+ mVirtualMemoryTable[1].VirtualBase = 0x0;\r
+ mVirtualMemoryTable[1].Length = 0x0;\r
+ mVirtualMemoryTable[1].Attributes = 0x0;\r
+\r
+ *VirtualMemoryMap = mVirtualMemoryTable;\r
+}\r