diff options
author | Du Lin <du.lin@intel.com> | 2024-12-20 23:49:19 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-25 02:56:26 +0000 |
commit | da6504e5ccaa233b0ec051762809905f20ca5859 (patch) | |
tree | 477db67f822959c59b6d37574a1a15ab537a7625 | |
parent | 1cc78814cd8812c459115749409882b7243e5581 (diff) | |
download | edk2-da6504e5ccaa233b0ec051762809905f20ca5859.tar.gz |
IntelFsp2WrapperPkg: Save FspHobListPtr right after FspMemoryInit exits
Save FspHobList pointer to HOB right after FspMemoryInit exits so that
FspHobList pointer is available when performing platform related reset
in CallFspWrapperResetSystem(). Some platforms may consume FSP HOBs
prior to performing platform related reset.
Signed-off-by: Du Lin <du.lin@intel.com>
3 files changed, 42 insertions, 11 deletions
diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index d9fbb21417..d880614076 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -125,6 +125,17 @@ PeiFspMemoryInit ( Status = CallFspMemoryInit (FspmUpdDataPtr, &FspHobListPtr);
//
+ // FspHobList is not complete at this moment.
+ // Save FspHobList pointer to hob, so that it can be got later
+ //
+ HobData = BuildGuidHob (
+ &gFspHobGuid,
+ sizeof (VOID *)
+ );
+ ASSERT (HobData != NULL);
+ CopyMem (HobData, &FspHobListPtr, sizeof (FspHobListPtr));
+
+ //
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
//
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
@@ -167,17 +178,6 @@ PeiFspMemoryInit ( PostFspmHobProcess (FspHobListPtr);
- //
- // FspHobList is not complete at this moment.
- // Save FspHobList pointer to hob, so that it can be got later
- //
- HobData = BuildGuidHob (
- &gFspHobGuid,
- sizeof (VOID *)
- );
- ASSERT (HobData != NULL);
- CopyMem (HobData, &FspHobListPtr, sizeof (FspHobListPtr));
-
return Status;
}
diff --git a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf index e76a7465f2..16ad341406 100644 --- a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf +++ b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/FspWrapperMultiPhaseProcessLib.inf @@ -38,11 +38,16 @@ FspWrapperPlatformLib
PeiServicesLib
FspWrapperPlatformMultiPhaseLib
+ BaseMemoryLib
+ HobLib
[Ppis]
gEfiPeiReadOnlyVariable2PpiGuid
gEdkiiPeiVariablePpiGuid
+[Guids]
+ gFspHobGuid ## CONSUMES
+
[Pcd]
gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES
gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES
diff --git a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c index 224c24881d..68331c701d 100644 --- a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c +++ b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c @@ -17,6 +17,8 @@ #include <Ppi/Variable.h>
#include <Library/PeiServicesLib.h>
#include <Library/FspWrapperPlatformMultiPhaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/HobLib.h>
/**
Execute 32-bit FSP API entry code.
@@ -156,6 +158,8 @@ FspWrapperVariableRequestHandler ( EDKII_PEI_VARIABLE_PPI *VariablePpi;
BOOLEAN WriteVariableSupport;
FSP_MULTI_PHASE_COMPLETE_VARIABLE_REQUEST_PARAMS CompleteVariableRequestParams;
+ VOID *GuidHob;
+ VOID *HobData;
WriteVariableSupport = TRUE;
Status = PeiServicesLocatePpi (
@@ -289,6 +293,16 @@ FspWrapperVariableRequestHandler ( }
//
+ // Refresh FspHobList pointer stored in HOB.
+ //
+ GuidHob = GetFirstGuidHob (&gFspHobGuid);
+ ASSERT (GuidHob != NULL);
+ if (GuidHob != NULL) {
+ HobData = GET_GUID_HOB_DATA (GuidHob);
+ CopyMem (HobData, FspHobListPtr, sizeof (*FspHobListPtr));
+ }
+
+ //
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
//
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
@@ -321,6 +335,8 @@ FspWrapperMultiPhaseHandler ( FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS FspMultiPhaseGetNumber;
UINT32 Index;
UINT32 NumOfPhases;
+ VOID *GuidHob;
+ VOID *HobData;
//
// Query FSP for the number of phases supported.
@@ -352,6 +368,16 @@ FspWrapperMultiPhaseHandler ( FspMultiPhaseParams.MultiPhaseParamPtr = NULL;
Status = CallFspMultiPhaseEntry (&FspMultiPhaseParams, FspHobListPtr, ComponentIndex);
+ //
+ // Refresh FspHobList pointer stored in HOB.
+ //
+ GuidHob = GetFirstGuidHob (&gFspHobGuid);
+ ASSERT (GuidHob != NULL);
+ if (GuidHob != NULL) {
+ HobData = GET_GUID_HOB_DATA (GuidHob);
+ CopyMem (HobData, FspHobListPtr, sizeof (*FspHobListPtr));
+ }
+
if (Status == FSP_STATUS_VARIABLE_REQUEST) {
//
// call to Variable request handler
|