summaryrefslogtreecommitdiffstats
path: root/IntelFsp2WrapperPkg/Library
diff options
context:
space:
mode:
authorHongbin1 Zhang <hongbin1.zhang@intel.com>2024-10-07 21:15:08 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-20 06:29:58 +0000
commitdf1726a65ef2f7f9793bbad4d18596ac7dbf0749 (patch)
treeff276b2ae0f3eb149e914e7e38ea69fc0a0ecb6d /IntelFsp2WrapperPkg/Library
parent4ffa8810af6494eacab0898bfcd4cf0d8b49ad5c (diff)
downloadedk2-df1726a65ef2f7f9793bbad4d18596ac7dbf0749.tar.gz
IntelFsp2WrapperPkg/FspiWrapperPeim : Support API mode
Add fspsmm init interface for API mode. Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com> Cc: Chen Gang C <gang.c.chen@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Ted Kuo <ted.kuo@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Cc: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'IntelFsp2WrapperPkg/Library')
-rw-r--r--IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf1
-rw-r--r--IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c36
-rw-r--r--IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c16
-rw-r--r--IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c14
-rw-r--r--IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c16
-rw-r--r--IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c16
6 files changed, 99 insertions, 0 deletions
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
index 1e348b539f..14760df001 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
@@ -63,3 +63,4 @@
[Pcd]
gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES
gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES
+ gIntelFsp2WrapperTokenSpaceGuid.PcdFspiBaseAddress ## CONSUMES
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
index 2e82a0c1b5..4d4cc8b5be 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c
@@ -230,3 +230,39 @@ CallFspSiliconInit (
return Status;
}
+
+/**
+ Call FSP API - FspSmmInit.
+
+ @param[in] FspiUpdDataPtr Address pointer to the Smm Init parameters structure.
+
+ @return EFI status returned by FspSmmInit API.
+**/
+EFI_STATUS
+EFIAPI
+CallFspSmmInit (
+ IN VOID *FspiUpdDataPtr
+ )
+{
+ FSP_INFO_HEADER *FspHeader;
+ FSP_SMM_INIT FspSmmInitApi;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
+
+ FspHeader = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspiBaseAddress));
+ if (FspHeader == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ FspSmmInitApi = (FSP_SMM_INIT)((UINTN)FspHeader->ImageBase + FspHeader->FspSmmInitEntryOffset);
+ InterruptState = SaveAndDisableInterrupts ();
+ if ((FspHeader->ImageAttribute & IMAGE_ATTRIBUTE_64BIT_MODE_SUPPORT) == FSP_IA32) {
+ Status = Execute32BitCode ((UINTN)FspSmmInitApi, (UINTN)FspiUpdDataPtr, (UINTN)NULL);
+ } else {
+ Status = Execute64BitCode ((UINTN)FspSmmInitApi, (UINTN)FspiUpdDataPtr, (UINTN)NULL);
+ }
+
+ SetInterruptState (InterruptState);
+
+ return Status;
+}
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c
index 4ac5d3d738..beaf56bd09 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c
@@ -57,3 +57,19 @@ TestFspSiliconInitApiOutput (
{
return RETURN_UNSUPPORTED;
}
+
+/**
+ Test the output of FSP API - FspSmmInit.
+
+ @param[in] FspiUpdDataPtr Address pointer to the Smm Init parameters structure.
+
+ @return test result on output of FspSmmInit API.
+**/
+EFI_STATUS
+EFIAPI
+TestFspSmmInitApiOutput (
+ IN VOID *FspiUpdDataPtr
+ )
+{
+ return RETURN_SUCCESS;
+}
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c
index 00b4799fb4..6e0e8942ef 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c
@@ -95,3 +95,17 @@ CallFspWrapperResetSystem (
CpuDeadLoop ();
}
+
+/**
+ This function overrides the default configurations in the FSP-I UPD data region.
+
+ @param[in,out] FspUpdRgnPtr A pointer to the UPD data region data structure.
+
+**/
+VOID
+EFIAPI
+UpdateFspiUpdData (
+ IN OUT VOID *FspUpdRgnPtr
+ )
+{
+}
diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c b/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c
index 0b48677b77..24722ea287 100644
--- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c
+++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c
@@ -83,3 +83,19 @@ TestFspSiliconInitApiOutput (
{
return RETURN_SUCCESS;
}
+
+/**
+ Test the output of FSP API - FspSmmInit.
+
+ @param[in] FspiUpdDataPtr Address pointer to the Smm Init parameters structure.
+
+ @return test result on output of FspSmmInit API.
+**/
+EFI_STATUS
+EFIAPI
+TestFspSmmInitApiOutput (
+ IN VOID *FspiUpdDataPtr
+ )
+{
+ return RETURN_SUCCESS;
+}
diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c
index 84360ac6e3..c11df5894c 100644
--- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c
+++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c
@@ -400,3 +400,19 @@ PostFspsHobProcess (
return EFI_SUCCESS;
}
+
+/**
+ Post FSP-I HOB process.
+
+ @param[in] FspHobList Pointer to the HOB data structure produced by FSP.
+
+ @return If platform process the FSP hob list successfully.
+**/
+EFI_STATUS
+EFIAPI
+PostFspiHobProcess (
+ IN VOID *FspHobList
+ )
+{
+ return EFI_SUCCESS;
+}