Add BuildFv3Hob API in HobLib.h and implement the API
in HobLib instances PeiHobLib, DxeHobLib and DxeCoreHobLib.
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
MdePkg/Include/Library/HobLib.h | 34 ++++++++++++++++++++--
MdePkg/Library/DxeCoreHobLib/HobLib.c | 35 ++++++++++++++++++++++-
MdePkg/Library/DxeHobLib/HobLib.c | 32 +++++++++++++++++++++
MdePkg/Library/PeiHobLib/HobLib.c | 54 ++++++++++++++++++++++++++++++++++-
4 files changed, 151 insertions(+), 4 deletions(-)
diff --git a/MdePkg/Include/Library/HobLib.h b/MdePkg/Include/Library/HobLib.h
index fc48703826c5..6f1f7b3f5f20 100644
--- a/MdePkg/Include/Library/HobLib.h
+++ b/MdePkg/Include/Library/HobLib.h
@@ -6,9 +6,9 @@
defined in the PI Specification.
A HOB is a Hand-Off Block, defined in the Framework architecture, that
allows the PEI phase to pass information to the DXE phase. HOBs are position
- independent and can be relocated easily to different memory memory locations.
+ independent and can be relocated easily to different memory locations.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -343,6 +343,36 @@ BuildFv2Hob (
);
/**
+ 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().
+ If the FvImage buffer is not at its required alignment, 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
+ );
+
+/**
Builds a Capsule Volume HOB.
This function builds a Capsule Volume HOB.
diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/MdePkg/Library/DxeCoreHobLib/HobLib.c
index 2e5fb1c6ee55..2f4f4b473386 100644
--- a/MdePkg/Library/DxeCoreHobLib/HobLib.c
+++ b/MdePkg/Library/DxeCoreHobLib/HobLib.c
@@ -1,7 +1,7 @@
/** @file
HOB Library implementation for DxeCore driver.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -433,6 +433,39 @@ BuildFv2Hob (
}
/**
+ 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().
+ If the FvImage buffer is not at its required alignment, 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
+ )
+{
+ ASSERT (FALSE);
+}
+
+/**
Builds a Capsule Volume HOB.
This function builds a Capsule Volume HOB.
diff --git a/MdePkg/Library/DxeHobLib/HobLib.c b/MdePkg/Library/DxeHobLib/HobLib.c
index bb65206b044a..dac593d5da9d 100644
--- a/MdePkg/Library/DxeHobLib/HobLib.c
+++ b/MdePkg/Library/DxeHobLib/HobLib.c
@@ -466,6 +466,38 @@ BuildFv2Hob (
ASSERT (FALSE);
}
+/**
+ 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().
+ If the FvImage buffer is not at its required alignment, 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
+ )
+{
+ ASSERT (FALSE);
+}
/**
Builds a Capsule Volume HOB.
diff --git a/MdePkg/Library/PeiHobLib/HobLib.c b/MdePkg/Library/PeiHobLib/HobLib.c
index a1522dd9f5ff..68df7292a7ec 100644
--- a/MdePkg/Library/PeiHobLib/HobLib.c
+++ b/MdePkg/Library/PeiHobLib/HobLib.c
@@ -1,7 +1,7 @@
/** @file
Provide Hob Library functions for Pei phase.
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -610,6 +610,58 @@ BuildFv2Hob (
}
/**
+ 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().
+ If the FvImage buffer is not at its required alignment, 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;
+
+ if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+ ASSERT (FALSE);
+ return;
+ }
+
+ Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3));
+ if (Hob == NULL) {
+ return;
+ }
+
+ 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.
This function 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
Hi Star, On 10/04/17 16:21, Star Zeng wrote: > Add BuildFv3Hob API in HobLib.h and implement the API > in HobLib instances PeiHobLib, DxeHobLib and DxeCoreHobLib. > > Cc: Liming Gao <liming.gao@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng <star.zeng@intel.com> > --- > MdePkg/Include/Library/HobLib.h | 34 ++++++++++++++++++++-- > MdePkg/Library/DxeCoreHobLib/HobLib.c | 35 ++++++++++++++++++++++- > MdePkg/Library/DxeHobLib/HobLib.c | 32 +++++++++++++++++++++ > MdePkg/Library/PeiHobLib/HobLib.c | 54 ++++++++++++++++++++++++++++++++++- > 4 files changed, 151 insertions(+), 4 deletions(-) > > diff --git a/MdePkg/Include/Library/HobLib.h b/MdePkg/Include/Library/HobLib.h > index fc48703826c5..6f1f7b3f5f20 100644 > --- a/MdePkg/Include/Library/HobLib.h > +++ b/MdePkg/Include/Library/HobLib.h > @@ -6,9 +6,9 @@ > defined in the PI Specification. > A HOB is a Hand-Off Block, defined in the Framework architecture, that > allows the PEI phase to pass information to the DXE phase. HOBs are position > - independent and can be relocated easily to different memory memory locations. > + independent and can be relocated easily to different memory locations. > > -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> > +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD License > which accompanies this distribution. The full text of the license may be found at > @@ -343,6 +343,36 @@ BuildFv2Hob ( > ); > > /** > + 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(). > + If the FvImage buffer is not at its required alignment, 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 > + ); > + > +/** > Builds a Capsule Volume HOB. > > This function builds a Capsule Volume HOB. do we need to copy the implementation(s) of this function to other instances of HobLib? edk2 has the following HobLib instances: 1 ArmVirtPkg/Library/ArmVirtDxeHobLib/ArmVirtDxeHobLib.inf 2 EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf 3 IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf 4 MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf 5 MdePkg/Library/DxeHobLib/DxeHobLib.inf 6 MdePkg/Library/PeiHobLib/PeiHobLib.inf Instances #4 through #6 are extended in this patch; instance #3 is extended in the next patch. Instances #1 and #2 are not changed. Is that OK? (For example, some of the ArmVirt platforms use instance #1 for all DXE and "later" modules. Some other ArmVirt platforms use instance #2.) Thanks, Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Thanks for the reminder. I just sent patch series https://lists.01.org/pipermail/edk2-devel/2017-October/015614.html as supplement. The FfsProcessFvFile() in EmbeddedPkg/Library/PrePiLib/FwVol.c may need to build FV3 HOB with authentication status to be propagated to DXE. (FfsProcessFvFile() -> FfsFindSectionData() -> FfsProcessSection() -> ExtractGuidedSectionDecode()), FfsFindSectionData() and FfsProcessSection() may need to be updated to return authentication status to FfsProcessFvFile(). But it is not really needed at all after checking the platforms as they are all using MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf that has no concept of authentication status at all and always returns 0 authentication status (https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/LzmaCustomDecompressLib/GuidedSectionExtraction.c L154 and L172), so the EmbeddedPkg/Library/PrePiLib/FwVol.c can be kept with no change. :) Thanks, Star -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com] Sent: Wednesday, October 4, 2017 11:39 PM To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org> Subject: Re: [edk2] [PATCH 2/5] MdePkg HobLib: Add BuildFv3Hob API Hi Star, On 10/04/17 16:21, Star Zeng wrote: > Add BuildFv3Hob API in HobLib.h and implement the API in HobLib > instances PeiHobLib, DxeHobLib and DxeCoreHobLib. > > Cc: Liming Gao <liming.gao@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng <star.zeng@intel.com> > --- > MdePkg/Include/Library/HobLib.h | 34 ++++++++++++++++++++-- > MdePkg/Library/DxeCoreHobLib/HobLib.c | 35 ++++++++++++++++++++++- > MdePkg/Library/DxeHobLib/HobLib.c | 32 +++++++++++++++++++++ > MdePkg/Library/PeiHobLib/HobLib.c | 54 ++++++++++++++++++++++++++++++++++- > 4 files changed, 151 insertions(+), 4 deletions(-) > > diff --git a/MdePkg/Include/Library/HobLib.h > b/MdePkg/Include/Library/HobLib.h index fc48703826c5..6f1f7b3f5f20 > 100644 > --- a/MdePkg/Include/Library/HobLib.h > +++ b/MdePkg/Include/Library/HobLib.h > @@ -6,9 +6,9 @@ > defined in the PI Specification. > A HOB is a Hand-Off Block, defined in the Framework architecture, that > allows the PEI phase to pass information to the DXE phase. HOBs are > position > - independent and can be relocated easily to different memory memory locations. > + independent and can be relocated easily to different memory locations. > > -Copyright (c) 2006 - 2016, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2017, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at @@ -343,6 +343,36 @@ BuildFv2Hob ( > ); > > /** > + 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(). > + If the FvImage buffer is not at its required alignment, 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 > + ); > + > +/** > Builds a Capsule Volume HOB. > > This function builds a Capsule Volume HOB. do we need to copy the implementation(s) of this function to other instances of HobLib? edk2 has the following HobLib instances: 1 ArmVirtPkg/Library/ArmVirtDxeHobLib/ArmVirtDxeHobLib.inf 2 EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf 3 IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf 4 MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf 5 MdePkg/Library/DxeHobLib/DxeHobLib.inf 6 MdePkg/Library/PeiHobLib/PeiHobLib.inf Instances #4 through #6 are extended in this patch; instance #3 is extended in the next patch. Instances #1 and #2 are not changed. Is that OK? (For example, some of the ArmVirt platforms use instance #1 for all DXE and "later" modules. Some other ArmVirt platforms use instance #2.) Thanks, Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.