PciEnumerationComplete might be signaled to FSP in Coreboot. So FSP wrapper driver don't need send it again. Add a PCD to control if a FSP API could be skipped from FspWrapperNotifyDxe driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Dong Reviewed-by: Maurice Ma Reviewed-by: Jiewen Yao Reviewed-by: Giri P Mudusuru --- .../FspWrapperNotifyDxe/FspWrapperNotifyDxe.c | 22 ++++++++++++++-------- .../FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf | 1 + IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c b/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c index 0797f44..d09e20e 100644 --- a/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c +++ b/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c @@ -26,6 +26,8 @@ #include #include +#define FSP_API_NOTIFY_PHASE_AFTER_PCI_ENUMERATION BIT16 + typedef EFI_STATUS (EFIAPI * ADD_PERFORMANCE_RECORDS)( @@ -237,6 +239,7 @@ FspWrapperNotifyDxeEntryPoint ( EFI_EVENT ReadyToBootEvent; VOID *Registration; EFI_EVENT ProtocolNotifyEvent; + UINT32 FspApiMask; // // Load this driver's image to memory @@ -246,14 +249,17 @@ FspWrapperNotifyDxeEntryPoint ( return EFI_SUCCESS; } - ProtocolNotifyEvent = EfiCreateProtocolNotifyEvent ( - &gEfiPciEnumerationCompleteProtocolGuid, - TPL_CALLBACK, - OnPciEnumerationComplete, - NULL, - &Registration - ); - ASSERT (ProtocolNotifyEvent != NULL); + FspApiMask = PcdGet32 (PcdSkipFspApi); + if ((FspApiMask & FSP_API_NOTIFY_PHASE_AFTER_PCI_ENUMERATION) == 0) { + ProtocolNotifyEvent = EfiCreateProtocolNotifyEvent ( + &gEfiPciEnumerationCompleteProtocolGuid, + TPL_CALLBACK, + OnPciEnumerationComplete, + NULL, + &Registration + ); + ASSERT (ProtocolNotifyEvent != NULL); + } Status = EfiCreateEventReadyToBootEx ( TPL_CALLBACK, diff --git a/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf b/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf index f851f68..54c2cbf 100644 --- a/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf +++ b/IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf @@ -62,6 +62,7 @@ [Pcd] gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdSkipFspApi ## CONSUMES [Depex] TRUE diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec index d9d2d80..ea3bc70 100644 --- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec +++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec @@ -75,6 +75,24 @@ gIntelFsp2WrapperTokenSpaceGuid.PcdFsptBaseAddress|0x00000000|UINT32|0x00000300 gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress|0x00000000|UINT32|0x00000301 + ## This PCD indicates if FSP APIs are skipped from FSP wrapper.

+ # If a bit is set, that means this FSP API is skipped.
+ # If a bit is clear, that means this FSP API is NOT skipped.
+ # NOTE: Only NotifyPhase Post PCI enumeration (BIT16) is implemented.
+ # BIT[15:0] is for function:
+ # BIT0 – Skip TempRamInit
+ # BIT1 – Skip MemoryInit
+ # BIT2 – Skip TempRamExit
+ # BIT3 – Skip SiliconInit
+ # BIT4 – Skip NotifyPhase
+ # BIT[32:16] is for sub-function:
+ # BIT16 – Skip NotifyPhase (AfterPciEnumeration)
+ # BIT17 – Skip NotifyPhase (ReadyToBoot)
+ # BIT18 – Skip NotifyPhase (EndOfFirmware)
+ # Any undefined BITs are reserved for future use.
+ # @Prompt Skip FSP API from FSP wrapper. + gIntelFsp2WrapperTokenSpaceGuid.PcdSkipFspApi|0x00000000|UINT32|0x40000009 + [PcdsFixedAtBuild, PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress|0x00000000|UINT32|0x00001001 \ No newline at end of file -- 2.7.0.windows.1