[edk2-devel] [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData

duntan posted 2 patches 4 years, 7 months ago
[edk2-devel] [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
Posted by duntan 4 years, 7 months ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77735): https://edk2.groups.io/g/devel/message/77735
Mute This Topic: https://groups.io/mt/84173581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
Posted by Ni, Ray 4 years, 7 months ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77737): https://edk2.groups.io/g/devel/message/77737
Mute This Topic: https://groups.io/mt/84173581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
Posted by Ni, Ray 4 years, 7 months ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77739): https://edk2.groups.io/g/devel/message/77739
Mute This Topic: https://groups.io/mt/84173581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch V3 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData
Posted by Guo Dong 4 years, 6 months ago
Signed-off-by: Guo Dong <guo.dong@intel.com>

> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Tuesday, July 13, 2021 12:19 AM
> 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77750): https://edk2.groups.io/g/devel/message/77750
Mute This Topic: https://groups.io/mt/84173581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-