From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.1305.1626160804504271700 for ; Tue, 13 Jul 2021 00:20:09 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: dun.tan@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10043"; a="231912899" X-IronPort-AV: E=Sophos;i="5.84,235,1620716400"; d="scan'208";a="231912899" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2021 00:20:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,235,1620716400"; d="scan'208";a="493726004" Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.182.106]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2021 00:20:07 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , DunTan Subject: [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData Date: Tue, 13 Jul 2021 15:19:13 +0800 Message-Id: <20210713071913.1060-3-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20210713071913.1060-1-dun.tan@intel.com> References: <20210713071913.1060-1-dun.tan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit V1: Assign the length and revision of UniversalPayload ExtraData V2: Force int to UINT16 V3: Create a local variable to hold the size of ExtraData Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: DunTan --- UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c b/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c index c619470dbb..141ce86b46 100644 --- a/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c +++ b/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c @@ -56,6 +56,7 @@ PeiLoadFileLoadPayload ( UINTN Size; UINT32 ExtraDataCount; UINTN Instance; + UINTN Length; // // ELF is added to file as RAW section for EDKII bootloader. @@ -105,11 +106,14 @@ PeiLoadFileLoadPayload ( // // Report the additional PLD sections through HOB. // + Length = sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraDataCount * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY); ExtraData = BuildGuidHob ( &gUniversalPayloadExtraDataGuid, - sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraDataCount * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY) + Length ); ExtraData->Count = ExtraDataCount; + ExtraData->Header.Revision = UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION; + ExtraData->Header.Length = (UINT16) Length; if (ExtraDataCount != 0) { for (ExtraDataIndex = 0, Index = 0; Index < Context.ShNum; Index++) { Status = GetElfSectionName (&Context, Index, &SectionName); -- 2.31.1.windows.1