public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload
@ 2021-12-03  5:17 Guomin Jiang
  2021-12-06  1:52 ` Ni, Ray
  0 siblings, 1 reply; 2+ messages in thread
From: Guomin Jiang @ 2021-12-03  5:17 UTC (permalink / raw)
  To: devel; +Cc: Guo Dong, Ray Ni, Maurice Ma, Benjamin You

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>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 .../UefiPayloadEntry/UniversalPayloadEntry.c  | 32 ++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload
  2021-12-03  5:17 [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload Guomin Jiang
@ 2021-12-06  1:52 ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2021-12-06  1:52 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io; +Cc: Dong, Guo, Ma, Maurice, You, Benjamin

Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Jiang, Guomin <guomin.jiang@intel.com> 
Sent: Friday, December 3, 2021 1:17 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload

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>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
---
 .../UefiPayloadEntry/UniversalPayloadEntry.c  | 32 ++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-06  1:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-03  5:17 [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload Guomin Jiang
2021-12-06  1:52 ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox