18#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
26#define MACH_VIRT_PERIPH_BASE 0x08000000
27#define MACH_VIRT_PERIPH_SIZE SIZE_128MB
44 Size =
PcdGet64 (PcdSystemMemorySize);
72 ASSERT (VirtualMemoryMap !=
NULL);
75 ASSERT (MemorySizeHob !=
NULL);
76 if (MemorySizeHob ==
NULL) {
82 MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS
85 if (VirtualMemoryTable ==
NULL) {
86 DEBUG ((DEBUG_ERROR,
"%a: Error: Failed AllocatePool()\n", __func__));
91 VirtualMemoryTable[0].PhysicalBase =
PcdGet64 (PcdSystemMemoryBase);
92 VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase;
93 VirtualMemoryTable[0].Length = *(UINT64 *)GET_GUID_HOB_DATA (MemorySizeHob);
94 VirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
98 "%a: Dumping System DRAM Memory Map:\n"
99 "\tPhysicalBase: 0x%lX\n"
100 "\tVirtualBase: 0x%lX\n"
103 VirtualMemoryTable[0].PhysicalBase,
104 VirtualMemoryTable[0].VirtualBase,
105 VirtualMemoryTable[0].Length
109 VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
110 VirtualMemoryTable[1].VirtualBase = MACH_VIRT_PERIPH_BASE;
111 VirtualMemoryTable[1].Length = MACH_VIRT_PERIPH_SIZE;
112 VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
115 VirtualMemoryTable[2].PhysicalBase =
PcdGet64 (PcdFvBaseAddress);
116 VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase;
118 VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_RO;
123 *VirtualMemoryMap = VirtualMemoryTable;
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
VOID *EFIAPI BuildGuidDataHob(IN CONST EFI_GUID *Guid, IN VOID *Data, IN UINTN DataLength)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DEBUG(Expression)
#define PcdGet64(TokenName)
#define FixedPcdGet32(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFIAPI QemuVirtMemInfoLibConstructor(VOID)
VOID ArmVirtGetMemoryMap(OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap)