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>
Reviewed-by: Jiewen Yao <jiewen....@intel.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index f2efaf1..a285529 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1663,11 +1663,13 @@ 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 |
+                                EFI_MEMORY_UC | EFI_MEMORY_UCE | EFI_MEMORY_WC 
| EFI_MEMORY_WT | EFI_MEMORY_WB));
 
       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 +1691,13 @@ 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 |
+                                EFI_MEMORY_UC | EFI_MEMORY_UCE | EFI_MEMORY_WC 
| EFI_MEMORY_WT | EFI_MEMORY_WB));
       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


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to