]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Core: Merge memory map after filtering paging capability
authorJian J Wang <jian.j.wang@intel.com>
Thu, 23 Nov 2017 01:57:01 +0000 (09:57 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 28 Nov 2017 01:25:32 +0000 (09:25 +0800)
Once the paging capabilities were filtered out, there might be some adjacent entries
sharing the same capabilities. It's recommended to merge those entries for the OS
compatibility purpose.

This patch makes use of existing method MergeMemoryMap() to do it. This is done by
simply turning this method from static to extern, and call it after filter code.

This patch is related to an issue described at
   https://bugzilla.tianocore.org/show_bug.cgi?id=753

This patch is also passed test of booting follow OSs:
    Windows 10
    Windows Server 2016
    Fedora 26
    Fedora 25

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/Mem/Page.c
MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c

index 1a0babba713aa06fc15fdfa40dc9a0852451c30d..07b86ba696da523882dc3a35c54ae9c9e06e63f6 100644 (file)
@@ -2948,4 +2948,22 @@ ApplyMemoryProtectionPolicy (
   IN  UINT64                Length\r
   );\r
 \r
+/**\r
+  Merge continous memory map entries whose have same attributes.\r
+\r
+  @param  MemoryMap       A pointer to the buffer in which firmware places\r
+                          the current memory map.\r
+  @param  MemoryMapSize   A pointer to the size, in bytes, of the\r
+                          MemoryMap buffer. On input, this is the size of\r
+                          the current memory map.  On output,\r
+                          it is the size of new memory map after merge.\r
+  @param  DescriptorSize  Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.\r
+**/\r
+VOID\r
+MergeMemoryMap (\r
+  IN OUT EFI_MEMORY_DESCRIPTOR  *MemoryMap,\r
+  IN OUT UINTN                  *MemoryMapSize,\r
+  IN UINTN                      DescriptorSize\r
+  );\r
+\r
 #endif\r
index 962ae90d3dd68e48708761bff4610750a20ee9bd..853606653cdb568013a93b581fa397fdbcbc44c5 100644 (file)
@@ -1915,6 +1915,8 @@ CoreGetMemoryMap (
                                       EFI_MEMORY_XP);\r
     MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, Size);\r
   }\r
+  MergeMemoryMap (MemoryMapStart, &BufferSize, Size);\r
+  MemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMapStart + BufferSize);\r
 \r
   Status = EFI_SUCCESS;\r
 \r
index 6cf5edcbe5d94f17c764095ee128aea35f1589a8..75d9b14c1f87412b638b84f03b5aa8d8308b9685 100644 (file)
@@ -182,7 +182,6 @@ SortMemoryMap (
                                  it is the size of new memory map after merge.\r
   @param  DescriptorSize         Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.\r
 **/\r
-STATIC\r
 VOID\r
 MergeMemoryMap (\r
   IN OUT EFI_MEMORY_DESCRIPTOR  *MemoryMap,\r