summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg/FspNotifyPhase
diff options
context:
space:
mode:
authorChasel, Chiu <chasel.chiu@intel.com>2018-10-11 21:22:12 +0800
committerChasel, Chiu <chasel.chiu@intel.com>2018-10-19 15:01:00 +0800
commita2e61f341d26a78751b2f19b5004c6bbfc8b4fa9 (patch)
treee8083c1a1b5a396a7b0d5239dc0f2f1f491313a5 /IntelFsp2Pkg/FspNotifyPhase
parent7b500c606ad101fad52327318af37889048cd45e (diff)
downloadedk2-a2e61f341d26a78751b2f19b5004c6bbfc8b4fa9.tar.gz
edk2-a2e61f341d26a78751b2f19b5004c6bbfc8b4fa9.tar.bz2
edk2-a2e61f341d26a78751b2f19b5004c6bbfc8b4fa9.zip
IntelFsp2Pkg: Support FSP Dispatch mode
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1241 Add support for both API (original mode) and DISPATCH mode: 1. Add FspMode field from reserved byte of Global Data Structure to tell which mode is selected by boot loader. If boot loader invoking FSP-M API this field will remain as default 0 (API mode), otherwise platform FSP should set this field to 1 (Dispatch mode) when initializing Global Data Structure. 2. gFspInApiModePpiGuid will be instaled when FSP running in API mode and modules only for API mode should have this in depex. 3. If it is DISPATCH mode, FSP will return to PEI dispatcher, not directly return to boot loader. 4. DISPATCH mode supports DXE NotifyPhase drivers so FSP will not wait for PEI NotifyPhase callbacks, instead it will install gFspReadyForNotifyPhasePpiGuid PPI for platform to complete late initialization before transferring to DXE. Test: Verified FSP API and DISPATCH modes on 2 internal platforms and both boot successfully. Cc: Jiewen Yao <Jiewen.yao@intel.com> Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Diffstat (limited to 'IntelFsp2Pkg/FspNotifyPhase')
-rw-r--r--IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c59
-rw-r--r--IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf3
2 files changed, 38 insertions, 24 deletions
diff --git a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c
index 52435fa0b2..cbea3a7eaa 100644
--- a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c
+++ b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c
@@ -48,6 +48,12 @@ CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi = {
NULL
};
+CONST EFI_PEI_PPI_DESCRIPTOR gFspReadyForNotifyPhasePpi = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gFspReadyForNotifyPhasePpiGuid,
+ NULL
+};
+
/**
This function waits for FSP notify.
@@ -88,13 +94,15 @@ WaitForNotify (
//
FspWaitForNotify ();
- //
- // Should not come here
- //
- while (TRUE) {
- DEBUG ((DEBUG_ERROR, "No FSP API should be called after FSP is DONE!\n"));
- SetFspApiReturnStatus (EFI_UNSUPPORTED);
- Pei2LoaderSwitchStack ();
+ if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {
+ //
+ // Should not come here
+ //
+ while (TRUE) {
+ DEBUG ((DEBUG_ERROR, "No FSP API should be called after FSP is DONE!\n"));
+ SetFspApiReturnStatus (EFI_UNSUPPORTED);
+ Pei2LoaderSwitchStack ();
+ }
}
return EFI_SUCCESS;
@@ -121,22 +129,27 @@ FspNotifyPhasePeimEntryPoint (
DEBUG ((DEBUG_INFO | DEBUG_INIT, "The entry of FspNotificationPeim\n"));
- //
- // Locate old DXE IPL PPI
- //
- Status = PeiServicesLocatePpi (
- &gEfiDxeIplPpiGuid,
- 0,
- &OldDescriptor,
- &OldDxeIplPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Re-install the DXE IPL PPI to wait for notify
- //
- Status = PeiServicesReInstallPpi (OldDescriptor, &mInstallDxeIplPpi);
- ASSERT_EFI_ERROR (Status);
+ if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {
+ //
+ // Locate old DXE IPL PPI
+ //
+ Status = PeiServicesLocatePpi (
+ &gEfiDxeIplPpiGuid,
+ 0,
+ &OldDescriptor,
+ &OldDxeIplPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Re-install the DXE IPL PPI to wait for notify
+ //
+ Status = PeiServicesReInstallPpi (OldDescriptor, &mInstallDxeIplPpi);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Status = PeiServicesInstallPpi (&gFspReadyForNotifyPhasePpi);
+ ASSERT_EFI_ERROR (Status);
+ }
return EFI_SUCCESS;
}
diff --git a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf
index a0bc37580d..b0f6768cfa 100644
--- a/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf
+++ b/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf
@@ -1,7 +1,7 @@
## @file
# Component information file for the FSP notify phase PEI module.
#
-# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
# 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,6 +37,7 @@
[Ppis]
gEfiDxeIplPpiGuid ## PRODUCES
gEfiEndOfPeiSignalPpiGuid ## PRODUCES
+ gFspReadyForNotifyPhasePpiGuid ## PRODUCES
[Protocols]
gEfiPciEnumerationCompleteProtocolGuid ## PRODUCES