UEFI2.5 spec, GetMemoryMap(), says: Attribute: Attributes of the memory region that describe the bit mask of capabilities for that memory region, and not necessarily the current settings for that memory region. But, GetMemoryMap() implementation doesn't append memory capabilities for MMIO and Reserved memory range. This will break UEFI2.5 Properties Table feature, because Properties Table need return EFI_MEMORY_RO or EFI_MEMORY_XP capabilities for OS.
This patch appends memory capabilities for those memory range. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming....@intel.com> --- MdeModulePkg/Core/Dxe/Mem/Page.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index f2efaf1..c50c5bc 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1663,11 +1663,12 @@ CoreGetMemoryMap ( // Create EFI_MEMORY_DESCRIPTOR for every Reserved and runtime MMIO GCD entries // MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress; MemoryMap->VirtualStart = 0; MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT); - MemoryMap->Attribute = GcdMapEntry->Attributes & ~EFI_MEMORY_PORT_IO; + MemoryMap->Attribute = (GcdMapEntry->Attributes & ~EFI_MEMORY_PORT_IO) | + (GcdMapEntry->Capabilities & (EFI_MEMORY_RP | EFI_MEMORY_WP | EFI_MEMORY_XP | EFI_MEMORY_RO)); if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) { MemoryMap->Type = EfiReservedMemoryType; } else if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) { if ((GcdMapEntry->Attributes & EFI_MEMORY_PORT_IO) == EFI_MEMORY_PORT_IO) { @@ -1689,11 +1690,12 @@ CoreGetMemoryMap ( // Create EFI_MEMORY_DESCRIPTOR for every Persistent GCD entries // MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress; MemoryMap->VirtualStart = 0; MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT); - MemoryMap->Attribute = GcdMapEntry->Attributes | EFI_MEMORY_NV; + MemoryMap->Attribute = GcdMapEntry->Attributes | EFI_MEMORY_NV | + (GcdMapEntry->Capabilities & (EFI_MEMORY_RP | EFI_MEMORY_WP | EFI_MEMORY_XP | EFI_MEMORY_RO)); MemoryMap->Type = EfiPersistentMemory; // // Check to see if the new Memory Map Descriptor can be merged with an // existing descriptor if they are adjacent and have the same attributes -- 1.9.5.msysgit.0 ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel