diff --git a/MinPlatformPkg/Include/Library/FspSupportLib.h b/MinPlatformPkg/Include/Library/FspSupportLib.h new file mode 100644 index 0000000000..9b98ac0d0a --- /dev/null +++ b/MinPlatformPkg/Include/Library/FspSupportLib.h @@ -0,0 +1,35 @@ +/** @file FspSupportLib.c + + Library to report FSP support state + + Copyright (c) Microsoft Corporation. All rights reserved. + +**/ + +#ifndef _FSP_SUPPORT_LIB_H_ +#define _FSP_SUPPORT_LIB_H_ + +/** + Return if platform is boot in FSP wrapper enabled + + @retval TRUE FSP binary is used. + FALSE FSP binary is not used. +**/ +BOOLEAN +EFIAPI +FspGetWrapperBootMode ( + VOID + ); + +/** + Return FSP mode selection. Only valid on certain platforms + + @retval FSP mode. +**/ +UINT8 +EFIAPI +FspGetModeSelection ( + VOID + ); + +#endif // _FSP_SUPPORT_LIB_H_ diff --git a/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.c b/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.c new file mode 100644 index 0000000000..6b08e02e06 --- /dev/null +++ b/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.c @@ -0,0 +1,41 @@ +/** @file FspSupportLib.c + + Library to report FSP support state + + Copyright (c) Microsoft Corporation. All rights reserved. + +**/ + +#include + +#include +#include + +/** + Return if platform is boot in FSP wrapper enabled + + @retval TRUE FSP binary is used. + FALSE FSP binary is not used. +**/ +BOOLEAN +EFIAPI +FspGetWrapperBootMode ( + VOID + ) +{ + return PcdGetBool (PcdFspWrapperBootMode); +} + +/** + Return FSP mode selection. Only valid on certain platforms + + @retval FSP mode. +**/ +UINT8 +EFIAPI +FspGetModeSelection ( + VOID + ) +{ + return PcdGet8 (PcdFspModeSelection); +} diff --git a/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.inf b/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.inf new file mode 100644 index 0000000000..5605ffa01d --- /dev/null +++ b/MinPlatformPkg/Library/FspSupportLib/FspSupportLib.inf @@ -0,0 +1,31 @@ +# @file FspSupportLib.inf +# +# Default implementation of FspSupportLib. +# Library to report FSP support state +# +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# + +[Defines] + INF_VERSION = 0x00010006 + BASE_NAME = FspSupportLib + FILE_GUID = 9D79825F-C6A5-4D94-AF26-23AF2BD6BEC7 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = FspSupportLib + +[Sources] + FspSupportLib.c + +[Packages] + MdePkg/MdePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec + +[LibraryClasses] + PcdLib + +[Pcd] + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection diff --git a/MinPlatformPkg/MinPlatformPkg.dec b/MinPlatformPkg/MinPlatformPkg.dec index 9dc8152c32..70165a90e9 100644 --- a/MinPlatformPkg/MinPlatformPkg.dec +++ b/MinPlatformPkg/MinPlatformPkg.dec @@ -93,6 +93,9 @@ TestPointPciSpeedInfoLib|Include/Library/TestPointPciSpeedInfoLib.h PhatAcpiLib|Include/Library/PhatAcpiLib.h + # MU_CHANGE Make PlatformInitPreMem silicon independent + FspSupportLib|Include/Library/FspSupportLib.h + # MU_CHANGE end [PcdsFixedAtBuild, PcdsPatchableInModule] diff --git a/MinPlatformPkg/MinPlatformPkg.dsc b/MinPlatformPkg/MinPlatformPkg.dsc index feb2b3e012..f13f501533 100644 --- a/MinPlatformPkg/MinPlatformPkg.dsc +++ b/MinPlatformPkg/MinPlatformPkg.dsc @@ -88,6 +88,9 @@ NULL|MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf # MU_CHANGE: /GS and -fstack-protector support TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf TestPointPciSpeedInfoLib|MinPlatformPkg/Library/TestPointPciSpeedInfoLibNull/TestPointPciSpeedInfoLibNull.inf + # MU_CHANGE Make PlatformInitPreMem silicon independent + FspSupportLib|MinPlatformPkg/Library/FspSupportLib/FspSupportLib.inf + # MU_CHANGE end [LibraryClasses.common.SEC] TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf @@ -237,6 +240,9 @@ MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf MinPlatformPkg/Acpi/Library/PhatAcpiLib/DxePhatAcpiLib.inf + # MU_CHANGE Make PlatformInitPreMem silicon independent + MinPlatformPkg/Library/FspSupportLib/FspSupportLib.inf + # MU_CHANGE end [BuildOptions] *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c index 8e5eaec084..0ea1bc90b1 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c @@ -30,6 +30,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +// MU_CHANGE Make PlatformInitPreMem silicon independent +#include +// MU_CHANGE end EFI_STATUS EFIAPI @@ -516,7 +519,10 @@ PlatformInitPreMem ( BuildMemoryTypeInformation (); - if ((!PcdGetBool (PcdFspWrapperBootMode)) || (PcdGet8 (PcdFspModeSelection) == 0)) { +// MU_CHANGE Make PlatformInitPreMem silicon independent +//if ((!PcdGetBool (PcdFspWrapperBootMode)) || (PcdGet8 (PcdFspModeSelection) == 0)) { + if ((!FspGetWrapperBootMode()) || (FspGetModeSelection() == 0)) { +// MU_CHANGE end // // Install memory relating PPIs for EDKII native build and FSP dispatch mode // diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf index c8fa0ed3ac..a7d769dc9e 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf @@ -28,19 +28,28 @@ TimerLib SetCacheMtrrLib ReportCpuHobLib + # MU_CHANGE Make PlatformInitPreMem silicon independent + FspSupportLib + # MU_CHANGE end [Packages] MinPlatformPkg/MinPlatformPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec - IntelSiliconPkg/IntelSiliconPkg.dec - IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec + # MU_CHANGE Make PlatformInitPreMem silicon independent + # IntelSiliconPkg/IntelSiliconPkg.dec + # IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec + # MU_CHANGE end [Pcd] - gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES + # MU_CHANGE Make PlatformInitPreMem silicon independent + # gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES + # MU_CHANGE end gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit ## CONSUMES gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit ## CONSUMES - gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## CONSUMES + # MU_CHANGE Make PlatformInitPreMem silicon independent + # gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## CONSUMES + # MU_CHANGE end [FixedPcd] gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiReclaimMemorySize ## CONSUMES