3 Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/ArmLib.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
20 STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable
[2];
23 Return the Virtual Memory Map of your platform
25 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
28 @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR
29 describing a Physical-to-Virtual Memory
30 mapping. This array must be ended by a
31 zero-filled entry. The allocated memory
38 OUT ARM_MEMORY_REGION_DESCRIPTOR
**VirtualMemoryMap
41 EFI_PHYSICAL_ADDRESS TopOfAddressSpace
;
43 ASSERT (VirtualMemoryMap
!= NULL
);
45 TopOfAddressSpace
= LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
48 // Map the entire physical memory space as cached. The only device
49 // we care about is the GIC, which will be stage 2 mapped as a device
50 // by the hypervisor, overriding the cached mapping we install here.
52 mVirtualMemoryTable
[0].PhysicalBase
= 0x0;
53 mVirtualMemoryTable
[0].VirtualBase
= 0x0;
54 mVirtualMemoryTable
[0].Length
= TopOfAddressSpace
;
55 mVirtualMemoryTable
[0].Attributes
= ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
;
57 mVirtualMemoryTable
[1].PhysicalBase
= 0x0;
58 mVirtualMemoryTable
[1].VirtualBase
= 0x0;
59 mVirtualMemoryTable
[1].Length
= 0x0;
60 mVirtualMemoryTable
[1].Attributes
= 0x0;
62 *VirtualMemoryMap
= mVirtualMemoryTable
;