]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
authorTan, Dun <dun.tan@intel.com>
Tue, 13 Jul 2021 07:19:13 +0000 (15:19 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 13 Jul 2021 08:18:35 +0000 (08:18 +0000)
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>
Reviewed-by: Ray Ni <ray.ni@intel.com>
UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c

index c619470dbbf03b1eb9f473ac9cd1f5b340e3b55f..141ce86b460eefa9ed00838efc768be5f8453778 100644 (file)
@@ -56,6 +56,7 @@ PeiLoadFileLoadPayload (
   UINTN                         Size;\r
   UINT32                        ExtraDataCount;\r
   UINTN                         Instance;\r
+  UINTN                         Length;\r
 \r
   //\r
   // ELF is added to file as RAW section for EDKII bootloader.\r
@@ -105,11 +106,14 @@ PeiLoadFileLoadPayload (
   //\r
   // Report the additional PLD sections through HOB.\r
   //\r
+  Length = sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraDataCount * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY);\r
   ExtraData = BuildGuidHob (\r
                &gUniversalPayloadExtraDataGuid,\r
-               sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraDataCount * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY)\r
+               Length\r
                );\r
   ExtraData->Count = ExtraDataCount;\r
+  ExtraData->Header.Revision = UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION;\r
+  ExtraData->Header.Length = (UINT16) Length;\r
   if (ExtraDataCount != 0) {\r
     for (ExtraDataIndex = 0, Index = 0; Index < Context.ShNum; Index++) {\r
       Status = GetElfSectionName (&Context, Index, &SectionName);\r