]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / ArmPlatformPkg / MemoryInitPei / MemoryInitPeiLib.c
index f54ec3672a2d7b8f4806a46f43005e9543e550d7..01fd028dbd55fc26b81c09a38e2c2281cc130f52 100644 (file)
@@ -14,6 +14,7 @@
 \r
 #include <PiPei.h>\r
 \r
+#include <Library/ArmMmuLib.h>\r
 #include <Library/ArmPlatformLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/HobLib.h>\r
@@ -88,7 +89,6 @@ MemoryPeim (
   ResourceAttributes = (\r
       EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
       EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
-      EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |\r
       EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |\r
       EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |\r
       EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |\r
@@ -129,7 +129,8 @@ MemoryPeim (
   FdTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFdSize);\r
 \r
   // EDK2 does not have the concept of boot firmware copied into DRAM. To avoid the DXE\r
-  // core to overwrite this area we must mark the region with the attribute non-present\r
+  // core to overwrite this area we must create a memory allocation HOB for the region,\r
+  // but this only works if we split off the underlying resource descriptor as well.\r
   if ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) {\r
     Found = FALSE;\r
 \r
@@ -145,12 +146,10 @@ MemoryPeim (
         ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength;\r
 \r
         if (PcdGet64 (PcdFdBaseAddress) == NextHob.ResourceDescriptor->PhysicalStart) {\r
-          if (SystemMemoryTop == FdTop) {\r
-            NextHob.ResourceDescriptor->ResourceAttribute = ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT;\r
-          } else {\r
-            // Create the System Memory HOB for the firmware with the non-present attribute\r
+          if (SystemMemoryTop != FdTop) {\r
+            // Create the System Memory HOB for the firmware\r
             BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,\r
-                                        ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,\r
+                                        ResourceAttributes,\r
                                         PcdGet64 (PcdFdBaseAddress),\r
                                         PcdGet32 (PcdFdSize));\r
 \r
@@ -159,9 +158,9 @@ MemoryPeim (
             NextHob.ResourceDescriptor->ResourceLength -= PcdGet32(PcdFdSize);\r
           }\r
         } else {\r
-          // Create the System Memory HOB for the firmware with the non-present attribute\r
+          // Create the System Memory HOB for the firmware\r
           BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,\r
-                                      ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,\r
+                                      ResourceAttributes,\r
                                       PcdGet64 (PcdFdBaseAddress),\r
                                       PcdGet32 (PcdFdSize));\r
 \r
@@ -177,6 +176,12 @@ MemoryPeim (
                                         ResourceTop - FdTop);\r
           }\r
         }\r
+\r
+        // Mark the memory covering the Firmware Device as boot services data\r
+        BuildMemoryAllocationHob (PcdGet64 (PcdFdBaseAddress),\r
+                                  PcdGet32 (PcdFdSize),\r
+                                  EfiBootServicesData);\r
+\r
         Found = TRUE;\r
         break;\r
       }\r