public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Tan, Dun" <dun.tan@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Guo" <guo.dong@intel.com>,
	"Ma, Maurice" <maurice.ma@intel.com>,
	"You, Benjamin" <benjamin.you@intel.com>
Subject: Re: [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
Date: Tue, 13 Jul 2021 07:28:46 +0000	[thread overview]
Message-ID: <CO1PR11MB493016B7A70FDF1B8549D6468C149@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210713071913.1060-3-dun.tan@intel.com>

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

-----Original Message-----
From: Tan, Dun <dun.tan@intel.com> 
Sent: Tuesday, July 13, 2021 3:19 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>; Tan, Dun <dun.tan@intel.com>
Subject: [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData

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 <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>

Signed-off-by: DunTan <dun.tan@intel.com>
---
 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


  reply	other threads:[~2021-07-13  7:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  7:19 [Patch V3 0/2] Fix the length and PldHeader for UniversalPayload ExtraData duntan
2021-07-13  7:19 ` [Patch V3 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h duntan
2021-07-13  7:44   ` Ni, Ray
2021-07-13  7:19 ` [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData duntan
2021-07-13  7:28   ` Ni, Ray [this message]
2021-07-13  7:44   ` Ni, Ray
2021-07-13 21:00   ` Guo Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB493016B7A70FDF1B8549D6468C149@CO1PR11MB4930.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox