]>
Commit | Line | Data |
---|---|---|
496cf19a AB |
1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2014-2017, Linaro Limited. All rights reserved.\r | |
4 | \r | |
5 | This program and the accompanying materials are licensed and made available\r | |
6 | under the terms and conditions of the BSD License which accompanies this\r | |
7 | distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <Base.h>\r | |
16 | #include <Library/ArmLib.h>\r | |
2f9b248a | 17 | #include <Library/BaseLib.h>\r |
496cf19a AB |
18 | #include <Library/DebugLib.h>\r |
19 | \r | |
20 | STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2];\r | |
21 | \r | |
496cf19a AB |
22 | /**\r |
23 | Return the Virtual Memory Map of your platform\r | |
24 | \r | |
25 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU\r | |
26 | on your platform.\r | |
27 | \r | |
28 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR\r | |
29 | describing a Physical-to-Virtual Memory\r | |
30 | mapping. This array must be ended by a\r | |
31 | zero-filled entry. The allocated memory\r | |
32 | will not be freed.\r | |
33 | \r | |
34 | **/\r | |
35 | VOID\r | |
36 | EFIAPI\r | |
37 | ArmVirtGetMemoryMap (\r | |
38 | OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r | |
39 | )\r | |
40 | {\r | |
2f9b248a AB |
41 | EFI_PHYSICAL_ADDRESS TopOfAddressSpace;\r |
42 | \r | |
496cf19a AB |
43 | ASSERT (VirtualMemoryMap != NULL);\r |
44 | \r | |
2f9b248a AB |
45 | TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ());\r |
46 | \r | |
496cf19a AB |
47 | //\r |
48 | // Map the entire physical memory space as cached. The only device\r | |
49 | // we care about is the GIC, which will be stage 2 mapped as a device\r | |
50 | // by the hypervisor, overriding the cached mapping we install here.\r | |
51 | //\r | |
52 | mVirtualMemoryTable[0].PhysicalBase = 0x0;\r | |
53 | mVirtualMemoryTable[0].VirtualBase = 0x0;\r | |
2f9b248a | 54 | mVirtualMemoryTable[0].Length = TopOfAddressSpace;\r |
496cf19a AB |
55 | mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r |
56 | \r | |
57 | mVirtualMemoryTable[1].PhysicalBase = 0x0;\r | |
58 | mVirtualMemoryTable[1].VirtualBase = 0x0;\r | |
59 | mVirtualMemoryTable[1].Length = 0x0;\r | |
60 | mVirtualMemoryTable[1].Attributes = 0x0;\r | |
61 | \r | |
62 | *VirtualMemoryMap = mVirtualMemoryTable;\r | |
63 | }\r |