diff options
Diffstat (limited to 'Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp')
2 files changed, 70 insertions, 10 deletions
diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiFspPolicyInitLib.c b/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiFspPolicyInitLib.c index d15e3f9083..4e82a0cc31 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiFspPolicyInitLib.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiFspPolicyInitLib.c @@ -13,7 +13,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include <PeiFspPolicyInitLib.h>
-
+#include <Library/FspWrapperApiLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
/**
Performs silicon pre-mem policy initialization.
@@ -43,9 +45,35 @@ SiliconPolicyInitPreMem ( {
FSPM_UPD *FspmUpdDataPtr;
EFI_STATUS Status;
-
- FspmUpdDataPtr = FspmUpd;
-
+ UINTN *SourceData;
+ FSP_INFO_HEADER *FspmHeaderPtr;
+
+ if (FspmUpd == NULL) {
+ //
+ // Allocate and initialize UPD buffer, copy default FSP-M UPD data
+ //
+ FspmHeaderPtr = (FSP_INFO_HEADER *) FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
+ ASSERT (FspmHeaderPtr != NULL);
+ if (FspmHeaderPtr != NULL) {
+ DEBUG ((DEBUG_INFO, "FspmHeaderPtr - 0x%x\n", FspmHeaderPtr));
+ FspmUpdDataPtr = (FSPM_UPD *) AllocateZeroPool ((UINTN) FspmHeaderPtr->CfgRegionSize);
+ ASSERT (FspmUpdDataPtr != NULL);
+ if (FspmUpdDataPtr != NULL) {
+ SourceData = (UINTN *) ((UINTN) FspmHeaderPtr->ImageBase + (UINTN) FspmHeaderPtr->CfgRegionOffset);
+ CopyMem (FspmUpdDataPtr, SourceData, (UINTN) FspmHeaderPtr->CfgRegionSize);
+ PcdSet32S (PcdFspmUpdDataAddress, (UINT32) FspmUpdDataPtr);
+ }
+ }
+ } else {
+ FspmUpdDataPtr = FspmUpd;
+ }
+ //
+ // Return NULL pointer as error occurried and do not continue rest of the steps.
+ //
+ if (FspmUpdDataPtr == NULL) {
+ return NULL;
+ }
+ DEBUG ((DEBUG_INFO, "FspmUpdDataPtr - 0x%x\n", FspmUpdDataPtr));
//
// Initialize Intel PEI Platform Policy
//
@@ -97,7 +125,7 @@ SiliconPolicyInitPreMem ( //
Status = PeiFspMiscUpdInitPreMem (FspmUpdDataPtr);
- return FspmUpd;
+ return FspmUpdDataPtr;
}
/*
@@ -148,9 +176,35 @@ SiliconPolicyInitPostMem ( {
FSPS_UPD *FspsUpdDataPtr;
EFI_STATUS Status;
-
- FspsUpdDataPtr = FspsUpd;
-
+ FSP_INFO_HEADER *FspsHeaderPtr;
+ UINTN *SourceData;
+
+ if (FspsUpd == NULL) {
+ //
+ // Allocate and initialize UPD buffer, copy default FSP-S UPD data
+ //
+ FspsHeaderPtr = (FSP_INFO_HEADER *) FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress));
+ ASSERT (FspsHeaderPtr != NULL);
+ if (FspsHeaderPtr != NULL) {
+ DEBUG ((DEBUG_INFO, "FspsHeaderPtr - 0x%x\n", FspsHeaderPtr));
+ FspsUpdDataPtr = (FSPS_UPD *) AllocateZeroPool ((UINTN) FspsHeaderPtr->CfgRegionSize);
+ ASSERT (FspsUpdDataPtr != NULL);
+ if (FspsUpdDataPtr != NULL) {
+ SourceData = (UINTN *) ((UINTN) FspsHeaderPtr->ImageBase + (UINTN) FspsHeaderPtr->CfgRegionOffset);
+ CopyMem (FspsUpdDataPtr, SourceData, (UINTN) FspsHeaderPtr->CfgRegionSize);
+ PcdSet32S (PcdFspsUpdDataAddress, (UINT32) FspsUpdDataPtr);
+ }
+ }
+ } else {
+ FspsUpdDataPtr = FspsUpd;
+ }
+ //
+ // Return NULL pointer as error occurried and do not continue rest of the steps.
+ //
+ if (FspsUpdDataPtr == NULL) {
+ return NULL;
+ }
+ DEBUG ((DEBUG_INFO, "FspsUpdDataPtr - 0x%x\n", FspsUpdDataPtr));
//
// Initialize Intel PEI Platform Policy
//
@@ -189,7 +243,7 @@ SiliconPolicyInitPostMem ( DEBUG ((DEBUG_WARN, "ERROR - CPU Pei Fsp Policy Initialization fail, Status = %r\n", Status));
}
- return FspsUpd;
+ return FspsUpdDataPtr;
}
/*
diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiSiliconPolicyInitLibFsp.inf b/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiSiliconPolicyInitLibFsp.inf index 7b91ac3fab..7f0d7a5dec 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiSiliconPolicyInitLibFsp.inf +++ b/Silicon/Intel/KabylakeSiliconPkg/Library/PeiSiliconPolicyInitLibFsp/PeiSiliconPolicyInitLibFsp.inf @@ -62,6 +62,7 @@ MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
IntelFsp2Pkg/IntelFsp2Pkg.dec
+ IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec
KabylakeSiliconPkg/SiPkg.dec
KabylakeFspBinPkg/KabylakeFspBinPkg.dec
@@ -76,6 +77,7 @@ ConfigBlockLib
MemoryAllocationLib
DebugPrintErrorLevelLib
+ FspWrapperApiLib
[Pcd]
gSiPkgTokenSpaceGuid.PcdTsegSize ## CONSUMES
@@ -84,7 +86,11 @@ gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamSize ## CONSUMES
gIntelFsp2PkgTokenSpaceGuid.PcdFspTemporaryRamSize ## CONSUMES
gIntelFsp2PkgTokenSpaceGuid.PcdFspReservedBufferSize ## CONSUMES
-
+ gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress ## CONSUMES
+ gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES
+ gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress ## CONSUMES
+ gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES
+
[Ppis]
gSiPolicyPpiGuid ## CONSUMES
gSiPreMemPolicyPpiGuid ## CONSUMES
|