]>
Commit | Line | Data |
---|---|---|
496cf19a AB |
1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2014-2017, Linaro Limited. All rights reserved.\r | |
4 | \r | |
9792fb0e | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
496cf19a AB |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #include <Base.h>\r | |
10 | #include <Library/ArmLib.h>\r | |
2f9b248a | 11 | #include <Library/BaseLib.h>\r |
496cf19a AB |
12 | #include <Library/DebugLib.h>\r |
13 | \r | |
14 | STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2];\r | |
15 | \r | |
496cf19a AB |
16 | /**\r |
17 | Return the Virtual Memory Map of your platform\r | |
18 | \r | |
19 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU\r | |
20 | on your platform.\r | |
21 | \r | |
22 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR\r | |
23 | describing a Physical-to-Virtual Memory\r | |
24 | mapping. This array must be ended by a\r | |
25 | zero-filled entry. The allocated memory\r | |
26 | will not be freed.\r | |
27 | \r | |
28 | **/\r | |
29 | VOID\r | |
30 | EFIAPI\r | |
31 | ArmVirtGetMemoryMap (\r | |
2b16a4fb | 32 | OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r |
496cf19a AB |
33 | )\r |
34 | {\r | |
2b16a4fb | 35 | EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r |
2f9b248a | 36 | \r |
496cf19a AB |
37 | ASSERT (VirtualMemoryMap != NULL);\r |
38 | \r | |
2f9b248a AB |
39 | TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());\r |
40 | \r | |
496cf19a AB |
41 | //\r |
42 | // Map the entire physical memory space as cached. The only device\r | |
43 | // we care about is the GIC, which will be stage 2 mapped as a device\r | |
44 | // by the hypervisor, overriding the cached mapping we install here.\r | |
45 | //\r | |
46 | mVirtualMemoryTable[0].PhysicalBase = 0x0;\r | |
47 | mVirtualMemoryTable[0].VirtualBase = 0x0;\r | |
2f9b248a | 48 | mVirtualMemoryTable[0].Length = TopOfAddressSpace;\r |
496cf19a AB |
49 | mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r |
50 | \r | |
51 | mVirtualMemoryTable[1].PhysicalBase = 0x0;\r | |
52 | mVirtualMemoryTable[1].VirtualBase = 0x0;\r | |
53 | mVirtualMemoryTable[1].Length = 0x0;\r | |
54 | mVirtualMemoryTable[1].Attributes = 0x0;\r | |
55 | \r | |
56 | *VirtualMemoryMap = mVirtualMemoryTable;\r | |
57 | }\r |