Re: [edk2] [PATCH v1 07/18] StandaloneMmPkg/FvLib: Add a common FV Library for management mode.
My response inline. -Original Message- From: Achin Gupta Sent: Monday, April 16, 2018 9:44 AM To: Supreeth VenkateshCc: edk2-devel@lists.01.org; michael.d.kin...@intel.com; liming@intel.com; jiewen@intel.com; leif.lindh...@linaro.org; ard.biesheu...@linaro.org; nd Subject: Re: [PATCH v1 07/18] StandaloneMmPkg/FvLib: Add a common FV Library for management mode. Hi Supreeth, On Fri, Apr 06, 2018 at 03:42:12PM +0100, Supreeth Venkatesh wrote: > This patch implements a firmware volume library that can be used by > the Standalone management mode core module to parse the firmware volume. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Achin Gupta I have not contributed to this patch at all. Could you please remove me? Not being an expert, I will wait for Jiewen's feedback cycle to complete. [Supreeth] Ok. Jiewen has given his feedback already. cheers, Achin > Signed-off-by: Supreeth Venkatesh > --- > StandaloneMmPkg/Include/Library/FvLib.h | 109 ++ > StandaloneMmPkg/Library/FvLib/FvLib.c | 366 > > StandaloneMmPkg/Library/FvLib/FvLib.inf | 57 + > 3 files changed, 532 insertions(+) > create mode 100644 StandaloneMmPkg/Include/Library/FvLib.h > create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.c > create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.inf > > diff --git a/StandaloneMmPkg/Include/Library/FvLib.h > b/StandaloneMmPkg/Include/Library/FvLib.h > new file mode 100644 > index 00..13e1ae2b01 > --- /dev/null > +++ b/StandaloneMmPkg/Include/Library/FvLib.h > @@ -0,0 +1,109 @@ > +/** @file > + > +Copyright (c) 2015, Intel Corporation. All rights reserved. > +Copyright (c) 2016 - 2017, ARM Limited. All rights reserved. > + > +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 http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef _FV_LIB_H_ > +#define _FV_LIB_H_ > + > +#include > +#include > +#include > + > +/** > + Given the input file pointer, search for the next matching file in > +the > + FFS volume as defined by SearchType. The search starts from > +FileHeader inside > + the Firmware Volume defined by FwVolHeader. > + > + @param SearchType Filter to find only files of this type. > + Type EFI_FV_FILETYPE_ALL causes no filtering to be > done. > + @param FwVolHeader Pointer to the FV header of the volume to search. > + This parameter must point to a valid FFS volume. > + @param FileHeader Pointer to the current file from which to begin > searching. > + This pointer will be updated upon return to reflect > the file found. > + > + @retval EFI_NOT_FOUND No files matching the search criteria were > +found > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +EFIAPI > +FfsFindNextFile ( > + IN EFI_FV_FILETYPE SearchType, > + IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, > + IN OUT EFI_FFS_FILE_HEADER **FileHeader > + ); > + > +/** > + Given the input file pointer, search for the next matching section > +in the > + FFS volume. > + > + @param SearchTypeFilter to find only sections of this type. > + @param FfsFileHeader Pointer to the current file to search. > + @param SectionHeader Pointer to the Section matching SectionType in > FfsFileHeader. > +NULL if section not found > + > + @retval EFI_NOT_FOUND No files matching the search criteria were > +found > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +FfsFindSection ( > + IN EFI_SECTION_TYPE SectionType, > + IN EFI_FFS_FILE_HEADER *FfsFileHeader, > + IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader > + ); > + > +/** > + Locates a section within a series of sections > + with the specified section type. > + > + @param[in] SectionsThe sections to search > + @param[in] SizeOfSections Total size of all sections > + @param[in] SectionType The section type to locate > + @param[out] FoundSectionThe FFS section if found > + > + @retval EFI_SUCCESS The file and section was found > + @retval EFI_NOT_FOUND The file and section was not found > + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted **/ > +EFI_STATUS EFIAPI FindFfsSectionInSections ( > + IN VOID *Sections, > + IN UINTNSizeOfSections, > + IN EFI_SECTION_TYPE SectionType, > + OUT EFI_COMMON_SECTION_HEADER**FoundSection > + ); > + > +/** > + Given the
Re: [edk2] [PATCH v1 07/18] StandaloneMmPkg/FvLib: Add a common FV Library for management mode.
Hi Supreeth, On Fri, Apr 06, 2018 at 03:42:12PM +0100, Supreeth Venkatesh wrote: > This patch implements a firmware volume library that can be used by the > Standalone management mode core module to parse the firmware volume. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Achin GuptaI have not contributed to this patch at all. Could you please remove me? Not being an expert, I will wait for Jiewen's feedback cycle to complete. cheers, Achin > Signed-off-by: Supreeth Venkatesh > --- > StandaloneMmPkg/Include/Library/FvLib.h | 109 ++ > StandaloneMmPkg/Library/FvLib/FvLib.c | 366 > > StandaloneMmPkg/Library/FvLib/FvLib.inf | 57 + > 3 files changed, 532 insertions(+) > create mode 100644 StandaloneMmPkg/Include/Library/FvLib.h > create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.c > create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.inf > > diff --git a/StandaloneMmPkg/Include/Library/FvLib.h > b/StandaloneMmPkg/Include/Library/FvLib.h > new file mode 100644 > index 00..13e1ae2b01 > --- /dev/null > +++ b/StandaloneMmPkg/Include/Library/FvLib.h > @@ -0,0 +1,109 @@ > +/** @file > + > +Copyright (c) 2015, Intel Corporation. All rights reserved. > +Copyright (c) 2016 - 2017, ARM Limited. All rights reserved. > + > +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 > +http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef _FV_LIB_H_ > +#define _FV_LIB_H_ > + > +#include > +#include > +#include > + > +/** > + Given the input file pointer, search for the next matching file in the > + FFS volume as defined by SearchType. The search starts from FileHeader > inside > + the Firmware Volume defined by FwVolHeader. > + > + @param SearchType Filter to find only files of this type. > + Type EFI_FV_FILETYPE_ALL causes no filtering to be > done. > + @param FwVolHeader Pointer to the FV header of the volume to search. > + This parameter must point to a valid FFS volume. > + @param FileHeader Pointer to the current file from which to begin > searching. > + This pointer will be updated upon return to reflect > the file found. > + > + @retval EFI_NOT_FOUND No files matching the search criteria were found > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +EFIAPI > +FfsFindNextFile ( > + IN EFI_FV_FILETYPE SearchType, > + IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, > + IN OUT EFI_FFS_FILE_HEADER **FileHeader > + ); > + > +/** > + Given the input file pointer, search for the next matching section in the > + FFS volume. > + > + @param SearchTypeFilter to find only sections of this type. > + @param FfsFileHeader Pointer to the current file to search. > + @param SectionHeader Pointer to the Section matching SectionType in > FfsFileHeader. > +NULL if section not found > + > + @retval EFI_NOT_FOUND No files matching the search criteria were found > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +FfsFindSection ( > + IN EFI_SECTION_TYPE SectionType, > + IN EFI_FFS_FILE_HEADER *FfsFileHeader, > + IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader > + ); > + > +/** > + Locates a section within a series of sections > + with the specified section type. > + > + @param[in] SectionsThe sections to search > + @param[in] SizeOfSections Total size of all sections > + @param[in] SectionType The section type to locate > + @param[out] FoundSectionThe FFS section if found > + > + @retval EFI_SUCCESS The file and section was found > + @retval EFI_NOT_FOUND The file and section was not found > + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted > +**/ > +EFI_STATUS > +EFIAPI > +FindFfsSectionInSections ( > + IN VOID *Sections, > + IN UINTNSizeOfSections, > + IN EFI_SECTION_TYPE SectionType, > + OUT EFI_COMMON_SECTION_HEADER**FoundSection > + ); > + > +/** > + Given the input file pointer, search for the next matching section in the > + FFS volume. > + > + @param SearchType Filter to find only sections of this type. > + @param FfsFileHeader Pointer to the current file to search. > + @param SectionData Pointer to the Section matching SectionType in > FfsFileHeader. > + NULL if section not found > + @param SectionDataSize The size of SectionData > + > + @retval EFI_NOT_FOUND No files matching
[edk2] [PATCH v1 07/18] StandaloneMmPkg/FvLib: Add a common FV Library for management mode.
This patch implements a firmware volume library that can be used by the Standalone management mode core module to parse the firmware volume. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Achin GuptaSigned-off-by: Supreeth Venkatesh --- StandaloneMmPkg/Include/Library/FvLib.h | 109 ++ StandaloneMmPkg/Library/FvLib/FvLib.c | 366 StandaloneMmPkg/Library/FvLib/FvLib.inf | 57 + 3 files changed, 532 insertions(+) create mode 100644 StandaloneMmPkg/Include/Library/FvLib.h create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.c create mode 100644 StandaloneMmPkg/Library/FvLib/FvLib.inf diff --git a/StandaloneMmPkg/Include/Library/FvLib.h b/StandaloneMmPkg/Include/Library/FvLib.h new file mode 100644 index 00..13e1ae2b01 --- /dev/null +++ b/StandaloneMmPkg/Include/Library/FvLib.h @@ -0,0 +1,109 @@ +/** @file + +Copyright (c) 2015, Intel Corporation. All rights reserved. +Copyright (c) 2016 - 2017, ARM Limited. All rights reserved. + +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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _FV_LIB_H_ +#define _FV_LIB_H_ + +#include +#include +#include + +/** + Given the input file pointer, search for the next matching file in the + FFS volume as defined by SearchType. The search starts from FileHeader inside + the Firmware Volume defined by FwVolHeader. + + @param SearchType Filter to find only files of this type. + Type EFI_FV_FILETYPE_ALL causes no filtering to be done. + @param FwVolHeader Pointer to the FV header of the volume to search. + This parameter must point to a valid FFS volume. + @param FileHeader Pointer to the current file from which to begin searching. + This pointer will be updated upon return to reflect the file found. + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +FfsFindNextFile ( + IN EFI_FV_FILETYPE SearchType, + IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, + IN OUT EFI_FFS_FILE_HEADER **FileHeader + ); + +/** + Given the input file pointer, search for the next matching section in the + FFS volume. + + @param SearchTypeFilter to find only sections of this type. + @param FfsFileHeader Pointer to the current file to search. + @param SectionHeader Pointer to the Section matching SectionType in FfsFileHeader. +NULL if section not found + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +FfsFindSection ( + IN EFI_SECTION_TYPE SectionType, + IN EFI_FFS_FILE_HEADER *FfsFileHeader, + IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader + ); + +/** + Locates a section within a series of sections + with the specified section type. + + @param[in] SectionsThe sections to search + @param[in] SizeOfSections Total size of all sections + @param[in] SectionType The section type to locate + @param[out] FoundSectionThe FFS section if found + + @retval EFI_SUCCESS The file and section was found + @retval EFI_NOT_FOUND The file and section was not found + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted +**/ +EFI_STATUS +EFIAPI +FindFfsSectionInSections ( + IN VOID *Sections, + IN UINTNSizeOfSections, + IN EFI_SECTION_TYPE SectionType, + OUT EFI_COMMON_SECTION_HEADER**FoundSection + ); + +/** + Given the input file pointer, search for the next matching section in the + FFS volume. + + @param SearchType Filter to find only sections of this type. + @param FfsFileHeader Pointer to the current file to search. + @param SectionData Pointer to the Section matching SectionType in FfsFileHeader. + NULL if section not found + @param SectionDataSize The size of SectionData + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +FfsFindSectionData ( + IN EFI_SECTION_TYPE SectionType, + IN EFI_FFS_FILE_HEADER *FfsFileHeader, + OUT VOID **SectionData, + OUT UINTN*SectionDataSize + ); + +#endif diff --git a/StandaloneMmPkg/Library/FvLib/FvLib.c b/StandaloneMmPkg/Library/FvLib/FvLib.c new file mode 100644 index 00..cacfc81338 --- /dev/null +++