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

Kuo, Ted ted.kuo at intel.com
Fri Feb 4 09:38:46 UTC 2022


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 at 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/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list