]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory
authorMeenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Tue, 19 Sep 2017 12:32:09 +0000 (18:02 +0530)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 30 Nov 2017 17:08:42 +0000 (17:08 +0000)
Now that PrePi no longer exposes its internal code via special HOBs,
we can remove the special handling of the primary FV, which needed to
be reserved so that DXE core could call into the PE/COFF and LZMA
libraries in the PrePi module.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
[ardb: updated commit log]
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c

index 2feb11f21d5d3fc1ead27a5434d3fc1e5da8d007..d03214b5df669b992aecad376a2fa2e740cb5f88 100644 (file)
@@ -70,11 +70,7 @@ MemoryPeim (
 {\r
   ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable;\r
   EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttributes;\r
-  UINT64                       ResourceLength;\r
   EFI_PEI_HOB_POINTERS         NextHob;\r
-  EFI_PHYSICAL_ADDRESS         FdTop;\r
-  EFI_PHYSICAL_ADDRESS         SystemMemoryTop;\r
-  EFI_PHYSICAL_ADDRESS         ResourceTop;\r
   BOOLEAN                      Found;\r
 \r
   // Get Virtual Memory Map from the Platform Library\r
@@ -121,71 +117,6 @@ MemoryPeim (
     );\r
   }\r
 \r
-  //\r
-  // Reserved the memory space occupied by the firmware volume\r
-  //\r
-\r
-  SystemMemoryTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase) + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize);\r
-  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
-  if ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) {\r
-    Found = FALSE;\r
-\r
-    // Search for System Memory Hob that contains the firmware\r
-    NextHob.Raw = GetHobList ();\r
-    while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) {\r
-      if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&\r
-          (PcdGet64 (PcdFdBaseAddress) >= NextHob.ResourceDescriptor->PhysicalStart) &&\r
-          (FdTop <= NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength))\r
-      {\r
-        ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute;\r
-        ResourceLength = NextHob.ResourceDescriptor->ResourceLength;\r
-        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
-            BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,\r
-                                        ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,\r
-                                        PcdGet64 (PcdFdBaseAddress),\r
-                                        PcdGet32 (PcdFdSize));\r
-\r
-            // Top of the FD is system memory available for UEFI\r
-            NextHob.ResourceDescriptor->PhysicalStart += PcdGet32(PcdFdSize);\r
-            NextHob.ResourceDescriptor->ResourceLength -= PcdGet32(PcdFdSize);\r
-          }\r
-        } else {\r
-          // Create the System Memory HOB for the firmware with the non-present attribute\r
-          BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,\r
-                                      ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT,\r
-                                      PcdGet64 (PcdFdBaseAddress),\r
-                                      PcdGet32 (PcdFdSize));\r
-\r
-          // Update the HOB\r
-          NextHob.ResourceDescriptor->ResourceLength = PcdGet64 (PcdFdBaseAddress) - NextHob.ResourceDescriptor->PhysicalStart;\r
-\r
-          // If there is some memory available on the top of the FD then create a HOB\r
-          if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + ResourceLength) {\r
-            // Create the System Memory HOB for the remaining region (top of the FD)\r
-            BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY,\r
-                                        ResourceAttributes,\r
-                                        FdTop,\r
-                                        ResourceTop - FdTop);\r
-          }\r
-        }\r
-        Found = TRUE;\r
-        break;\r
-      }\r
-      NextHob.Raw = GET_NEXT_HOB (NextHob);\r
-    }\r
-\r
-    ASSERT(Found);\r
-  }\r
-\r
   // Build Memory Allocation Hob\r
   InitMmu (MemoryTable);\r
 \r