- EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;\r
- UINT64 MemoryBase;\r
- UINTN Index = 0;\r
- ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR *EfiMemoryTable;\r
-\r
- ASSERT(EfiMemoryMap != NULL);\r
-\r
- EfiMemoryTable = (ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(sizeof(ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR) * 6);\r
-\r
- Attributes =\r
- (\r
- EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |\r
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |\r
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |\r
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |\r
- EFI_RESOURCE_ATTRIBUTE_TESTED\r
- );\r
- MemoryBase = ARM_EB_DRAM_BASE;\r
- \r
- // Memory Reserved for fixed address allocations (such as Exception Vector Table)\r
- EfiMemoryTable[Index].ResourceAttribute = Attributes;\r
- EfiMemoryTable[Index].PhysicalStart = MemoryBase;\r
- EfiMemoryTable[Index].NumberOfBytes = ARM_EB_EFI_FIX_ADDRESS_REGION_SZ;\r
- \r
- MemoryBase += ARM_EB_EFI_FIX_ADDRESS_REGION_SZ;\r
-\r
- // Memory declared to PEI as permanent memory for PEI and DXE\r
- EfiMemoryTable[++Index].ResourceAttribute = Attributes;\r
- EfiMemoryTable[Index].PhysicalStart = MemoryBase;\r
- EfiMemoryTable[Index].NumberOfBytes = ARM_EB_EFI_MEMORY_REGION_SZ;\r
-\r
- MemoryBase += ARM_EB_EFI_MEMORY_REGION_SZ;\r
-\r
- // We must reserve the memory used by the Firmware Volume copied in DRAM at 0x80000000\r
- if (FeaturePcdGet(PcdStandalone) == FALSE) {\r
- // Chunk between the EFI Memory region and the firmware\r
- EfiMemoryTable[++Index].ResourceAttribute = Attributes;\r
- EfiMemoryTable[Index].PhysicalStart = MemoryBase;\r
- EfiMemoryTable[Index].NumberOfBytes = PcdGet32(PcdNormalFdBaseAddress) - MemoryBase;\r
-\r
- // Chunk reserved by the firmware in DRAM\r
- EfiMemoryTable[++Index].ResourceAttribute = Attributes & (~EFI_RESOURCE_ATTRIBUTE_PRESENT);\r
- EfiMemoryTable[Index].PhysicalStart = PcdGet32(PcdNormalFdBaseAddress);\r
- EfiMemoryTable[Index].NumberOfBytes = PcdGet32(PcdNormalFdSize);\r
-\r
- MemoryBase = PcdGet32(PcdNormalFdBaseAddress) + PcdGet32(PcdNormalFdSize);\r
- }\r
- \r
- // We allocate all the remain memory as untested system memory\r
- EfiMemoryTable[++Index].ResourceAttribute = Attributes & (~EFI_RESOURCE_ATTRIBUTE_TESTED);\r
- EfiMemoryTable[Index].PhysicalStart = MemoryBase;\r
- EfiMemoryTable[Index].NumberOfBytes = ARM_EB_DRAM_SZ - (MemoryBase-ARM_EB_DRAM_BASE);\r
-\r
- EfiMemoryTable[++Index].ResourceAttribute = 0;\r
- EfiMemoryTable[Index].PhysicalStart = 0;\r
- EfiMemoryTable[Index].NumberOfBytes = 0;\r
-\r
- *EfiMemoryMap = EfiMemoryTable;\r