]>
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 | |
17 | #include <Library/DebugLib.h>\r | |
18 | \r | |
19 | STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2];\r | |
20 | \r | |
21 | EFI_PHYSICAL_ADDRESS\r | |
22 | ArmGetPhysAddrTop (\r | |
23 | VOID\r | |
24 | );\r | |
25 | \r | |
26 | /**\r | |
27 | Return the Virtual Memory Map of your platform\r | |
28 | \r | |
29 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU\r | |
30 | on your platform.\r | |
31 | \r | |
32 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR\r | |
33 | describing a Physical-to-Virtual Memory\r | |
34 | mapping. This array must be ended by a\r | |
35 | zero-filled entry. The allocated memory\r | |
36 | will not be freed.\r | |
37 | \r | |
38 | **/\r | |
39 | VOID\r | |
40 | EFIAPI\r | |
41 | ArmVirtGetMemoryMap (\r | |
42 | OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap\r | |
43 | )\r | |
44 | {\r | |
45 | ASSERT (VirtualMemoryMap != NULL);\r | |
46 | \r | |
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 | |
54 | mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop ();\r | |
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 |