Revision: 17253
http://sourceforge.net/p/edk2/code/17253
Author: lgao4
Date: 2015-04-29 05:11:21 +0000 (Wed, 29 Apr 2015)
Log Message:
-----------
MdeModulePkg: PI1.4 DxeCore GetMemoryMap() update
PI1.4: Updates DxeCore to add all EfiGcdMemoryTypeReserved memory
into UEFI memory map.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c
Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2015-04-29 05:10:41 UTC (rev
17252)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2015-04-29 05:11:21 UTC (rev
17253)
@@ -1530,7 +1530,7 @@
EFI_STATUS Status;
UINTN Size;
UINTN BufferSize;
- UINTN NumberOfRuntimePersistentEntries;
+ UINTN NumberOfEntries;
LIST_ENTRY *Link;
MEMORY_MAP *Entry;
EFI_GCD_MAP_ENTRY *GcdMapEntry;
@@ -1547,22 +1547,18 @@
CoreAcquireGcdMemoryLock ();
//
- // Count the number of Reserved and MMIO entries that are marked for runtime
use
+ // Count the number of Reserved and runtime MMIO entries
// And, count the number of Persistent entries.
//
- NumberOfRuntimePersistentEntries = 0;
+ NumberOfEntries = 0;
for (Link = mGcdMemorySpaceMap.ForwardLink; Link != &mGcdMemorySpaceMap;
Link = Link->ForwardLink) {
GcdMapEntry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
- (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) ==
EFI_MEMORY_RUNTIME) {
- NumberOfRuntimePersistentEntries ++;
- }
+ if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypePersistentMemory) ||
+ (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
+ ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) &&
+ ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) ==
EFI_MEMORY_RUNTIME))) {
+ NumberOfEntries ++;
}
-
- if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypePersistentMemory) {
- NumberOfRuntimePersistentEntries ++;
- }
}
Size = sizeof (EFI_MEMORY_DESCRIPTOR);
@@ -1587,7 +1583,7 @@
//
// Compute the buffer size needed to fit the entire map
//
- BufferSize = Size * NumberOfRuntimePersistentEntries;
+ BufferSize = Size * NumberOfEntries;
for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link =
Link->ForwardLink) {
BufferSize += Size;
}
@@ -1652,33 +1648,31 @@
for (Link = mGcdMemorySpaceMap.ForwardLink; Link != &mGcdMemorySpaceMap;
Link = Link->ForwardLink) {
GcdMapEntry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
- (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) ==
EFI_MEMORY_RUNTIME) {
- //
- // Create EFI_MEMORY_DESCRIPTOR for every Reserved and MMIO GCD entries
- // that are marked for runtime use
- //
- 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;
+ ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) &&
+ ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) ==
EFI_MEMORY_RUNTIME))) {
+ //
+ // 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;
- if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) {
- MemoryMap->Type = EfiReservedMemoryType;
- } else if (GcdMapEntry->GcdMemoryType ==
EfiGcdMemoryTypeMemoryMappedIo) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_PORT_IO) ==
EFI_MEMORY_PORT_IO) {
- MemoryMap->Type = EfiMemoryMappedIOPortSpace;
- } else {
- MemoryMap->Type = EfiMemoryMappedIO;
- }
+ if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) {
+ MemoryMap->Type = EfiReservedMemoryType;
+ } else if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)
{
+ if ((GcdMapEntry->Attributes & EFI_MEMORY_PORT_IO) ==
EFI_MEMORY_PORT_IO) {
+ MemoryMap->Type = EfiMemoryMappedIOPortSpace;
+ } else {
+ MemoryMap->Type = EfiMemoryMappedIO;
}
+ }
- //
- // 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
- //
- MemoryMap = MergeMemoryMapDescriptor (MemoryMapStart, MemoryMap, Size);
- }
+ //
+ // 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
+ //
+ MemoryMap = MergeMemoryMapDescriptor (MemoryMapStart, MemoryMap, Size);
}
if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypePersistentMemory) {
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits