summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2015-06-25 03:29:11 +0000
committerlgao4 <lgao4@Edk2>2015-06-25 03:29:11 +0000
commitff0c6d6617833573e9de0eec7287a90247365b98 (patch)
treec7613f06d99ce1f9415b8306fef60ff0f9306282
parenta86c73cddaaa88bfc65955be21b1d5102e20ee47 (diff)
downloadedk2-platforms-ff0c6d6617833573e9de0eec7287a90247365b98.tar.xz
MdeModulePkg: Add Memory Capabilities for MMIO and Reserved Range
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.gao@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17703 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Page.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index f2efaf1278..a28552934f 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1665,7 +1665,9 @@ CoreGetMemoryMap (
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;
@@ -1691,7 +1693,9 @@ CoreGetMemoryMap (
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;
//