]> git.proxmox.com Git - mirror_edk2.git/blob - ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c
MdeModulePkg/PciBusDxe: catch unimplemented extended config space reads
[mirror_edk2.git] / ArmVirtPkg / Library / XenVirtMemInfoLib / XenVirtMemInfoLib.c
1 /** @file
2
3 Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10 #include <Library/ArmLib.h>
11 #include <Library/BaseLib.h>
12 #include <Library/DebugLib.h>
13
14 STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2];
15
16 /**
17 Return the Virtual Memory Map of your platform
18
19 This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
20 on your platform.
21
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
26 will not be freed.
27
28 **/
29 VOID
30 EFIAPI
31 ArmVirtGetMemoryMap (
32 OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap
33 )
34 {
35 EFI_PHYSICAL_ADDRESS TopOfAddressSpace;
36
37 ASSERT (VirtualMemoryMap != NULL);
38
39 TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());
40
41 //
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.
45 //
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;
50
51 mVirtualMemoryTable[1].PhysicalBase = 0x0;
52 mVirtualMemoryTable[1].VirtualBase = 0x0;
53 mVirtualMemoryTable[1].Length = 0x0;
54 mVirtualMemoryTable[1].Attributes = 0x0;
55
56 *VirtualMemoryMap = mVirtualMemoryTable;
57 }