[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Make GetFspm(s)UpdDataAddress reusable

Kuo, Ted posted 1 patch 2 years, 2 months ago
Failed in applying to current master (apply log)
.../FspmWrapperPeim/FspmWrapperPeim.c              | 18 -----------
.../FspmWrapperPeim/FspmWrapperPeim.inf            |  2 --
.../FspsWrapperPeim/FspsWrapperPeim.c              | 18 -----------
.../FspsWrapperPeim/FspsWrapperPeim.inf            |  2 --
.../Include/Library/FspWrapperApiLib.h             | 22 +++++++++++++
.../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |  5 +++
.../BaseFspWrapperApiLib/FspWrapperApiLib.c        | 36 ++++++++++++++++++++++
7 files changed, 63 insertions(+), 40 deletions(-)
[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Make GetFspm(s)UpdDataAddress reusable
Posted by Kuo, Ted 2 years, 2 months ago
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3821
Moved GetFspmUpdDataAddress and GetFspsUpdDataAddress to FspWrapperApiLib
so that they can be consumed by other drivers.

Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
 .../FspmWrapperPeim/FspmWrapperPeim.c              | 18 -----------
 .../FspmWrapperPeim/FspmWrapperPeim.inf            |  2 --
 .../FspsWrapperPeim/FspsWrapperPeim.c              | 18 -----------
 .../FspsWrapperPeim/FspsWrapperPeim.inf            |  2 --
 .../Include/Library/FspWrapperApiLib.h             | 22 +++++++++++++
 .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |  5 +++
 .../BaseFspWrapperApiLib/FspWrapperApiLib.c        | 36 ++++++++++++++++++++++
 7 files changed, 63 insertions(+), 40 deletions(-)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index b0c6b2f8a6..d119f0b710 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -38,24 +38,6 @@
 
 extern EFI_GUID  gFspHobGuid;
 
-/**
-  Get the FSP M UPD Data address
-
-  @return FSP-M UPD Data Address
-**/
-
-UINTN
-GetFspmUpdDataAddress (
-  VOID
-  )
-{
-  if (PcdGet64 (PcdFspmUpdDataAddress64) != 0) {
-    return (UINTN) PcdGet64 (PcdFspmUpdDataAddress64);
-  } else {
-    return (UINTN) PcdGet32 (PcdFspmUpdDataAddress);
-  }
-}
-
 /**
   Call FspMemoryInit API.
 
diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
index 5d0e021401..95317fb70d 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
@@ -56,11 +56,9 @@
 
 [Pcd]
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress       ## CONSUMES
-  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress    ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection      ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFsptBaseAddress       ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig  ## CONSUMES
-  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress64  ## CONSUMES
 
 [Sources]
   FspmWrapperPeim.c
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
index fadadd40e6..d34de97c1b 100644
--- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
@@ -181,24 +181,6 @@ FspSiliconInitDoneGetFspHobList (
   }
 }
 
-/**
-  Get the FSP S UPD Data address
-
-  @return FSP-S UPD Data Address
-**/
-
-UINTN
-GetFspsUpdDataAddress (
-  VOID
-  )
-{
-  if (PcdGet64 (PcdFspsUpdDataAddress64) != 0) {
-    return (UINTN) PcdGet64 (PcdFspsUpdDataAddress64);
-  } else {
-    return (UINTN) PcdGet32 (PcdFspsUpdDataAddress);
-  }
-}
-
 /**
   This function is for FSP dispatch mode to perform post FSP-S process.
 
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
index da0049a654..50d33d0e0e 100644
--- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
@@ -65,10 +65,8 @@
 
 [Pcd]
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress       ## CONSUMES
-  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress    ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection      ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig  ## CONSUMES
-  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress64  ## CONSUMES
 
 [Guids]
   gFspHobGuid                           ## CONSUMES ## HOB
diff --git a/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h b/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
index d38582d3e5..4ae42ff180 100644
--- a/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
+++ b/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
@@ -11,6 +11,28 @@
 
 #include <FspEas.h>
 
+/**
+  Get the FSP M UPD Data address
+
+  @return FSP-M UPD Data Address
+**/
+UINTN
+EFIAPI
+GetFspmUpdDataAddress (
+  VOID
+  );
+
+/**
+  Get the FSP S UPD Data address
+
+  @return FSP-S UPD Data Address
+**/
+UINTN
+EFIAPI
+GetFspsUpdDataAddress (
+  VOID
+  );
+
 /**
   Find FSP header pointer.
 
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
index 1e348b539f..82496eb300 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
@@ -63,3 +63,8 @@
 [Pcd]
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress  ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress  ## CONSUMES
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress    ## CONSUMES
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress64  ## CONSUMES
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress    ## CONSUMES
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress64  ## CONSUMES
+
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
index 67faad927c..2d24c988b9 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
@@ -12,6 +12,42 @@
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 
+/**
+  Get the FSP M UPD Data address
+
+  @return FSP-M UPD Data Address
+**/
+UINTN
+EFIAPI
+GetFspmUpdDataAddress (
+  VOID
+  )
+{
+  if (PcdGet64 (PcdFspmUpdDataAddress64) != 0) {
+    return (UINTN) PcdGet64 (PcdFspmUpdDataAddress64);
+  } else {
+    return (UINTN) PcdGet32 (PcdFspmUpdDataAddress);
+  }
+}
+
+/**
+  Get the FSP S UPD Data address
+
+  @return FSP-S UPD Data Address
+**/
+UINTN
+EFIAPI
+GetFspsUpdDataAddress (
+  VOID
+  )
+{
+  if (PcdGet64 (PcdFspsUpdDataAddress64) != 0) {
+    return (UINTN) PcdGet64 (PcdFspsUpdDataAddress64);
+  } else {
+    return (UINTN) PcdGet32 (PcdFspsUpdDataAddress);
+  }
+}
+
 /**
   Wrapper for a thunk  to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
   long mode.
-- 
2.16.2.windows.1



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


Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Make GetFspm(s)UpdDataAddress reusable
Posted by Chiu, Chasel 2 years, 2 months ago
Thanks for sending this patch, Ted!
Our direction is to always use PcdFspmUpdDataAddress64 and PcdFspsUpdDataAddress64 from platform side no matter building with IA32 or X64.
This will help retirement of old PcdFspmUpdDataAddress and PcdFspsUpdDataAddress in the future.

Please help to check and let us know if any concern.

Thanks,
Chasel


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kuo, Ted
> Sent: Friday, February 4, 2022 5:39 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Make
> GetFspm(s)UpdDataAddress reusable
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3821
> Moved GetFspmUpdDataAddress and GetFspsUpdDataAddress to
> FspWrapperApiLib so that they can be consumed by other drivers.
> 
> Signed-off-by: Ted Kuo <ted.kuo@intel.com>
> ---
>  .../FspmWrapperPeim/FspmWrapperPeim.c              | 18 -----------
>  .../FspmWrapperPeim/FspmWrapperPeim.inf            |  2 --
>  .../FspsWrapperPeim/FspsWrapperPeim.c              | 18 -----------
>  .../FspsWrapperPeim/FspsWrapperPeim.inf            |  2 --
>  .../Include/Library/FspWrapperApiLib.h             | 22 +++++++++++++
>  .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |  5 +++
>  .../BaseFspWrapperApiLib/FspWrapperApiLib.c        | 36
> ++++++++++++++++++++++
>  7 files changed, 63 insertions(+), 40 deletions(-)
> 
> diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> index b0c6b2f8a6..d119f0b710 100644
> --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
> @@ -38,24 +38,6 @@
> 
>  extern EFI_GUID  gFspHobGuid;
> 
> -/**
> -  Get the FSP M UPD Data address
> -
> -  @return FSP-M UPD Data Address
> -**/
> -
> -UINTN
> -GetFspmUpdDataAddress (
> -  VOID
> -  )
> -{
> -  if (PcdGet64 (PcdFspmUpdDataAddress64) != 0) {
> -    return (UINTN) PcdGet64 (PcdFspmUpdDataAddress64);
> -  } else {
> -    return (UINTN) PcdGet32 (PcdFspmUpdDataAddress);
> -  }
> -}
> -
>  /**
>    Call FspMemoryInit API.
> 
> diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> index 5d0e021401..95317fb70d 100644
> --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> @@ -56,11 +56,9 @@
> 
>  [Pcd]
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress       ## CONSUMES
> -  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress    ##
> CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection      ## CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFsptBaseAddress       ## CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig  ##
> CONSUMES
> -  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress64  ##
> CONSUMES
> 
>  [Sources]
>    FspmWrapperPeim.c
> diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> index fadadd40e6..d34de97c1b 100644
> --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
> @@ -181,24 +181,6 @@ FspSiliconInitDoneGetFspHobList (
>    }
>  }
> 
> -/**
> -  Get the FSP S UPD Data address
> -
> -  @return FSP-S UPD Data Address
> -**/
> -
> -UINTN
> -GetFspsUpdDataAddress (
> -  VOID
> -  )
> -{
> -  if (PcdGet64 (PcdFspsUpdDataAddress64) != 0) {
> -    return (UINTN) PcdGet64 (PcdFspsUpdDataAddress64);
> -  } else {
> -    return (UINTN) PcdGet32 (PcdFspsUpdDataAddress);
> -  }
> -}
> -
>  /**
>    This function is for FSP dispatch mode to perform post FSP-S process.
> 
> diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> index da0049a654..50d33d0e0e 100644
> --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> @@ -65,10 +65,8 @@
> 
>  [Pcd]
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress       ## CONSUMES
> -  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress    ## CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection      ## CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig  ##
> CONSUMES
> -  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress64  ##
> CONSUMES
> 
>  [Guids]
>    gFspHobGuid                           ## CONSUMES ## HOB
> diff --git a/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
> b/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
> index d38582d3e5..4ae42ff180 100644
> --- a/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
> +++ b/IntelFsp2WrapperPkg/Include/Library/FspWrapperApiLib.h
> @@ -11,6 +11,28 @@
> 
>  #include <FspEas.h>
> 
> +/**
> +  Get the FSP M UPD Data address
> +
> +  @return FSP-M UPD Data Address
> +**/
> +UINTN
> +EFIAPI
> +GetFspmUpdDataAddress (
> +  VOID
> +  );
> +
> +/**
> +  Get the FSP S UPD Data address
> +
> +  @return FSP-S UPD Data Address
> +**/
> +UINTN
> +EFIAPI
> +GetFspsUpdDataAddress (
> +  VOID
> +  );
> +
>  /**
>    Find FSP header pointer.
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> index 1e348b539f..82496eb300 100644
> ---
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApi
> +++ Lib.inf
> @@ -63,3 +63,8 @@
>  [Pcd]
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress  ## CONSUMES
>    gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress  ## CONSUMES
> +  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress    ##
> CONSUMES
> +  gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress64  ##
> CONSUMES
> +  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress    ## CONSUMES
> +  gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress64  ##
> CONSUMES
> +
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
> index 67faad927c..2d24c988b9 100644
> --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
> +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.
> +++ c
> @@ -12,6 +12,42 @@
>  #include <Library/BaseLib.h>
>  #include <Library/BaseMemoryLib.h>
> 
> +/**
> +  Get the FSP M UPD Data address
> +
> +  @return FSP-M UPD Data Address
> +**/
> +UINTN
> +EFIAPI
> +GetFspmUpdDataAddress (
> +  VOID
> +  )
> +{
> +  if (PcdGet64 (PcdFspmUpdDataAddress64) != 0) {
> +    return (UINTN) PcdGet64 (PcdFspmUpdDataAddress64);
> +  } else {
> +    return (UINTN) PcdGet32 (PcdFspmUpdDataAddress);
> +  }
> +}
> +
> +/**
> +  Get the FSP S UPD Data address
> +
> +  @return FSP-S UPD Data Address
> +**/
> +UINTN
> +EFIAPI
> +GetFspsUpdDataAddress (
> +  VOID
> +  )
> +{
> +  if (PcdGet64 (PcdFspsUpdDataAddress64) != 0) {
> +    return (UINTN) PcdGet64 (PcdFspsUpdDataAddress64);
> +  } else {
> +    return (UINTN) PcdGet32 (PcdFspsUpdDataAddress);
> +  }
> +}
> +
>  /**
>    Wrapper for a thunk  to transition from long mode to compatibility mode to
> execute 32-bit code and then transit back to
>    long mode.
> --
> 2.16.2.windows.1
> 
> 
> 
> 
> 



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