3 Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/ArmLib.h>
11 #include <Library/BaseLib.h>
12 #include <Library/DebugLib.h>
14 STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable
[2];
17 Return the Virtual Memory Map of your platform
19 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
22 @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR
23 describing a Physical-to-Virtual Memory
24 mapping. This array must be ended by a
25 zero-filled entry. The allocated memory
32 OUT ARM_MEMORY_REGION_DESCRIPTOR
**VirtualMemoryMap
35 EFI_PHYSICAL_ADDRESS TopOfAddressSpace
;
37 ASSERT (VirtualMemoryMap
!= NULL
);
39 TopOfAddressSpace
= LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
42 // Map the entire physical memory space as cached. The only device
43 // we care about is the GIC, which will be stage 2 mapped as a device
44 // by the hypervisor, overriding the cached mapping we install here.
46 mVirtualMemoryTable
[0].PhysicalBase
= 0x0;
47 mVirtualMemoryTable
[0].VirtualBase
= 0x0;
48 mVirtualMemoryTable
[0].Length
= TopOfAddressSpace
;
49 mVirtualMemoryTable
[0].Attributes
= ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
;
51 mVirtualMemoryTable
[1].PhysicalBase
= 0x0;
52 mVirtualMemoryTable
[1].VirtualBase
= 0x0;
53 mVirtualMemoryTable
[1].Length
= 0x0;
54 mVirtualMemoryTable
[1].Attributes
= 0x0;
56 *VirtualMemoryMap
= mVirtualMemoryTable
;