]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg: Skip ModuleInfo HOB in Payload
authorJiang, Guomin <Guomin.Jiang@intel.com>
Fri, 3 Dec 2021 05:17:26 +0000 (13:17 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 8 Dec 2021 04:08:21 +0000 (04:08 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3754

1. DxeCore will use ModuleInfo to install LoadedImage protocol for DxeCore.
2. DxeIpl will create the ModuleInfo of UniversalPayload. and
   UniversalPayload will create the ModuleInfo of DxeCore.
3. UniversalPayload should skip the ModuleInfo from the DxeIpl to avoid
   the mismatched ModuleInfo for DxeCore.

Changes:
1. Use function IsHobNeed to check if the HOB should be added
2. Add the ModuleInfo check logic in IsHobNeed function

Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c

index bea37fb18b8cc6d831842686f450a70e14eb6de4..edb3c204717120784772d7869e078c28dd100f5b 100644 (file)
@@ -251,6 +251,36 @@ FindAnotherHighestBelow4GResourceDescriptor (
   return ReturnResourceHob;\r
 }\r
 \r
+/**\r
+  Check the HOB and decide if it is need inside Payload\r
+\r
+  Payload maintainer may make decision which HOB is need or needn't\r
+  Then add the check logic in the function.\r
+\r
+  @param[in] Hob The HOB to check\r
+\r
+  @retval TRUE  If HOB is need inside Payload\r
+  @retval FALSE If HOB is needn't inside Payload\r
+**/\r
+BOOLEAN\r
+IsHobNeed (\r
+  EFI_PEI_HOB_POINTERS  Hob\r
+  )\r
+{\r
+  if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {\r
+    return FALSE;\r
+  }\r
+\r
+  if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
+    if (CompareGuid (&Hob.MemoryAllocationModule->MemoryAllocationHeader.Name, &gEfiHobMemoryAllocModuleGuid)) {\r
+      return FALSE;\r
+    }\r
+  }\r
+\r
+  // Arrive here mean the HOB is need\r
+  return TRUE;\r
+}\r
+\r
 /**\r
   It will build HOBs based on information from bootloaders.\r
 \r
@@ -351,7 +381,7 @@ BuildHobs (
   // Since payload created new Hob, move all hobs except PHIT from boot loader hob list.\r
   //\r
   while (!END_OF_HOB_LIST (Hob)) {\r
-    if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {\r
+    if (IsHobNeed (Hob)) {\r
       // Add this hob to payload HOB\r
       AddNewHob (&Hob);\r
     }\r