]> git.proxmox.com Git - mirror_edk2.git/blob - ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c
88ff3167cbfd4926049fb9414895686f3c01bc96
[mirror_edk2.git] / ArmVirtPkg / Library / XenVirtMemInfoLib / XenVirtMemInfoLib.c
1 /** @file
2
3 Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
4
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
9
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.
12
13 **/
14
15 #include <Base.h>
16 #include <Library/ArmLib.h>
17 #include <Library/DebugLib.h>
18
19 STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2];
20
21 EFI_PHYSICAL_ADDRESS
22 ArmGetPhysAddrTop (
23 VOID
24 );
25
26 /**
27 Return the Virtual Memory Map of your platform
28
29 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
30 on your platform.
31
32 @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR
33 describing a Physical-to-Virtual Memory
34 mapping. This array must be ended by a
35 zero-filled entry. The allocated memory
36 will not be freed.
37
38 **/
39 VOID
40 EFIAPI
41 ArmVirtGetMemoryMap (
42 OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap
43 )
44 {
45 ASSERT (VirtualMemoryMap != NULL);
46
47 //
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.
51 //
52 mVirtualMemoryTable[0].PhysicalBase = 0x0;
53 mVirtualMemoryTable[0].VirtualBase = 0x0;
54 mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop ();
55 mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
56
57 mVirtualMemoryTable[1].PhysicalBase = 0x0;
58 mVirtualMemoryTable[1].VirtualBase = 0x0;
59 mVirtualMemoryTable[1].Length = 0x0;
60 mVirtualMemoryTable[1].Attributes = 0x0;
61
62 *VirtualMemoryMap = mVirtualMemoryTable;
63 }