Skip to content

Commit 175663e

Browse files
Make PlatformInitPreMem independent to IntelSiliconPkg and IntelFsp2WrapperPkg (#293)
## Description This driver is shared across different Silicon vendors. So it should not use any Intel specific packages. In order to achieve this, added a new lib `FspSupportLib` to isolate silicon related PCDs - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? ## How This Was Tested CI build passed. ## Integration Instructions No additional change is required for the consuming platforms. --------- Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
1 parent 8fa7e0b commit 175663e

File tree

6 files changed

+111
-1
lines changed

6 files changed

+111
-1
lines changed

MinPlatformPkg/MinPlatformPkg.dsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190

191191
MinPlatformPkg/PlatformInit/ReportFv/ReportFvPei.inf
192192
MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
193+
MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMemNonFsp.inf
193194
MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
194195
MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.inf
195196
MinPlatformPkg/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** @file FspSupport.c
2+
Provides FSP mode selection value based on PcdFspModeSelection
3+
4+
Copyright (c) Microsoft Corporation.
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
**/
7+
8+
#include <PiPei.h>
9+
10+
UINT8
11+
EFIAPI
12+
FspGetModeSelection (
13+
VOID
14+
)
15+
{
16+
return PcdGet8 (PcdFspModeSelection);
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** @file FspSupport.c
2+
Provides FSP mode selection value based on PcdFspModeSelection
3+
4+
Copyright (c) Microsoft Corporation.
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
**/
7+
8+
#include <PiPei.h>
9+
10+
UINT8
11+
EFIAPI
12+
FspGetModeSelection (
13+
VOID
14+
)
15+
{
16+
return 0;
17+
}

MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ GetPlatformMemorySize (
4747
IN OUT UINT64 *MemorySize
4848
);
4949

50+
UINT8
51+
EFIAPI
52+
FspGetModeSelection (
53+
VOID
54+
);
55+
5056
/**
5157
5258
This function checks the memory range in PEI.
@@ -516,7 +522,7 @@ PlatformInitPreMem (
516522

517523
BuildMemoryTypeInformation ();
518524

519-
if ((!PcdGetBool (PcdFspWrapperBootMode)) || (PcdGet8 (PcdFspModeSelection) == 0)) {
525+
if ((!PcdGetBool (PcdFspWrapperBootMode)) || (FspGetModeSelection () == 0)) {
520526
//
521527
// Install memory relating PPIs for EDKII native build and FSP dispatch mode
522528
//

MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
[Sources]
5353
PlatformInitPreMem.c
54+
FspSupport.c
5455

5556
[Ppis]
5657
gEfiPeiMemoryDiscoveredPpiGuid
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
### @file
2+
# Component information file for the Platform Init Pre-Memory PEI module.
3+
#
4+
# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
5+
# Copyright (c) Microsoft Corporation.
6+
#
7+
# SPDX-License-Identifier: BSD-2-Clause-Patent
8+
#
9+
###
10+
11+
[Defines]
12+
INF_VERSION = 0x00010017
13+
BASE_NAME = PlatformInitPreMemNonFsp
14+
FILE_GUID = BEB6F1A6-F6BC-4C34-AB32-F0390A428479
15+
VERSION_STRING = 1.0
16+
MODULE_TYPE = PEIM
17+
ENTRY_POINT = PlatformInitPreMemEntryPoint
18+
19+
[LibraryClasses]
20+
BaseMemoryLib
21+
BoardInitLib
22+
DebugLib
23+
HobLib
24+
IoLib
25+
MemoryAllocationLib
26+
PeimEntryPoint
27+
PeiServicesLib
28+
TestPointCheckLib
29+
TimerLib
30+
SetCacheMtrrLib
31+
ReportCpuHobLib
32+
33+
[Packages]
34+
MinPlatformPkg/MinPlatformPkg.dec
35+
MdeModulePkg/MdeModulePkg.dec
36+
MdePkg/MdePkg.dec
37+
38+
[Pcd]
39+
gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBootMode ## CONSUMES
40+
gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit ## CONSUMES
41+
gMinPlatformPkgTokenSpaceGuid.PcdStopAfterMemInit ## CONSUMES
42+
43+
[FixedPcd]
44+
gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiReclaimMemorySize ## CONSUMES
45+
gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiAcpiNvsMemorySize ## CONSUMES
46+
gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiReservedMemorySize ## CONSUMES
47+
gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtDataMemorySize ## CONSUMES
48+
gMinPlatformPkgTokenSpaceGuid.PcdPlatformEfiRtCodeMemorySize ## CONSUMES
49+
50+
[Sources]
51+
PlatformInitPreMem.c
52+
FspSupportNull.c
53+
54+
[Ppis]
55+
gEfiPeiMemoryDiscoveredPpiGuid
56+
gEfiPeiMasterBootModePpiGuid ## PRODUCES
57+
gEfiPeiBootInRecoveryModePpiGuid ## PRODUCES
58+
gPlatformInitTempRamExitPpiGuid ## PRODUCES
59+
gEfiPeiReadOnlyVariable2PpiGuid
60+
gPeiBaseMemoryTestPpiGuid
61+
gPeiPlatformMemorySizePpiGuid
62+
63+
[Guids]
64+
gEfiMemoryTypeInformationGuid
65+
gEfiMemoryTypeMinimumAllocationGuid #MU_CHANGE - Add minimum memory type allocations
66+
67+
[Depex]
68+
gEfiPeiReadOnlyVariable2PpiGuid

0 commit comments

Comments
 (0)