summaryrefslogtreecommitdiff
path: root/IntelFspWrapperPkg
diff options
context:
space:
mode:
authorYao, Jiewen <jiewen.yao@intel.com>2015-02-11 04:41:46 +0000
committerjyao1 <jyao1@Edk2>2015-02-11 04:41:46 +0000
commitd8043ce905a5832f911361ef30be28765afbdc6b (patch)
tree4b4f7171c97efc733c95cc3abf65af351017c955 /IntelFspWrapperPkg
parentd5fb1edfb16a2af29486ffbf5aa32a036da9caa4 (diff)
downloadedk2-platforms-d8043ce905a5832f911361ef30be28765afbdc6b.tar.xz
Update IntelFspWrapperPkg according to FSP1.1.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16826 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFspWrapperPkg')
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspInitPei.c168
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspInitPei.h14
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspInitPei.inf16
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c181
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c331
-rw-r--r--IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c24
-rw-r--r--IntelFspWrapperPkg/FspInitPei/SecFspInitDone.c57
-rw-r--r--IntelFspWrapperPkg/FspInitPei/SecMain.c43
-rw-r--r--IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c17
-rw-r--r--IntelFspWrapperPkg/Include/Library/FspApiLib.h55
-rw-r--r--IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h26
-rw-r--r--IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h26
-rw-r--r--IntelFspWrapperPkg/IntelFspWrapperPkg.dec16
-rw-r--r--IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf1
-rw-r--r--IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c118
-rw-r--r--IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c12
-rw-r--r--IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c6
-rw-r--r--IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c32
-rw-r--r--IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c48
19 files changed, 922 insertions, 269 deletions
diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.c b/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
index 823f1bbef8..17a646836a 100644
--- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
+++ b/IntelFspWrapperPkg/FspInitPei/FspInitPei.c
@@ -1,9 +1,7 @@
/** @file
- This PEIM will be invoked twice by pei core. In 1st entry, it will call FspInit API.
- In 2nd entry, it will parse the hoblist from fsp and report them into pei core.
- This file contains the main entrypoint of the PEIM.
+ This PEIM initialize FSP.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -18,111 +16,6 @@
#include "FspInitPei.h"
/**
- FSP Init continuation function.
- Control will be returned to this callback function after FspInit API call.
-
- @param[in] Status Status of the FSP INIT API
- @param[in] HobListPtr Pointer to the HOB data structure defined in the PI specification.
-
-**/
-VOID
-ContinuationFunc (
- IN FSP_STATUS Status,
- IN VOID *HobListPtr
- )
-{
- EFI_BOOT_MODE BootMode;
- UINT64 StackSize;
- EFI_PHYSICAL_ADDRESS StackBase;
-
- DEBUG ((DEBUG_INFO, "ContinuationFunc - %r\n", Status));
- DEBUG ((DEBUG_INFO, "HobListPtr - 0x%x\n", HobListPtr));
-
- if (Status != FSP_SUCCESS) {
- CpuDeadLoop ();
- }
-
- //
- // Can not call any PeiServices
- //
- BootMode = GetBootMode ();
-
- GetStackInfo (BootMode, TRUE, &StackBase, &StackSize);
- DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
- DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
- CallPeiCoreEntryPoint (
- HobListPtr,
- (VOID *)(UINTN)StackBase,
- (VOID *)(UINTN)(StackBase + StackSize)
- );
-}
-
-/**
- Call FspInit API.
-
- @param[in] FspHeader FSP header pointer.
-**/
-VOID
-SecFspInit (
- IN FSP_INFO_HEADER *FspHeader
- )
-{
- FSP_INIT_PARAMS FspInitParams;
- FSP_INIT_RT_COMMON_BUFFER FspRtBuffer;
- UINT8 FspUpdRgn[FixedPcdGet32 (PcdMaxUpdRegionSize)];
- UINT32 UpdRegionSize;
- EFI_BOOT_MODE BootMode;
- UINT64 StackSize;
- EFI_PHYSICAL_ADDRESS StackBase;
- FSP_STATUS FspStatus;
-
- DEBUG ((DEBUG_INFO, "SecFspInit enter\n"));
-
- PeiServicesGetBootMode (&BootMode);
- DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode));
-
- GetStackInfo (BootMode, FALSE, &StackBase, &StackSize);
- DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
- DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
-
- ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer));
- FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize);
-
- FspRtBuffer.BootMode = BootMode;
-
- /* Platform override any UPD configs */
- UpdRegionSize = GetUpdRegionSize();
- DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n", UpdRegionSize));
- DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n", sizeof(FspUpdRgn)));
- ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize);
- ZeroMem (FspUpdRgn, UpdRegionSize);
- FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn);
-
- ZeroMem (&FspInitParams, sizeof(FspInitParams));
- FspInitParams.NvsBufferPtr = GetNvsBuffer ();
- DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr));
- FspInitParams.RtBufferPtr = (VOID *)&FspRtBuffer;
- FspInitParams.ContinuationFunc = (CONTINUATION_PROC)ContinuationFunc;
-
- SaveSecContext (GetPeiServicesTablePointer ());
-
- DEBUG ((DEBUG_INFO, "FspInitParams - 0x%x\n", &FspInitParams));
- DEBUG ((DEBUG_INFO, " NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr));
- DEBUG ((DEBUG_INFO, " RtBufferPtr - 0x%x\n", FspInitParams.RtBufferPtr));
- DEBUG ((DEBUG_INFO, " StackTop - 0x%x\n", FspRtBuffer.StackTop));
- DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", FspRtBuffer.BootMode));
- DEBUG ((DEBUG_INFO, " UpdDataRgnPtr - 0x%x\n", FspRtBuffer.UpdDataRgnPtr));
- DEBUG ((DEBUG_INFO, " ContinuationFunc - 0x%x\n", FspInitParams.ContinuationFunc));
-
- FspStatus = CallFspInit (FspHeader, &FspInitParams);
- //
- // Should never return
- //
- DEBUG((DEBUG_ERROR, "FSP Init failed, status: 0x%x\n", FspStatus));
- CpuDeadLoop ();
-}
-
-/**
This is the entrypoint of PEIM
@param[in] FileHandle Handle of the file being invoked.
@@ -138,50 +31,31 @@ FspPeiEntryPoint (
)
{
FSP_INFO_HEADER *FspHeader;
- EFI_STATUS Status;
- FSP_INIT_DONE_PPI *FspInitDone;
- VOID *FspHobList;
- EFI_BOOT_MODE BootMode;
+ UINT8 PcdFspApiVersion;
DEBUG ((DEBUG_INFO, "FspPeiEntryPoint\n"));
+ PcdFspApiVersion = 1;
- Status = PeiServicesLocatePpi (
- &gFspInitDonePpiGuid,
- 0,
- NULL,
- (VOID **) &FspInitDone
- );
- if (EFI_ERROR (Status)) {
- //
- // 1st entry
- //
- DEBUG ((DEBUG_INFO, "1st entry\n"));
- FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
- DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));
- if (FspHeader == NULL) {
- return EFI_DEVICE_ERROR;
- }
+ FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
+ DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));
+ if (FspHeader == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
- SecFspInit (FspHeader);
+ if ((PcdGet8 (PcdFspApiVersion) >= 2) &&
+ (FspHeader->HeaderRevision >= FSP_HEADER_REVISION_2) &&
+ (FspHeader->ApiEntryNum >= 6) &&
+ (FspHeader->FspMemoryInitEntryOffset != 0) &&
+ (FspHeader->TempRamExitEntryOffset != 0) &&
+ (FspHeader->FspSiliconInitEntryOffset != 0) ) {
+ PcdFspApiVersion = FSP_HEADER_REVISION_2;
+ }
+ DEBUG ((DEBUG_INFO, "PcdFspApiVersion - 0x%x\n", PcdFspApiVersion));
- //
- // Never return here
- //
- CpuDeadLoop ();
+ if (PcdFspApiVersion == FSP_HEADER_REVISION_1) {
+ PeiFspInitV1 (FspHeader);
} else {
- //
- // 2nd entry
- //
- DEBUG ((DEBUG_INFO, "2nd entry\n"));
- Status = FspInitDone->GetFspHobList (PeiServices, FspInitDone, &FspHobList);
- DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
- FspHobProcess (FspHobList);
-
- PeiServicesGetBootMode (&BootMode);
- if (BootMode == BOOT_ON_S3_RESUME) {
- Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
- ASSERT_EFI_ERROR (Status);
- }
+ PeiFspInitV2 (FspHeader);
}
return EFI_SUCCESS;
diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.h b/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
index 5118cd04e3..fd4b707684 100644
--- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
+++ b/IntelFspWrapperPkg/FspInitPei/FspInitPei.h
@@ -1,7 +1,7 @@
/** @file
This is PEIM header file.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -32,7 +32,19 @@
#include <Ppi/FspInitDone.h>
#include <Ppi/EndOfPeiPhase.h>
+#include <Ppi/MemoryDiscovered.h>
+#include <Ppi/TemporaryRamDone.h>
extern EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc;
+EFI_STATUS
+PeiFspInitV1 (
+ IN FSP_INFO_HEADER *FspHeader
+ );
+
+EFI_STATUS
+PeiFspInitV2 (
+ IN FSP_INFO_HEADER *FspHeader
+ );
+
#endif
diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf b/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
index 500c9fd238..97e88138bd 100644
--- a/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
+++ b/IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
@@ -1,9 +1,13 @@
## @file
# FSP PEI Module
#
-# This PEIM will be invoked twice by pei core. In 1st entry, it will call FspInit API.
-# In 2nd entry, it will parse the hoblist from fsp and report them into pei core.
-# including install the memory as required.
+# This PEIM initialize FSP.
+# In FSP API V1 mode, it will be invoked twice by pei core. In 1st entry, it will
+# call FspInit API. In 2nd entry, it will parse the hoblist from fsp and report
+# them into pei core.
+# In FSP API V2 mode, it will be invoked only once. It will call FspMemoryInit API,
+# register TemporaryRamDonePpi to call TempRamExit API, and register MemoryDiscoveredPpi
+# notify to call FspSiliconInit API.
#
# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
#
@@ -33,11 +37,12 @@
[Sources]
FspInitPei.c
FspInitPei.h
+ FspInitPeiV1.c
+ FspInitPeiV2.c
FspNotifyS3.c
SecMain.c
SecMain.h
FindPeiCore.c
- SecFspInitDone.c
[Packages]
MdePkg/MdePkg.dec
@@ -67,6 +72,8 @@
gTopOfTemporaryRamPpiGuid ## PRODUCES
gFspInitDonePpiGuid ## PRODUCES
gEfiEndOfPeiSignalPpiGuid ## PRODUCES
+ gEfiTemporaryRamDonePpiGuid ## PRODUCES
+ gEfiPeiMemoryDiscoveredPpiGuid ## PRODUCES
[FixedPcd]
gFspWrapperTokenSpaceGuid.PcdSecCoreMaxPpiSupported ## CONSUMES
@@ -76,6 +83,7 @@
gFspWrapperTokenSpaceGuid.PcdFlashFvFspBase ## CONSUMES
gFspWrapperTokenSpaceGuid.PcdFlashFvFspSize ## CONSUMES
gFspWrapperTokenSpaceGuid.PcdMaxUpdRegionSize ## CONSUMES
+ gFspWrapperTokenSpaceGuid.PcdFspApiVersion ## CONSUMES
[Depex]
gEfiPeiMasterBootModePpiGuid
diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c
new file mode 100644
index 0000000000..f6ffecb2ca
--- /dev/null
+++ b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV1.c
@@ -0,0 +1,181 @@
+/** @file
+ In FSP API V1 mode, it will be invoked twice by pei core. In 1st entry, it will
+ call FspInit API. In 2nd entry, it will parse the hoblist from fsp and report
+ them into pei core.
+
+ Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#include "FspInitPei.h"
+
+/**
+ FSP Init continuation function.
+ Control will be returned to this callback function after FspInit API call.
+
+ @param[in] Status Status of the FSP INIT API
+ @param[in] HobListPtr Pointer to the HOB data structure defined in the PI specification.
+
+**/
+VOID
+ContinuationFunc (
+ IN EFI_STATUS Status,
+ IN VOID *HobListPtr
+ )
+{
+ EFI_BOOT_MODE BootMode;
+ UINT64 StackSize;
+ EFI_PHYSICAL_ADDRESS StackBase;
+
+ DEBUG ((DEBUG_INFO, "ContinuationFunc - %r\n", Status));
+ DEBUG ((DEBUG_INFO, "HobListPtr - 0x%x\n", HobListPtr));
+
+ if (Status != EFI_SUCCESS) {
+ CpuDeadLoop ();
+ }
+
+ //
+ // Can not call any PeiServices
+ //
+ BootMode = GetBootMode ();
+
+ GetStackInfo (BootMode, TRUE, &StackBase, &StackSize);
+ DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
+ DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
+ CallPeiCoreEntryPoint (
+ HobListPtr,
+ (VOID *)(UINTN)StackBase,
+ (VOID *)(UINTN)(StackBase + StackSize)
+ );
+}
+
+/**
+ Call FspInit API.
+
+ @param[in] FspHeader FSP header pointer.
+**/
+VOID
+PeiFspInit (
+ IN FSP_INFO_HEADER *FspHeader
+ )
+{
+ FSP_INIT_PARAMS FspInitParams;
+ FSP_INIT_RT_COMMON_BUFFER FspRtBuffer;
+ UINT8 FspUpdRgn[FixedPcdGet32 (PcdMaxUpdRegionSize)];
+ UINT32 UpdRegionSize;
+ EFI_BOOT_MODE BootMode;
+ UINT64 StackSize;
+ EFI_PHYSICAL_ADDRESS StackBase;
+ EFI_STATUS Status;
+
+ DEBUG ((DEBUG_INFO, "PeiFspInit enter\n"));
+
+ PeiServicesGetBootMode (&BootMode);
+ DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode));
+
+ GetStackInfo (BootMode, FALSE, &StackBase, &StackSize);
+ DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
+ DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
+
+ ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer));
+ FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize);
+
+ FspRtBuffer.BootMode = BootMode;
+
+ /* Platform override any UPD configs */
+ UpdRegionSize = GetUpdRegionSize();
+ DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n", UpdRegionSize));
+ DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n", sizeof(FspUpdRgn)));
+ ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize);
+ ZeroMem (FspUpdRgn, UpdRegionSize);
+ FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn);
+
+ ZeroMem (&FspInitParams, sizeof(FspInitParams));
+ FspInitParams.NvsBufferPtr = GetNvsBuffer ();
+ DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr));
+ FspInitParams.RtBufferPtr = (VOID *)&FspRtBuffer;
+ FspInitParams.ContinuationFunc = (CONTINUATION_PROC)ContinuationFunc;
+
+ SaveSecContext (GetPeiServicesTablePointer ());
+
+ DEBUG ((DEBUG_INFO, "FspInitParams - 0x%x\n", &FspInitParams));
+ DEBUG ((DEBUG_INFO, " NvsBufferPtr - 0x%x\n", FspInitParams.NvsBufferPtr));
+ DEBUG ((DEBUG_INFO, " RtBufferPtr - 0x%x\n", FspInitParams.RtBufferPtr));
+ DEBUG ((DEBUG_INFO, " StackTop - 0x%x\n", FspRtBuffer.StackTop));
+ DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", FspRtBuffer.BootMode));
+ DEBUG ((DEBUG_INFO, " UpdDataRgnPtr - 0x%x\n", FspRtBuffer.UpdDataRgnPtr));
+ DEBUG ((DEBUG_INFO, " ContinuationFunc - 0x%x\n", FspInitParams.ContinuationFunc));
+
+ Status = CallFspInit (FspHeader, &FspInitParams);
+ //
+ // Should never return
+ //
+ DEBUG((DEBUG_ERROR, "FSP Init failed, status: 0x%x\n", Status));
+ CpuDeadLoop ();
+}
+
+/**
+ Do FSP initialization based on FspApi version 1.
+
+ @param[in] FspHeader FSP header pointer.
+
+ @return FSP initialization status.
+**/
+EFI_STATUS
+PeiFspInitV1 (
+ IN FSP_INFO_HEADER *FspHeader
+ )
+{
+ EFI_STATUS Status;
+ FSP_INIT_DONE_PPI *FspInitDone;
+ VOID *FspHobList;
+ EFI_BOOT_MODE BootMode;
+
+ Status = PeiServicesLocatePpi (
+ &gFspInitDonePpiGuid,
+ 0,
+ NULL,
+ (VOID **) &FspInitDone
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // 1st entry
+ //
+ DEBUG ((DEBUG_INFO, "1st entry\n"));
+
+ PeiFspInit (FspHeader);
+ //
+ // Never return here, for FspApi version 1.
+ //
+ CpuDeadLoop ();
+ } else {
+ //
+ // 2nd entry for FspApi version 1 only.
+ //
+ DEBUG ((DEBUG_INFO, "2nd entry\n"));
+
+ Status = FspInitDone->GetFspHobList (GetPeiServicesTablePointer (), FspInitDone, &FspHobList);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
+ FspHobProcess (FspHobList);
+
+ //
+ // Register EndOfPei Notify for S3 to run FspNotifyPhase
+ //
+ PeiServicesGetBootMode (&BootMode);
+ if (BootMode == BOOT_ON_S3_RESUME) {
+ Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c
new file mode 100644
index 0000000000..6ddbf7f1b3
--- /dev/null
+++ b/IntelFspWrapperPkg/FspInitPei/FspInitPeiV2.c
@@ -0,0 +1,331 @@
+/** @file
+ In FSP API V2 mode, it will be invoked only once. It will call FspMemoryInit API,
+ register TemporaryRamDonePpi to call TempRamExit API, and register MemoryDiscoveredPpi
+ notify to call FspSiliconInit API.
+
+ Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#include "FspInitPei.h"
+
+/**
+ Return Hob list produced by FSP.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of this PPI.
+ @param[out] FspHobList The pointer to Hob list produced by FSP.
+
+ @return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspInitDoneGetFspHobListV2 (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN FSP_INIT_DONE_PPI *This,
+ OUT VOID **FspHobList
+ );
+
+FSP_INIT_DONE_PPI mFspInitDonePpiV2 = {
+ FspInitDoneGetFspHobListV2
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPeiFspInitDonePpiV2 = {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gFspInitDonePpiGuid,
+ &mFspInitDonePpiV2
+};
+
+/**
+ This function is called after PEI core discover memory and finish migration.
+
+ @param[in] PeiServices Pointer to PEI Services Table.
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+PeiMemoryDiscoveredNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+EFI_PEI_NOTIFY_DESCRIPTOR mPeiMemoryDiscoveredNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ PeiMemoryDiscoveredNotify
+};
+
+/**
+ TemporaryRamDone() disables the use of Temporary RAM. If present, this service is invoked
+ by the PEI Foundation after the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is installed.
+
+ @retval EFI_SUCCESS Use of Temporary RAM was disabled.
+ @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiTemporaryRamDone (
+ VOID
+ );
+
+EFI_PEI_TEMPORARY_RAM_DONE_PPI mPeiTemporaryRamDonePpi = {
+ PeiTemporaryRamDone
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPeiTemporaryRamDoneDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiTemporaryRamDonePpiGuid,
+ &mPeiTemporaryRamDonePpi
+};
+
+/**
+ Return Hob list produced by FSP.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of this PPI.
+ @param[out] FspHobList The pointer to Hob list produced by FSP.
+
+ @return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspInitDoneGetFspHobListV2 (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN FSP_INIT_DONE_PPI *This,
+ OUT VOID **FspHobList
+ )
+{
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ GuidHob = GetFirstGuidHob (&gFspInitDonePpiGuid);
+ if (GuidHob != NULL) {
+ *FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
+ return EFI_SUCCESS;
+ } else {
+ return EFI_NOT_FOUND;
+ }
+}
+
+/**
+ Call FspMemoryInit API.
+
+ @param[in] FspHeader FSP header pointer.
+
+ @return Status returned by FspMemoryInit API.
+**/
+EFI_STATUS
+PeiFspMemoryInit (
+ IN FSP_INFO_HEADER *FspHeader
+ )
+{
+ FSP_MEMORY_INIT_PARAMS FspMemoryInitParams;
+ FSP_INIT_RT_COMMON_BUFFER FspRtBuffer;
+ UINT8 FspUpdRgn[FixedPcdGet32 (PcdMaxUpdRegionSize)];
+ UINT32 UpdRegionSize;
+ EFI_BOOT_MODE BootMode;
+ UINT64 StackSize;
+ EFI_PHYSICAL_ADDRESS StackBase;
+ EFI_STATUS Status;
+ VOID *FspHobList;
+ VOID *HobData;
+
+ DEBUG ((DEBUG_INFO, "PeiFspMemoryInit enter\n"));
+
+ PeiServicesGetBootMode (&BootMode);
+ DEBUG ((DEBUG_INFO, "BootMode - 0x%x\n", BootMode));
+
+ GetStackInfo (BootMode, FALSE, &StackBase, &StackSize);
+ DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", StackBase));
+ DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", StackSize));
+
+ ZeroMem (&FspRtBuffer, sizeof(FspRtBuffer));
+ FspRtBuffer.StackTop = (UINT32 *)(UINTN)(StackBase + StackSize);
+
+ FspRtBuffer.BootMode = BootMode;
+
+ /* Platform override any UPD configs */
+ UpdRegionSize = GetUpdRegionSize();
+ DEBUG ((DEBUG_INFO, "UpdRegionSize - 0x%x\n", UpdRegionSize));
+ DEBUG ((DEBUG_INFO, "sizeof(FspUpdRgn) - 0x%x\n", sizeof(FspUpdRgn)));
+ ASSERT(sizeof(FspUpdRgn) >= UpdRegionSize);
+ ZeroMem (FspUpdRgn, UpdRegionSize);
+ FspRtBuffer.UpdDataRgnPtr = UpdateFspUpdConfigs (FspUpdRgn);
+
+ ZeroMem (&FspMemoryInitParams, sizeof(FspMemoryInitParams));
+ FspMemoryInitParams.NvsBufferPtr = GetNvsBuffer ();
+ DEBUG ((DEBUG_INFO, "NvsBufferPtr - 0x%x\n", FspMemoryInitParams.NvsBufferPtr));
+ FspMemoryInitParams.RtBufferPtr = (VOID *)&FspRtBuffer;
+ FspMemoryInitParams.HobListPtr = &FspHobList;
+
+ DEBUG ((DEBUG_INFO, "FspMemoryInitParams - 0x%x\n", &FspMemoryInitParams));
+ DEBUG ((DEBUG_INFO, " NvsBufferPtr - 0x%x\n", FspMemoryInitParams.NvsBufferPtr));
+ DEBUG ((DEBUG_INFO, " RtBufferPtr - 0x%x\n", FspMemoryInitParams.RtBufferPtr));
+ DEBUG ((DEBUG_INFO, " StackTop - 0x%x\n", FspRtBuffer.StackTop));
+ DEBUG ((DEBUG_INFO, " BootMode - 0x%x\n", FspRtBuffer.BootMode));
+ DEBUG ((DEBUG_INFO, " UpdDataRgnPtr - 0x%x\n", FspRtBuffer.UpdDataRgnPtr));
+ DEBUG ((DEBUG_INFO, " HobListPtr - 0x%x\n", FspMemoryInitParams.HobListPtr));
+
+ Status = CallFspMemoryInit (FspHeader, &FspMemoryInitParams);
+ DEBUG((DEBUG_INFO, "FspMemoryInit status: 0x%x\n", Status));
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((DEBUG_INFO, " HobListPtr (returned) - 0x%x\n", FspHobList));
+
+ FspHobProcessForMemoryResource (FspHobList);
+
+ //
+ // FspHobList is not complete at this moment.
+ // Save FspHobList pointer to hob, so that it can be got later
+ //
+ HobData = BuildGuidHob (
+ &gFspInitDonePpiGuid,
+ sizeof (VOID *)
+ );
+ ASSERT (HobData != NULL);
+ CopyMem (HobData, &FspHobList, sizeof (FspHobList));
+
+ return Status;
+}
+
+/**
+ TemporaryRamDone() disables the use of Temporary RAM. If present, this service is invoked
+ by the PEI Foundation after the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is installed.
+
+ @retval EFI_SUCCESS Use of Temporary RAM was disabled.
+ @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiTemporaryRamDone (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ VOID *TempRamExitParam;
+ FSP_INFO_HEADER *FspHeader;
+
+ FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
+ if (FspHeader == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ DEBUG ((DEBUG_INFO, "PeiTemporaryRamDone enter\n"));
+
+ TempRamExitParam = GetTempRamExitParam ();
+ Status = CallTempRamExit (FspHeader, TempRamExitParam);
+ DEBUG((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called after PEI core discover memory and finish migration.
+
+ @param[in] PeiServices Pointer to PEI Services Table.
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+PeiMemoryDiscoveredNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ VOID *FspSiliconInitParam;
+ FSP_INFO_HEADER *FspHeader;
+ VOID *FspHobList;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
+ if (FspHeader == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ DEBUG ((DEBUG_INFO, "PeiMemoryDiscoveredNotify enter\n"));
+
+ FspSiliconInitParam = GetFspSiliconInitParam ();
+ Status = CallFspSiliconInit (FspHeader, FspSiliconInitParam);
+ DEBUG((DEBUG_ERROR, "FspSiliconInit status: 0x%x\n", Status));
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Now FspHobList complete, process it
+ //
+ GuidHob = GetFirstGuidHob (&gFspInitDonePpiGuid);
+ ASSERT (GuidHob != NULL);
+ FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
+ DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
+ FspHobProcessForOtherData (FspHobList);
+
+ //
+ // Install FspInitDonePpi so that any other driver can consume this info.
+ //
+ Status = PeiServicesInstallPpi (&mPeiFspInitDonePpiV2);
+ ASSERT_EFI_ERROR(Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Do FSP initialization based on FspApi version 2.
+
+ @param[in] FspHeader FSP header pointer.
+
+ @return FSP initialization status.
+**/
+EFI_STATUS
+PeiFspInitV2 (
+ IN FSP_INFO_HEADER *FspHeader
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+
+ Status = PeiFspMemoryInit (FspHeader);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Install TempramDonePpi to run TempRamExit
+ //
+ Status = PeiServicesInstallPpi (&mPeiTemporaryRamDoneDesc);
+ ASSERT_EFI_ERROR(Status);
+
+ //
+ // Register MemoryDiscovered Nofity to run FspSiliconInit
+ //
+ Status = PeiServicesNotifyPpi (&mPeiMemoryDiscoveredNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Register EndOfPei Notify for S3 to run FspNotifyPhase
+ //
+ PeiServicesGetBootMode (&BootMode);
+ if (BootMode == BOOT_ON_S3_RESUME) {
+ Status = PeiServicesNotifyPpi (&mS3EndOfPeiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c b/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
index 6fd2b77588..f784b014a6 100644
--- a/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
+++ b/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
@@ -1,7 +1,7 @@
/** @file
In EndOfPei notify, it will call FspNotifyPhase API.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -58,29 +58,23 @@ S3EndOfPeiNotify (
)
{
NOTIFY_PHASE_PARAMS NotifyPhaseParams;
- FSP_STATUS FspStatus;
+ EFI_STATUS Status;
FSP_INFO_HEADER *FspHeader;
FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
if (FspHeader == NULL) {
return EFI_DEVICE_ERROR;
}
-
+
+ DEBUG ((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
+
NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
- FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
- if (FspStatus != FSP_SUCCESS) {
- DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", FspStatus));
- } else {
- DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration Success.\n"));
- }
+ Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
+ DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
- FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
- if (FspStatus != FSP_SUCCESS) {
- DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase ReadyToBoot failed, status: 0x%x\n", FspStatus));
- } else {
- DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot Success.\n"));
- }
+ Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
+ DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));
return EFI_SUCCESS;
}
diff --git a/IntelFspWrapperPkg/FspInitPei/SecFspInitDone.c b/IntelFspWrapperPkg/FspInitPei/SecFspInitDone.c
deleted file mode 100644
index e109694062..0000000000
--- a/IntelFspWrapperPkg/FspInitPei/SecFspInitDone.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
- Install FspInitDone PPI and GetFspHobList API.
-
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include "SecMain.h"
-
-FSP_INIT_DONE_PPI gFspInitDonePpi = {
- FspInitDoneGetFspHobList
-};
-
-/**
- Return Hob list produced by FSP.
-
- @param[in] PeiServices The pointer to the PEI Services Table.
- @param[in] This The pointer to this instance of this PPI.
- @param[out] FspHobList The pointer to Hob list produced by FSP.
-
- @return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
-**/
-EFI_STATUS
-EFIAPI
-FspInitDoneGetFspHobList (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN FSP_INIT_DONE_PPI *This,
- OUT VOID **FspHobList
- )
-{
- VOID *TopOfTemporaryRamPpi;
- EFI_STATUS Status;
-
- Status = (*PeiServices)->LocatePpi (
- PeiServices,
- &gTopOfTemporaryRamPpiGuid,
- 0,
- NULL,
- (VOID **) &TopOfTemporaryRamPpi
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- *FspHobList = (VOID *)(UINTN)(*(UINT32 *)((UINTN)TopOfTemporaryRamPpi - sizeof(UINT32)));
-
- return EFI_SUCCESS;
-}
-
diff --git a/IntelFspWrapperPkg/FspInitPei/SecMain.c b/IntelFspWrapperPkg/FspInitPei/SecMain.c
index 10550e74de..4d0878a9df 100644
--- a/IntelFspWrapperPkg/FspInitPei/SecMain.c
+++ b/IntelFspWrapperPkg/FspInitPei/SecMain.c
@@ -1,7 +1,7 @@
/** @file
C functions in SEC
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -28,6 +28,10 @@ EFI_PEI_PPI_DESCRIPTOR mPeiSecMainPpi[] = {
},
};
+FSP_INIT_DONE_PPI gFspInitDonePpi = {
+ FspInitDoneGetFspHobList
+};
+
//
// These are IDT entries pointing to 10:FFFFFFE4h.
//
@@ -267,3 +271,40 @@ SecStartupPhase2(
//
return ;
}
+
+/**
+ Return Hob list produced by FSP.
+
+ @param[in] PeiServices The pointer to the PEI Services Table.
+ @param[in] This The pointer to this instance of this PPI.
+ @param[out] FspHobList The pointer to Hob list produced by FSP.
+
+ @return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspInitDoneGetFspHobList (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN FSP_INIT_DONE_PPI *This,
+ OUT VOID **FspHobList
+ )
+{
+ VOID *TopOfTemporaryRamPpi;
+ EFI_STATUS Status;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gTopOfTemporaryRamPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &TopOfTemporaryRamPpi
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_FOUND;
+ }
+
+ *FspHobList = (VOID *)(UINTN)(*(UINT32 *)((UINTN)TopOfTemporaryRamPpi - sizeof(UINT32)));
+
+ return EFI_SUCCESS;
+}
+
diff --git a/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c b/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c
index 7beedc458a..859b26728d 100644
--- a/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c
+++ b/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c
@@ -1,7 +1,7 @@
/** @file
This driver will register two callbacks to call fsp's notifies.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -40,7 +40,6 @@ OnPciEnumerationComplete (
{
NOTIFY_PHASE_PARAMS NotifyPhaseParams;
EFI_STATUS Status;
- FSP_STATUS FspStatus;
VOID *Interface;
//
@@ -57,9 +56,9 @@ OnPciEnumerationComplete (
}
NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
- FspStatus = CallFspNotifyPhase (mFspHeader, &NotifyPhaseParams);
- if (FspStatus != FSP_SUCCESS) {
- DEBUG((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", FspStatus));
+ Status = CallFspNotifyPhase (mFspHeader, &NotifyPhaseParams);
+ if (Status != EFI_SUCCESS) {
+ DEBUG((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", Status));
} else {
DEBUG((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration Success.\n"));
}
@@ -84,14 +83,14 @@ OnReadyToBoot (
)
{
NOTIFY_PHASE_PARAMS NotifyPhaseParams;
- FSP_STATUS FspStatus;
+ EFI_STATUS Status;
gBS->CloseEvent (Event);
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
- FspStatus = CallFspNotifyPhase (mFspHeader, &NotifyPhaseParams);
- if (FspStatus != FSP_SUCCESS) {
- DEBUG((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", FspStatus));
+ Status = CallFspNotifyPhase (mFspHeader, &NotifyPhaseParams);
+ if (Status != EFI_SUCCESS) {
+ DEBUG((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", Status));
} else {
DEBUG((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot Success.\n"));
}
diff --git a/IntelFspWrapperPkg/Include/Library/FspApiLib.h b/IntelFspWrapperPkg/Include/Library/FspApiLib.h
index fc0104d28c..160c07f646 100644
--- a/IntelFspWrapperPkg/Include/Library/FspApiLib.h
+++ b/IntelFspWrapperPkg/Include/Library/FspApiLib.h
@@ -1,7 +1,7 @@
/** @file
Provide FSP API related function.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -37,9 +37,9 @@ FspFindFspHeader (
@param[in] FspHeader FSP header pointer.
@param[in] FspInitParams Address pointer to the FSP_INIT_PARAMS structure.
- @return FSP status returned by FspInit API.
+ @return EFI status returned by FspInit API.
**/
-FSP_STATUS
+EFI_STATUS
EFIAPI
CallFspInit (
IN FSP_INFO_HEADER *FspHeader,
@@ -52,13 +52,58 @@ CallFspInit (
@param[in] FspHeader FSP header pointer.
@param[in] NotifyPhaseParams Address pointer to the NOTIFY_PHASE_PARAMS structure.
- @return FSP status returned by FspNotifyPhase API.
+ @return EFI status returned by FspNotifyPhase API.
**/
-FSP_STATUS
+EFI_STATUS
EFIAPI
CallFspNotifyPhase (
IN FSP_INFO_HEADER *FspHeader,
IN NOTIFY_PHASE_PARAMS *NotifyPhaseParams
);
+/**
+ Call FSP API - FspMemoryInit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] FspMemoryInitParams Address pointer to the FSP_MEMORY_INIT_PARAMS structure.
+
+ @return EFI status returned by FspMemoryInit API.
+**/
+EFI_STATUS
+EFIAPI
+CallFspMemoryInit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT FSP_MEMORY_INIT_PARAMS *FspMemoryInitParams
+ );
+
+/**
+ Call FSP API - TempRamExit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] TempRamExitParam Address pointer to the TempRamExit parameters structure.
+
+ @return EFI status returned by TempRamExit API.
+**/
+EFI_STATUS
+EFIAPI
+CallTempRamExit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT VOID *TempRamExitParam
+ );
+
+/**
+ Call FSP API - FspSiliconInit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] FspSiliconInitParam Address pointer to the Silicon Init parameters structure.
+
+ @return EFI status returned by FspSiliconInit API.
+**/
+EFI_STATUS
+EFIAPI
+CallFspSiliconInit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT VOID *FspSiliconInitParam
+ );
+
#endif
diff --git a/IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h b/IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h
index 32ce987b92..bb9c9e4734 100644
--- a/IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h
+++ b/IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h
@@ -28,4 +28,30 @@ FspHobProcess (
IN VOID *FspHobList
);
+/**
+ BIOS process FspBobList for Memory Resource Descriptor.
+
+ @param[in] FspHobList Pointer to the HOB data structure produced by FSP.
+
+ @return If platform process the FSP hob list successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspHobProcessForMemoryResource (
+ IN VOID *FspHobList
+ );
+
+/**
+ BIOS process FspBobList for other data (not Memory Resource Descriptor).
+
+ @param[in] FspHobList Pointer to the HOB data structure produced by FSP.
+
+ @return If platform process the FSP hob list successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspHobProcessForOtherData (
+ IN VOID *FspHobList
+ );
+
#endif
diff --git a/IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h b/IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h
index ebbe9a7eaf..c997ea8b22 100644
--- a/IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h
+++ b/IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h
@@ -69,6 +69,32 @@ UpdateFspUpdConfigs (
);
/**
+ Get TempRamExit parameter.
+
+ @note At this point, memory is ready, PeiServices are available to use.
+
+ @return TempRamExit parameter.
+**/
+VOID *
+EFIAPI
+GetTempRamExitParam (
+ VOID
+ );
+
+/**
+ Get FspSiliconInit parameter.
+
+ @note At this point, memory is ready, PeiServices are available to use.
+
+ @return FspSiliconInit parameter.
+**/
+VOID *
+EFIAPI
+GetFspSiliconInitParam (
+ VOID
+ );
+
+/**
Get S3 PEI memory information.
@note At this point, memory is ready, and PeiServices are available to use.
diff --git a/IntelFspWrapperPkg/IntelFspWrapperPkg.dec b/IntelFspWrapperPkg/IntelFspWrapperPkg.dec
index 20bc8b71af..b7e81d3a92 100644
--- a/IntelFspWrapperPkg/IntelFspWrapperPkg.dec
+++ b/IntelFspWrapperPkg/IntelFspWrapperPkg.dec
@@ -22,6 +22,17 @@
Include
[LibraryClasses]
+ ## @libraryclass Provide FSP API related function.
+ FspApiLib|IntelFspWrapperPkg/Include/Library/FspApiLib.h
+
+ ## @libraryclass Provide FSP hob process related function.
+ FspHobProcessLib|IntelFspWrapperPkg/Include/Library/FspHobProcessLib.h
+
+ ## @libraryclass Provide FSP platform information related function.
+ FspPlatformInfoLib|IntelFspWrapperPkg/Include/Library/FspPlatformInfoLib.h
+
+ ## @libraryclass Provide FSP wrapper platform sec related function.
+ FspPlatformSecLib|IntelFspWrapperPkg/Include/Library/FspPlatformSecLib.h
[Guids]
#
@@ -79,3 +90,8 @@
gFspWrapperTokenSpaceGuid.PcdPeiMinMemSize|0x1800000|UINT32|0x40000004
## Indicate the PEI memory size platform want to report
gFspWrapperTokenSpaceGuid.PcdPeiRecoveryMinMemSize|0x3000000|UINT32|0x40000005
+
+ ## PcdFspApiVersion is to determine wrapper calling mechanism
+ # - FSP_API_REVISION_1 1
+ # - FSP_API_REVISION_2 2
+ gFspWrapperTokenSpaceGuid.PcdFspApiVersion|0x02|UINT8|0x00001000
diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf b/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf
index 2608bf1043..2df1683599 100644
--- a/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf
+++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf
@@ -61,6 +61,7 @@
IntelFspWrapperPkg/IntelFspWrapperPkg.dec
[LibraryClasses]
+ BaseLib
[Guids]
gFspHeaderFileGuid ## CONSUMES ## GUID
diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c
index abe61b7aff..162d244665 100644
--- a/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c
+++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c
@@ -1,7 +1,7 @@
/** @file
Provide FSP API related function.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -17,6 +17,7 @@
#include <Guid/FspHeaderFile.h>
#include <Library/FspApiLib.h>
+#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
/**
@@ -26,9 +27,9 @@
@param[in] Function The 32bit code entry to be executed.
@param[in] Param1 The first parameter to pass to 32bit code.
- @return FSP_STATUS.
+ @return EFI_STATUS.
**/
-FSP_STATUS
+EFI_STATUS
Execute32BitCode (
IN UINT64 Function,
IN UINT64 Param1
@@ -84,22 +85,25 @@ FspFindFspHeader (
@param[in] FspHeader FSP header pointer.
@param[in] FspInitParams Address pointer to the FSP_INIT_PARAMS structure.
- @return FSP status returned by FspInit API.
+ @return EFI status returned by FspInit API.
**/
-FSP_STATUS
+EFI_STATUS
EFIAPI
CallFspInit (
IN FSP_INFO_HEADER *FspHeader,
IN FSP_INIT_PARAMS *FspInitParams
)
{
- FSP_FSP_INIT FspInitApi;
- FSP_STATUS FspStatus;
+ FSP_INIT FspInitApi;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
- FspInitApi = (FSP_FSP_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspInitEntryOffset);
- FspStatus = Execute32BitCode ((UINTN)FspInitApi, (UINTN)FspInitParams);
+ FspInitApi = (FSP_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspInitEntryOffset);
+ InterruptState = SaveAndDisableInterrupts ();
+ Status = Execute32BitCode ((UINTN)FspInitApi, (UINTN)FspInitParams);
+ SetInterruptState (InterruptState);
- return FspStatus;
+ return Status;
}
/**
@@ -108,9 +112,9 @@ CallFspInit (
@param[in] FspHeader FSP header pointer.
@param[in] NotifyPhaseParams Address pointer to the NOTIFY_PHASE_PARAMS structure.
- @return FSP status returned by FspNotifyPhase API.
+ @return EFI status returned by FspNotifyPhase API.
**/
-FSP_STATUS
+EFI_STATUS
EFIAPI
CallFspNotifyPhase (
IN FSP_INFO_HEADER *FspHeader,
@@ -118,10 +122,94 @@ CallFspNotifyPhase (
)
{
FSP_NOTIFY_PHASE NotifyPhaseApi;
- FSP_STATUS FspStatus;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
NotifyPhaseApi = (FSP_NOTIFY_PHASE)(UINTN)(FspHeader->ImageBase + FspHeader->NotifyPhaseEntryOffset);
- FspStatus = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams);
+ InterruptState = SaveAndDisableInterrupts ();
+ Status = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams);
+ SetInterruptState (InterruptState);
- return FspStatus;
+ return Status;
+}
+
+/**
+ Call FSP API - FspMemoryInit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] FspMemoryInitParams Address pointer to the FSP_MEMORY_INIT_PARAMS structure.
+
+ @return EFI status returned by FspMemoryInit API.
+**/
+EFI_STATUS
+EFIAPI
+CallFspMemoryInit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT FSP_MEMORY_INIT_PARAMS *FspMemoryInitParams
+ )
+{
+ FSP_MEMORY_INIT FspMemoryInitApi;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
+
+ FspMemoryInitApi = (FSP_MEMORY_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspMemoryInitEntryOffset);
+ InterruptState = SaveAndDisableInterrupts ();
+ Status = Execute32BitCode ((UINTN)FspMemoryInitApi, (UINTN)FspMemoryInitParams);
+ SetInterruptState (InterruptState);
+
+ return Status;
+}
+
+/**
+ Call FSP API - TempRamExit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] TempRamExitParam Address pointer to the TempRamExit parameters structure.
+
+ @return EFI status returned by TempRamExit API.
+**/
+EFI_STATUS
+EFIAPI
+CallTempRamExit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT VOID *TempRamExitParam
+ )
+{
+ FSP_TEMP_RAM_EXIT TempRamExitApi;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
+
+ TempRamExitApi = (FSP_TEMP_RAM_EXIT)(UINTN)(FspHeader->ImageBase + FspHeader->TempRamExitEntryOffset);
+ InterruptState = SaveAndDisableInterrupts ();
+ Status = Execute32BitCode ((UINTN)TempRamExitApi, (UINTN)TempRamExitParam);
+ SetInterruptState (InterruptState);
+
+ return Status;
+}
+
+/**
+ Call FSP API - FspSiliconInit.
+
+ @param[in] FspHeader FSP header pointer.
+ @param[in,out] FspSiliconInitParam Address pointer to the Silicon Init parameters structure.
+
+ @return EFI status returned by FspSiliconInit API.
+**/
+EFI_STATUS
+EFIAPI
+CallFspSiliconInit (
+ IN FSP_INFO_HEADER *FspHeader,
+ IN OUT VOID *FspSiliconInitParam
+ )
+{
+ FSP_SILICON_INIT FspSiliconInitApi;
+ EFI_STATUS Status;
+ BOOLEAN InterruptState;
+
+ FspSiliconInitApi = (FSP_SILICON_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspSiliconInitEntryOffset);
+ InterruptState = SaveAndDisableInterrupts ();
+ Status = Execute32BitCode ((UINTN)FspSiliconInitApi, (UINTN)FspSiliconInitParam);
+ SetInterruptState (InterruptState);
+
+ return Status;
}
diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c
index 15d0a023b8..8bc3501b50 100644
--- a/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c
+++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c
@@ -1,7 +1,7 @@
/** @file
Execute 32-bit code in Protected Mode.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -16,8 +16,8 @@
#include <FspApi.h>
typedef
-FSP_STATUS
-(FSPAPI *FSP_FUNCTION) (
+EFI_STATUS
+(EFIAPI *FSP_FUNCTION) (
IN VOID *Param1
);
@@ -28,16 +28,16 @@ FSP_STATUS
@param[in] Function The 32bit code entry to be executed.
@param[in] Param1 The first parameter to pass to 32bit code.
- @return FSP_STATUS.
+ @return EFI_STATUS.
**/
-FSP_STATUS
+EFI_STATUS
Execute32BitCode (
IN UINT64 Function,
IN UINT64 Param1
)
{
FSP_FUNCTION EntryFunc;
- FSP_STATUS Status;
+ EFI_STATUS Status;
EntryFunc = (FSP_FUNCTION) (UINTN) (Function);
Status = EntryFunc ((VOID *)(UINTN)Param1);
diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c
index 17a9ebc8b5..e2f4422534 100644
--- a/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c
+++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c
@@ -3,7 +3,7 @@
Provide a thunk function to transition from long mode to compatibility mode to execute 32-bit code and then transit
back to long mode.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -81,9 +81,9 @@ AsmExecute32BitCode (
@param[in] Function The 32bit code entry to be executed.
@param[in] Param1 The first parameter to pass to 32bit code.
- @return FSP_STATUS.
+ @return EFI_STATUS.
**/
-FSP_STATUS
+EFI_STATUS
Execute32BitCode (
IN UINT64 Function,
IN UINT64 Param1
diff --git a/IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c b/IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c
index 7c57e7bb46..d21c5665d9 100644
--- a/IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c
+++ b/IntelFspWrapperPkg/Library/BaseFspPlatformInfoLibSample/FspPlatformInfoLibSample.c
@@ -83,6 +83,38 @@ UpdateFspUpdConfigs (
}
/**
+ Get TempRamExit parameter.
+
+ @note At this point, memory is ready, PeiServices are available to use.
+
+ @return TempRamExit parameter.
+**/
+VOID *
+EFIAPI
+GetTempRamExitParam (
+ VOID
+ )
+{
+ return NULL;
+}
+
+/**
+ Get FspSiliconInit parameter.
+
+ @note At this point, memory is ready, PeiServices are available to use.
+
+ @return FspSiliconInit parameter.
+**/
+VOID *
+EFIAPI
+GetFspSiliconInitParam (
+ VOID
+ )
+{
+ return NULL;
+}
+
+/**
Get S3 PEI memory information.
@note At this point, memory is ready, and PeiServices are available to use.
diff --git a/IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c b/IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c
index eac0435989..bad6111778 100644
--- a/IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c
+++ b/IntelFspWrapperPkg/Library/PeiFspHobProcessLibSample/FspHobProcessLibSample.c
@@ -1,7 +1,7 @@
/** @file
Sample to provide FSP hob process related function.
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -132,7 +132,7 @@ GetPeiMemSize (
}
/**
- BIOS process FspBobList.
+ BIOS process FspBobList for Memory Resource Descriptor.
@param[in] FspHobList Pointer to the HOB data structure produced by FSP.
@@ -140,7 +140,7 @@ GetPeiMemSize (
**/
EFI_STATUS
EFIAPI
-FspHobProcess (
+FspHobProcessForMemoryResource (
IN VOID *FspHobList
)
{
@@ -331,9 +331,45 @@ FspHobProcess (
}
}
- //
- // NV Storage Hob
- //
+ return EFI_SUCCESS;
+}
+
+/**
+ BIOS process FspBobList for other data (not Memory Resource Descriptor).
+
+ @param[in] FspHobList Pointer to the HOB data structure produced by FSP.
+ @return If platform process the FSP hob list successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspHobProcessForOtherData (
+ IN VOID *FspHobList
+ )
+{
return EFI_SUCCESS;
}
+
+/**
+ BIOS process FspBobList.
+
+ @param[in] FspHobList Pointer to the HOB data structure produced by FSP.
+
+ @return If platform process the FSP hob list successfully.
+**/
+EFI_STATUS
+EFIAPI
+FspHobProcess (
+ IN VOID *FspHobList
+ )
+{
+ EFI_STATUS Status;
+
+ Status = FspHobProcessForMemoryResource (FspHobList);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ Status = FspHobProcessForOtherData (FspHobList);
+
+ return Status;
+}