From fdc62849d21251db7e15f8c816beb2fea952a8da Mon Sep 17 00:00:00 2001 From: PaddyDeng Date: Thu, 24 Oct 2024 15:00:30 +0800 Subject: [PATCH 1/5] Create PlatformInitPreMemNonFsp PlatformInitPreMemNonFsp provides identical function compares to PlatformInitPreMem. But using FspSupportNull.c thus does not require IntelSiliconPkg and IntelFsp2WrapperPkg as dependency. --- .../PlatformInit/PlatformInitPei/FspSupport.c | 10 +++ .../PlatformInitPei/FspSupportNull.c | 10 +++ .../PlatformInitPei/PlatformInitPreMem.c | 8 ++- .../PlatformInitPei/PlatformInitPreMem.inf | 1 + .../PlatformInitPreMemNonFsp.inf | 67 +++++++++++++++++++ 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c create mode 100644 MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c create mode 100644 MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c new file mode 100644 index 0000000000..0ee337fa4e --- /dev/null +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c @@ -0,0 +1,10 @@ +#include + +UINT8 +EFIAPI +FspGetModeSelection ( + VOID + ) +{ + return PcdGet8 (PcdFspModeSelection); +} \ No newline at end of file diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c new file mode 100644 index 0000000000..3afcca580f --- /dev/null +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c @@ -0,0 +1,10 @@ +#include + +UINT8 +EFIAPI +FspGetModeSelection ( + VOID + ) +{ + return 0; +} \ No newline at end of file diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c index 8e5eaec084..a334ce73af 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c @@ -47,6 +47,12 @@ GetPlatformMemorySize ( IN OUT UINT64 *MemorySize ); +UINT8 +EFIAPI +FspGetModeSelection ( + VOID +); + /** This function checks the memory range in PEI. @@ -516,7 +522,7 @@ PlatformInitPreMem ( BuildMemoryTypeInformation (); - if ((!PcdGetBool (PcdFspWrapperBootMode)) || (PcdGet8 (PcdFspModeSelection) == 0)) { + if ((!PcdGetBool (PcdFspWrapperBootMode)) || (FspGetModeSelection() == 0)) { // // 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..7f4f8ce407 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf @@ -51,6 +51,7 @@ [Sources] PlatformInitPreMem.c + FspSupport.c [Ppis] gEfiPeiMemoryDiscoveredPpiGuid diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf new file mode 100644 index 0000000000..a2208b455f --- /dev/null +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf @@ -0,0 +1,67 @@ +### @file +# Component information file for the Platform Init Pre-Memory PEI module. +# +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = PlatformInitPreMemNonFsp + FILE_GUID = BEB6F1A6-F6BC-4C34-AB32-F0390A428479 + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + ENTRY_POINT = PlatformInitPreMemEntryPoint + +[LibraryClasses] + BaseMemoryLib + BoardInitLib + DebugLib + HobLib + IoLib + MemoryAllocationLib + PeimEntryPoint + PeiServicesLib + TestPointCheckLib + TimerLib + SetCacheMtrrLib + ReportCpuHobLib + +[Packages] + MinPlatformPkg/MinPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[Pcd] + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit ## CONSUMES + +[FixedPcd] + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiReclaimMemorySize ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiNvsMemorySize ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiReservedMemorySize ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtDataMemorySize ## CONSUMES + gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtCodeMemorySize ## CONSUMES + +[Sources] + PlatformInitPreMem.c + FspSupportNull.c + +[Ppis] + gEfiPeiMemoryDiscoveredPpiGuid + gEfiPeiMasterBootModePpiGuid ## PRODUCES + gEfiPeiBootInRecoveryModePpiGuid ## PRODUCES + gPlatformInitTempRamExitPpiGuid ## PRODUCES + gEfiPeiReadOnlyVariable2PpiGuid + gPeiBaseMemoryTestPpiGuid + gPeiPlatformMemorySizePpiGuid + +[Guids] + gEfiMemoryTypeInformationGuid + gEfiMemoryTypeMinimumAllocationGuid #MU_CHANGE - Add minimum memory type allocations + +[Depex] + gEfiPeiReadOnlyVariable2PpiGuid From 99ab2058f8f7411befabe74f6680377510bbe95d Mon Sep 17 00:00:00 2001 From: PaddyDeng Date: Mon, 28 Oct 2024 10:13:52 +0800 Subject: [PATCH 2/5] Add PlatformInitPreMemNonFsp to the dsc file --- MinPlatformPkg/MinPlatformPkg.dsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MinPlatformPkg/MinPlatformPkg.dsc b/MinPlatformPkg/MinPlatformPkg.dsc index feb2b3e012..f521bea57b 100644 --- a/MinPlatformPkg/MinPlatformPkg.dsc +++ b/MinPlatformPkg/MinPlatformPkg.dsc @@ -190,6 +190,9 @@ MinPlatformPkg/PlatformInit/ReportFv/ReportFvPei.inf MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf + # MU_CHANGE [BEGIN] For MU repo pipeline requirement + MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf + # MU_CHANGE [END] MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.inf MinPlatformPkg/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf From 514e7bb084b7d934ef5c791de410054292b7e6d5 Mon Sep 17 00:00:00 2001 From: PaddyDeng Date: Thu, 31 Oct 2024 18:25:25 +0800 Subject: [PATCH 3/5] Update for the review suggestion --- MinPlatformPkg/MinPlatformPkg.dsc | 2 -- MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c | 9 ++++++++- .../PlatformInit/PlatformInitPei/FspSupportNull.c | 9 ++++++++- .../PlatformInitPei/PlatformInitPreMemNonFsp.inf | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/MinPlatformPkg/MinPlatformPkg.dsc b/MinPlatformPkg/MinPlatformPkg.dsc index f521bea57b..0f94ec0b0d 100644 --- a/MinPlatformPkg/MinPlatformPkg.dsc +++ b/MinPlatformPkg/MinPlatformPkg.dsc @@ -190,9 +190,7 @@ MinPlatformPkg/PlatformInit/ReportFv/ReportFvPei.inf MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf - # MU_CHANGE [BEGIN] For MU repo pipeline requirement MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf - # MU_CHANGE [END] MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.inf MinPlatformPkg/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c index 0ee337fa4e..0e489ad462 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupport.c @@ -1,3 +1,10 @@ +/** @file FspSupport.c + Provides FSP mode selection value based on PcdFspModeSelection + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + #include UINT8 @@ -7,4 +14,4 @@ FspGetModeSelection ( ) { return PcdGet8 (PcdFspModeSelection); -} \ No newline at end of file +} diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c index 3afcca580f..ce8d33efd7 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/FspSupportNull.c @@ -1,3 +1,10 @@ +/** @file FspSupport.c + Provides FSP mode selection value based on PcdFspModeSelection + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + #include UINT8 @@ -7,4 +14,4 @@ FspGetModeSelection ( ) { return 0; -} \ No newline at end of file +} diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf index a2208b455f..f08fd11e86 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf @@ -2,6 +2,7 @@ # Component information file for the Platform Init Pre-Memory PEI module. # # Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation. # # SPDX-License-Identifier: BSD-2-Clause-Patent # From f044f15adbd1f42d2e71edd8157f752e75eac5ba Mon Sep 17 00:00:00 2001 From: PaddyDengKC Date: Mon, 4 Nov 2024 14:10:00 +0800 Subject: [PATCH 4/5] Update MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c Co-authored-by: Michael Kubacki --- .../PlatformInit/PlatformInitPei/PlatformInitPreMem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c index a334ce73af..7cfbd5d402 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c @@ -522,7 +522,7 @@ PlatformInitPreMem ( BuildMemoryTypeInformation (); - if ((!PcdGetBool (PcdFspWrapperBootMode)) || (FspGetModeSelection() == 0)) { + if ((!PcdGetBool (PcdFspWrapperBootMode)) || (FspGetModeSelection () == 0)) { // // Install memory relating PPIs for EDKII native build and FSP dispatch mode // From c740d8f32ae83451790d7e673d5d0ce8608ff5db Mon Sep 17 00:00:00 2001 From: PaddyDengKC Date: Mon, 4 Nov 2024 14:10:07 +0800 Subject: [PATCH 5/5] Update MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c Co-authored-by: Michael Kubacki --- .../PlatformInit/PlatformInitPei/PlatformInitPreMem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c index 7cfbd5d402..21bfacf459 100644 --- a/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c +++ b/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c @@ -51,7 +51,7 @@ UINT8 EFIAPI FspGetModeSelection ( VOID -); + ); /**