[edk2] [PATCH 1/2] EmbeddedPkg PrePiHobLib: Implement BuildFv3Hob

Star Zeng posted 2 patches 7 years, 2 months ago
There is a newer version of this series
[edk2] [PATCH 1/2] EmbeddedPkg PrePiHobLib: Implement BuildFv3Hob
Posted by Star Zeng 7 years, 2 months ago
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 EmbeddedPkg/Library/PrePiHobLib/Hob.c | 43 ++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
index aff532259ef4..a681587d3ee0 100644
--- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
+++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2010, Apple Inc. All rights reserved.<BR>
+  Copyright (c) 2010 - 2017, Apple Inc. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -601,7 +601,48 @@ BuildFv2Hob (
   CopyGuid (&Hob->FileName, FileName);
 }
 
+/**
+  Builds a EFI_HOB_TYPE_FV3 HOB.
+
+  This function builds a EFI_HOB_TYPE_FV3 HOB.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param BaseAddress            The base address of the Firmware Volume.
+  @param Length                 The size of the Firmware Volume in bytes.
+  @param AuthenticationStatus   The authentication status.
+  @param ExtractedFv            TRUE if the FV was extracted as a file within another firmware volume.
+                                FALSE otherwise.
+  @param FvName                 The name of the Firmware Volume. Valid only if IsExtractedFv is TRUE
+  @param FileName               The name of the file. Valid only if IsExtractedFv is TRUE
+
+**/
+VOID
+EFIAPI
+BuildFv3Hob (
+  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN          UINT64                      Length,
+  IN          UINT32                      AuthenticationStatus,
+  IN          BOOLEAN                     ExtractedFv,
+  IN CONST    EFI_GUID                    *FvName, OPTIONAL
+  IN CONST    EFI_GUID                    *FileName OPTIONAL
+  )
+{
+  EFI_HOB_FIRMWARE_VOLUME3  *Hob;
+
+  Hob = CreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3));
 
+  Hob->BaseAddress          = BaseAddress;
+  Hob->Length               = Length;
+  Hob->AuthenticationStatus = AuthenticationStatus;
+  Hob->ExtractedFv          = ExtractedFv;
+  if (ExtractedFv) {
+    CopyGuid (&Hob->FvName, FvName);
+    CopyGuid (&Hob->FileName, FileName);
+  }
+}
 
 /**
   Builds a Capsule Volume HOB.
-- 
2.13.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/2] EmbeddedPkg PrePiHobLib: Implement BuildFv3Hob
Posted by Ard Biesheuvel 7 years, 2 months ago
On 5 October 2017 at 07:33, Star Zeng <star.zeng@intel.com> wrote:
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  EmbeddedPkg/Library/PrePiHobLib/Hob.c | 43 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> index aff532259ef4..a681587d3ee0 100644
> --- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> +++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> @@ -1,6 +1,6 @@
>  /** @file
>
> -  Copyright (c) 2010, Apple Inc. All rights reserved.<BR>
> +  Copyright (c) 2010 - 2017, Apple Inc. All rights reserved.<BR>
>

You may want to change this :-)

>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD License
> @@ -601,7 +601,48 @@ BuildFv2Hob (
>    CopyGuid (&Hob->FileName, FileName);
>  }
>
> +/**
> +  Builds a EFI_HOB_TYPE_FV3 HOB.
> +
> +  This function builds a EFI_HOB_TYPE_FV3 HOB.
> +  It can only be invoked during PEI phase;
> +  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
> +
> +  If there is no additional space for HOB creation, then ASSERT().
> +
> +  @param BaseAddress            The base address of the Firmware Volume.
> +  @param Length                 The size of the Firmware Volume in bytes.
> +  @param AuthenticationStatus   The authentication status.
> +  @param ExtractedFv            TRUE if the FV was extracted as a file within another firmware volume.
> +                                FALSE otherwise.
> +  @param FvName                 The name of the Firmware Volume. Valid only if IsExtractedFv is TRUE
> +  @param FileName               The name of the file. Valid only if IsExtractedFv is TRUE
> +
> +**/
> +VOID
> +EFIAPI
> +BuildFv3Hob (
> +  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,
> +  IN          UINT64                      Length,
> +  IN          UINT32                      AuthenticationStatus,
> +  IN          BOOLEAN                     ExtractedFv,
> +  IN CONST    EFI_GUID                    *FvName, OPTIONAL
> +  IN CONST    EFI_GUID                    *FileName OPTIONAL
> +  )
> +{
> +  EFI_HOB_FIRMWARE_VOLUME3  *Hob;
> +
> +  Hob = CreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3));
>
> +  Hob->BaseAddress          = BaseAddress;
> +  Hob->Length               = Length;
> +  Hob->AuthenticationStatus = AuthenticationStatus;
> +  Hob->ExtractedFv          = ExtractedFv;
> +  if (ExtractedFv) {
> +    CopyGuid (&Hob->FvName, FvName);
> +    CopyGuid (&Hob->FileName, FileName);
> +  }
> +}
>
>  /**
>    Builds a Capsule Volume HOB.
> --
> 2.13.3.windows.1
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/2] EmbeddedPkg PrePiHobLib: Implement BuildFv3Hob
Posted by Zeng, Star 7 years, 2 months ago
Oh, my mistake. :(
Just used to update the copyright date. :)
Will fix it in V2 patch series.


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel
Sent: Thursday, October 5, 2017 3:55 PM
To: Zeng, Star <star.zeng@intel.com>
Cc: edk2-devel@lists.01.org; Laszlo Ersek <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [edk2] [PATCH 1/2] EmbeddedPkg PrePiHobLib: Implement BuildFv3Hob

On 5 October 2017 at 07:33, Star Zeng <star.zeng@intel.com> wrote:
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  EmbeddedPkg/Library/PrePiHobLib/Hob.c | 43 
> ++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c 
> b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> index aff532259ef4..a681587d3ee0 100644
> --- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> +++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> @@ -1,6 +1,6 @@
>  /** @file
>
> -  Copyright (c) 2010, Apple Inc. All rights reserved.<BR>
> +  Copyright (c) 2010 - 2017, Apple Inc. All rights reserved.<BR>
>

You may want to change this :-)

>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of 
> the BSD License @@ -601,7 +601,48 @@ BuildFv2Hob (
>    CopyGuid (&Hob->FileName, FileName);  }
>
> +/**
> +  Builds a EFI_HOB_TYPE_FV3 HOB.
> +
> +  This function builds a EFI_HOB_TYPE_FV3 HOB.
> +  It can only be invoked during PEI phase;  for DXE phase, it will 
> + ASSERT() since PEI HOB is read-only for DXE phase.
> +
> +  If there is no additional space for HOB creation, then ASSERT().
> +
> +  @param BaseAddress            The base address of the Firmware Volume.
> +  @param Length                 The size of the Firmware Volume in bytes.
> +  @param AuthenticationStatus   The authentication status.
> +  @param ExtractedFv            TRUE if the FV was extracted as a file within another firmware volume.
> +                                FALSE otherwise.
> +  @param FvName                 The name of the Firmware Volume. Valid only if IsExtractedFv is TRUE
> +  @param FileName               The name of the file. Valid only if IsExtractedFv is TRUE
> +
> +**/
> +VOID
> +EFIAPI
> +BuildFv3Hob (
> +  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,
> +  IN          UINT64                      Length,
> +  IN          UINT32                      AuthenticationStatus,
> +  IN          BOOLEAN                     ExtractedFv,
> +  IN CONST    EFI_GUID                    *FvName, OPTIONAL
> +  IN CONST    EFI_GUID                    *FileName OPTIONAL
> +  )
> +{
> +  EFI_HOB_FIRMWARE_VOLUME3  *Hob;
> +
> +  Hob = CreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof 
> + (EFI_HOB_FIRMWARE_VOLUME3));
>
> +  Hob->BaseAddress          = BaseAddress;
> +  Hob->Length               = Length;
> +  Hob->AuthenticationStatus = AuthenticationStatus;
> +  Hob->ExtractedFv          = ExtractedFv;
> +  if (ExtractedFv) {
> +    CopyGuid (&Hob->FvName, FvName);
> +    CopyGuid (&Hob->FileName, FileName);
> +  }
> +}
>
>  /**
>    Builds a Capsule Volume HOB.
> --
> 2.13.3.windows.1
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel