public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg
@ 2023-01-19  1:51 Min Xu
  2023-01-19  1:51 ` [PATCH V1 1/2] EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook Min Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Min Xu @ 2023-01-19  1:51 UTC (permalink / raw)
  To: devel
  Cc: Min Xu, Leif Lindholm, Ard Biesheuvel, Abner Chang,
	Daniel Schaefer, Gerd Hoffmann, Erdem Aktas, James Bottomley,
	Jiewen Yao, Tom Lendacky

Commit c673216 introduces FFS_CHECK_SECTION_HOOK and add it as the
second input parameter in FfsFindSectionData. This change breaks the build
of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData
is renamed as FfsFindSectionDataWithHook. Then the original
FfsFindSectionData is added back.

After FfsFindSectionData is renamed as FfsFindSectionDataWithHook,
PeilessStartupLib in OvmfPkg is updated as well.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>

Min M Xu (2):
  EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook
  EmbeddedPkg: Add back FfsFindSectionData

 EmbeddedPkg/Include/Library/PrePiLib.h      | 22 +++++++++++++-
 EmbeddedPkg/Library/PrePiLib/FwVol.c        | 33 ++++++++++++++++++---
 EmbeddedPkg/Library/PrePiLib/PrePiLib.c     |  2 +-
 OvmfPkg/Library/PeilessStartupLib/DxeLoad.c |  4 +--
 4 files changed, 53 insertions(+), 8 deletions(-)

-- 
2.29.2.windows.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V1 1/2] EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook
  2023-01-19  1:51 [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Min Xu
@ 2023-01-19  1:51 ` Min Xu
  2023-01-19  1:51 ` [PATCH V1 2/2] EmbeddedPkg: Add back FfsFindSectionData Min Xu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Min Xu @ 2023-01-19  1:51 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Leif Lindholm, Ard Biesheuvel, Abner Chang,
	Daniel Schaefer, Gerd Hoffmann, Erdem Aktas, James Bottomley,
	Jiewen Yao, Tom Lendacky

From: Min M Xu <min.m.xu@intel.com>

Commit c673216f53 introduces FFS_CHECK_SECTION_HOOK and add it as the
second input parameter in FfsFindSectionData. This change breaks the build
of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData
is renamed as FfsFindSectionDataWithHook in this patch. In the following
patch the original FfsFindSectionData will be added back.

FfsFindSectionData is renamed as FfsFindSectionDataWithHook. Accordingly
PeilessStartupLib in OvmfPkg should be updated as well. To prevent the
build from being broken, the changes in OvmfPkg are in this patch.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 EmbeddedPkg/Include/Library/PrePiLib.h      |  2 +-
 EmbeddedPkg/Library/PrePiLib/FwVol.c        | 10 ++++++----
 EmbeddedPkg/Library/PrePiLib/PrePiLib.c     |  2 +-
 OvmfPkg/Library/PeilessStartupLib/DxeLoad.c |  4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h b/EmbeddedPkg/Include/Library/PrePiLib.h
index f60b6678185a..0c259864d612 100644
--- a/EmbeddedPkg/Include/Library/PrePiLib.h
+++ b/EmbeddedPkg/Include/Library/PrePiLib.h
@@ -78,7 +78,7 @@ EFI_STATUS
 **/
 EFI_STATUS
 EFIAPI
-FfsFindSectionData (
+FfsFindSectionDataWithHook (
   IN EFI_SECTION_TYPE        SectionType,
   IN FFS_CHECK_SECTION_HOOK  SectionCheckHook,
   IN EFI_PEI_FILE_HANDLE     FileHandle,
diff --git a/EmbeddedPkg/Library/PrePiLib/FwVol.c b/EmbeddedPkg/Library/PrePiLib/FwVol.c
index 778d8b13c33b..85dbf5b0adb3 100644
--- a/EmbeddedPkg/Library/PrePiLib/FwVol.c
+++ b/EmbeddedPkg/Library/PrePiLib/FwVol.c
@@ -459,9 +459,11 @@ CheckNextSection:
 
 /**
   This service enables discovery sections of a given type within a valid FFS file.
+  Caller also can provide a SectionCheckHook to do additional checking.
 
-  @param  SearchType            The value of the section type to find.
-  @param  FfsFileHeader         A pointer to the file header that contains the set of sections to
+  @param  SectionType           The value of the section type to find.
+  @param  SectionCheckHook      A hook which can check if the section is the target one.
+  @param  FileHandle            A pointer to the file header that contains the set of sections to
                                 be searched.
   @param  SectionData           A pointer to the discovered section, if successful.
 
@@ -471,7 +473,7 @@ CheckNextSection:
 **/
 EFI_STATUS
 EFIAPI
-FfsFindSectionData (
+FfsFindSectionDataWithHook (
   IN EFI_SECTION_TYPE        SectionType,
   IN FFS_CHECK_SECTION_HOOK  SectionCheckHook,
   IN EFI_PEI_FILE_HANDLE     FileHandle,
@@ -817,7 +819,7 @@ FfsProcessFvFile (
   //
   // Find FvImage in FvFile
   //
-  Status = FfsFindSectionData (EFI_SECTION_FIRMWARE_VOLUME_IMAGE, NULL, FvFileHandle, (VOID **)&FvImageHandle);
+  Status = FfsFindSectionDataWithHook (EFI_SECTION_FIRMWARE_VOLUME_IMAGE, NULL, FvFileHandle, (VOID **)&FvImageHandle);
   if (EFI_ERROR (Status)) {
     return Status;
   }
diff --git a/EmbeddedPkg/Library/PrePiLib/PrePiLib.c b/EmbeddedPkg/Library/PrePiLib/PrePiLib.c
index 3b6fc4f0eba8..3cf866dab248 100644
--- a/EmbeddedPkg/Library/PrePiLib/PrePiLib.c
+++ b/EmbeddedPkg/Library/PrePiLib/PrePiLib.c
@@ -131,7 +131,7 @@ LoadDxeCoreFromFfsFile (
   VOID                  *Hob;
   EFI_FV_FILE_INFO      FvFileInfo;
 
-  Status = FfsFindSectionData (EFI_SECTION_PE32, NULL, FileHandle, &PeCoffImage);
+  Status = FfsFindSectionDataWithHook (EFI_SECTION_PE32, NULL, FileHandle, &PeCoffImage);
   if (EFI_ERROR (Status)) {
     return Status;
   }
diff --git a/OvmfPkg/Library/PeilessStartupLib/DxeLoad.c b/OvmfPkg/Library/PeilessStartupLib/DxeLoad.c
index 4b1fefd452dc..d34690eb8a0b 100644
--- a/OvmfPkg/Library/PeilessStartupLib/DxeLoad.c
+++ b/OvmfPkg/Library/PeilessStartupLib/DxeLoad.c
@@ -209,7 +209,7 @@ FindDxeNonCc (
   //
   // Find FvImage in FvFile
   //
-  Status = FfsFindSectionData (EFI_SECTION_FIRMWARE_VOLUME_IMAGE, CheckSectionHookForDxeNonCc, FileHandle, (VOID **)&FvImageHandle);
+  Status = FfsFindSectionDataWithHook (EFI_SECTION_FIRMWARE_VOLUME_IMAGE, CheckSectionHookForDxeNonCc, FileHandle, (VOID **)&FvImageHandle);
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -303,7 +303,7 @@ DxeLoadCore (
   //
   // Load the DXE Core from a Firmware Volume.
   //
-  Status = FfsFindSectionData (EFI_SECTION_PE32, NULL, FileHandle, &PeCoffImage);
+  Status = FfsFindSectionDataWithHook (EFI_SECTION_PE32, NULL, FileHandle, &PeCoffImage);
   if (EFI_ERROR (Status)) {
     return Status;
   }
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V1 2/2] EmbeddedPkg: Add back FfsFindSectionData
  2023-01-19  1:51 [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Min Xu
  2023-01-19  1:51 ` [PATCH V1 1/2] EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook Min Xu
@ 2023-01-19  1:51 ` Min Xu
  2023-01-19  2:15 ` [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Yao, Jiewen
  2023-01-19  7:55 ` [edk2-devel] " Gerd Hoffmann
  3 siblings, 0 replies; 6+ messages in thread
From: Min Xu @ 2023-01-19  1:51 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Leif Lindholm, Ard Biesheuvel, Abner Chang,
	Daniel Schaefer, Gerd Hoffmann, Erdem Aktas, James Bottomley,
	Jiewen Yao, Tom Lendacky

From: Min M Xu <min.m.xu@intel.com>

In commit c673216f53 a new input parameter is added in FfsFindSectionData.
That change breaks the build of ArmVirtPkg. In this patch
FfsFindSectionData is added back. It calls FfsFindSectionDataWithHook with
a NULL hook.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 EmbeddedPkg/Include/Library/PrePiLib.h | 20 ++++++++++++++++++++
 EmbeddedPkg/Library/PrePiLib/FwVol.c   | 23 +++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h b/EmbeddedPkg/Include/Library/PrePiLib.h
index 0c259864d612..93a9115eac2d 100644
--- a/EmbeddedPkg/Include/Library/PrePiLib.h
+++ b/EmbeddedPkg/Include/Library/PrePiLib.h
@@ -85,6 +85,26 @@ FfsFindSectionDataWithHook (
   OUT VOID                   **SectionData
   );
 
+/**
+  This service enables discovery sections of a given type within a valid FFS file.
+
+  @param  SectionType           The value of the section type to find.
+  @param  FileHandle            A pointer to the file header that contains the set of sections to
+                                be searched.
+  @param  SectionData           A pointer to the discovered section, if successful.
+
+  @retval EFI_SUCCESS           The section was found.
+  @retval EFI_NOT_FOUND         The section was not found.
+
+**/
+EFI_STATUS
+EFIAPI
+FfsFindSectionData (
+  IN EFI_SECTION_TYPE     SectionType,
+  IN EFI_PEI_FILE_HANDLE  FileHandle,
+  OUT VOID                **SectionData
+  );
+
 /**
   Find a file in the volume by name
 
diff --git a/EmbeddedPkg/Library/PrePiLib/FwVol.c b/EmbeddedPkg/Library/PrePiLib/FwVol.c
index 85dbf5b0adb3..7739a5c8aae7 100644
--- a/EmbeddedPkg/Library/PrePiLib/FwVol.c
+++ b/EmbeddedPkg/Library/PrePiLib/FwVol.c
@@ -504,6 +504,29 @@ FfsFindSectionDataWithHook (
            );
 }
 
+/**
+  This service enables discovery sections of a given type within a valid FFS file.
+
+  @param  SectionType           The value of the section type to find.
+  @param  FileHandle            A pointer to the file header that contains the set of sections to
+                                be searched.
+  @param  SectionData           A pointer to the discovered section, if successful.
+
+  @retval EFI_SUCCESS           The section was found.
+  @retval EFI_NOT_FOUND         The section was not found.
+
+**/
+EFI_STATUS
+EFIAPI
+FfsFindSectionData (
+  IN EFI_SECTION_TYPE     SectionType,
+  IN EFI_PEI_FILE_HANDLE  FileHandle,
+  OUT VOID                **SectionData
+  )
+{
+  return FfsFindSectionDataWithHook (SectionType, NULL, FileHandle, SectionData);
+}
+
 /**
   This service enables discovery of additional firmware files.
 
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg
  2023-01-19  1:51 [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Min Xu
  2023-01-19  1:51 ` [PATCH V1 1/2] EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook Min Xu
  2023-01-19  1:51 ` [PATCH V1 2/2] EmbeddedPkg: Add back FfsFindSectionData Min Xu
@ 2023-01-19  2:15 ` Yao, Jiewen
  2023-01-19  7:55 ` [edk2-devel] " Gerd Hoffmann
  3 siblings, 0 replies; 6+ messages in thread
From: Yao, Jiewen @ 2023-01-19  2:15 UTC (permalink / raw)
  To: Xu, Min M, devel@edk2.groups.io
  Cc: Leif Lindholm, Ard Biesheuvel, Abner Chang, Daniel Schaefer,
	Gerd Hoffmann, Aktas, Erdem, James Bottomley, Tom Lendacky

Thanks for the quick update.

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Thursday, January 19, 2023 9:51 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Leif Lindholm
> <quic_llindhol@quicinc.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Abner Chang <abner.chang@amd.com>; Daniel Schaefer
> <git@danielschaefer.me>; Gerd Hoffmann <kraxel@redhat.com>; Aktas,
> Erdem <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>;
> Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> <thomas.lendacky@amd.com>
> Subject: [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg
> 
> Commit c673216 introduces FFS_CHECK_SECTION_HOOK and add it as the
> second input parameter in FfsFindSectionData. This change breaks the build
> of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData
> is renamed as FfsFindSectionDataWithHook. Then the original
> FfsFindSectionData is added back.
> 
> After FfsFindSectionData is renamed as FfsFindSectionDataWithHook,
> PeilessStartupLib in OvmfPkg is updated as well.
> 
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Daniel Schaefer <git@danielschaefer.me>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> 
> Min M Xu (2):
>   EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook
>   EmbeddedPkg: Add back FfsFindSectionData
> 
>  EmbeddedPkg/Include/Library/PrePiLib.h      | 22 +++++++++++++-
>  EmbeddedPkg/Library/PrePiLib/FwVol.c        | 33 ++++++++++++++++++---
>  EmbeddedPkg/Library/PrePiLib/PrePiLib.c     |  2 +-
>  OvmfPkg/Library/PeilessStartupLib/DxeLoad.c |  4 +--
>  4 files changed, 53 insertions(+), 8 deletions(-)
> 
> --
> 2.29.2.windows.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg
  2023-01-19  1:51 [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Min Xu
                   ` (2 preceding siblings ...)
  2023-01-19  2:15 ` [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Yao, Jiewen
@ 2023-01-19  7:55 ` Gerd Hoffmann
  2023-01-19  8:10   ` Ard Biesheuvel
  3 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2023-01-19  7:55 UTC (permalink / raw)
  To: devel, min.m.xu
  Cc: Leif Lindholm, Ard Biesheuvel, Abner Chang, Daniel Schaefer,
	Erdem Aktas, James Bottomley, Jiewen Yao, Tom Lendacky

On Thu, Jan 19, 2023 at 09:51:06AM +0800, Min Xu wrote:
> Commit c673216 introduces FFS_CHECK_SECTION_HOOK and add it as the
> second input parameter in FfsFindSectionData. This change breaks the build
> of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData
> is renamed as FfsFindSectionDataWithHook. Then the original
> FfsFindSectionData is added back.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg
  2023-01-19  7:55 ` [edk2-devel] " Gerd Hoffmann
@ 2023-01-19  8:10   ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2023-01-19  8:10 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: devel, min.m.xu, Leif Lindholm, Ard Biesheuvel, Abner Chang,
	Daniel Schaefer, Erdem Aktas, James Bottomley, Jiewen Yao,
	Tom Lendacky

On Thu, 19 Jan 2023 at 08:55, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Thu, Jan 19, 2023 at 09:51:06AM +0800, Min Xu wrote:
> > Commit c673216 introduces FFS_CHECK_SECTION_HOOK and add it as the
> > second input parameter in FfsFindSectionData. This change breaks the build
> > of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData
> > is renamed as FfsFindSectionDataWithHook. Then the original
> > FfsFindSectionData is added back.
>
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
>

Thanks all

I will go and push this.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-19  8:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-19  1:51 [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Min Xu
2023-01-19  1:51 ` [PATCH V1 1/2] EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook Min Xu
2023-01-19  1:51 ` [PATCH V1 2/2] EmbeddedPkg: Add back FfsFindSectionData Min Xu
2023-01-19  2:15 ` [PATCH V1 0/2] Add back FfsFindSectionData in EmbeddedPkg Yao, Jiewen
2023-01-19  7:55 ` [edk2-devel] " Gerd Hoffmann
2023-01-19  8:10   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox