From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.8098.1638508654054500598 for ; Thu, 02 Dec 2021 21:17:34 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: guomin.jiang@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="235648637" X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="235648637" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 21:17:32 -0800 X-IronPort-AV: E=Sophos;i="5.87,283,1631602800"; d="scan'208";a="513553258" Received: from guominji-mobl.ccr.corp.intel.com ([10.238.14.26]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2021 21:17:31 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [PATCH v2 1/1] UefiPayloadPkg: Skip ModuleInfo HOB in Payload Date: Fri, 3 Dec 2021 13:17:26 +0800 Message-Id: <20211203051726.1105-1-guomin.jiang@intel.com> X-Mailer: git-send-email 2.30.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You --- .../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