Skip to content

Commit 176b9d4

Browse files
zhihaoli1064mergify[bot]
authored andcommitted
MdeModulePkg/Core/Pei: Install MigrateTempRamPpi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4716 Migrate FSP-T/M binary from temporary RAM to permanent RAM before NEM tear down. Tcg module will use permanent address of FSP-T/M for measurement. In MdeModulePkg, PeiCore installs mMigrateTempRamPpi if PcdMigrateTemporaryRamFirmwareVolumes is True before NEM tear down and after permanent memory ready. Cc: Chasel Chiu <[email protected]> Cc: Nate DeSimone <[email protected]> Cc: Duggapu Chinni B <[email protected]> Cc: Chen Gang C <[email protected]> Cc: Liming Gao <[email protected]> Signed-off-by: Zhihao Li <[email protected]>
1 parent 537a81a commit 176b9d4

File tree

6 files changed

+41
-5
lines changed

6 files changed

+41
-5
lines changed

MdeModulePkg/Core/Pei/PeiMain.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @file
22
Definition of Pei Core Structures and Services
33
4-
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
4+
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
55
SPDX-License-Identifier: BSD-2-Clause-Patent
66
77
**/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
2626
#include <Ppi/TemporaryRamDone.h>
2727
#include <Ppi/SecHobData.h>
2828
#include <Ppi/PeiCoreFvLocation.h>
29+
#include <Ppi/MigrateTempRam.h>
2930
#include <Library/DebugLib.h>
3031
#include <Library/PeiCoreEntryPoint.h>
3132
#include <Library/BaseLib.h>

MdeModulePkg/Core/Pei/PeiMain.inf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# 2) Dispatch PEIM from discovered FV.
77
# 3) Handoff control to DxeIpl to load DXE core and enter DXE phase.
88
#
9-
# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
9+
# Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
1010
#
1111
# SPDX-License-Identifier: BSD-2-Clause-Patent
1212
#
@@ -101,6 +101,7 @@
101101
gEfiPeiReset2PpiGuid ## SOMETIMES_CONSUMES
102102
gEfiSecHobDataPpiGuid ## SOMETIMES_CONSUMES
103103
gEfiPeiCoreFvLocationPpiGuid ## SOMETIMES_CONSUMES
104+
gEdkiiPeiMigrateTempRamPpiGuid ## PRODUCES
104105

105106
[Pcd]
106107
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize ## CONSUMES

MdeModulePkg/Core/Pei/PeiMain/PeiMain.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @file
22
Pei Core Main Entry Point
33
4-
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
4+
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.<BR>
55
SPDX-License-Identifier: BSD-2-Clause-Patent
66
77
**/
@@ -13,6 +13,11 @@ EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
1313
&gEfiPeiMemoryDiscoveredPpiGuid,
1414
NULL
1515
};
16+
EFI_PEI_PPI_DESCRIPTOR mMigrateTempRamPpi = {
17+
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
18+
&gEdkiiPeiMigrateTempRamPpiGuid,
19+
NULL
20+
};
1621

1722
///
1823
/// Pei service instance
@@ -449,6 +454,9 @@ PeiCore (
449454
//
450455
EvacuateTempRam (&PrivateData, SecCoreData);
451456

457+
Status = PeiServicesInstallPpi (&mMigrateTempRamPpi);
458+
ASSERT_EFI_ERROR (Status);
459+
452460
DEBUG ((DEBUG_VERBOSE, "PPI lists after temporary RAM evacuation:\n"));
453461
DumpPpiList (&PrivateData);
454462
}

MdeModulePkg/Include/Guid/MigratedFvInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @file
22
Migrated FV information
33
4-
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
4+
Copyright (c) 2020 - 2024, Intel Corporation. All rights reserved.<BR>
55
SPDX-License-Identifier: BSD-2-Clause-Patent
66
77
**/
@@ -50,7 +50,7 @@ typedef struct {
5050

5151
typedef struct {
5252
UINT32 FvOrgBase; // original FV address
53-
UINT32 FvNewBase; // new FV address
53+
UINT32 FvNewBase; // new FV address, 0 means rebased data is not copied
5454
UINT32 FvDataBase; // original FV data, 0 means raw data is not copied
5555
UINT32 FvLength; // Fv Length
5656
} EDKII_MIGRATED_FV_INFO;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** @file
2+
This file declares Migrate Temporary Memory PPI.
3+
4+
This PPI is published by the PEI Foundation when temporary RAM needs to evacuate.
5+
Its purpose is to be used as a signal for other PEIMs who can register for a
6+
notification on its installation.
7+
8+
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
9+
SPDX-License-Identifier: BSD-2-Clause-Patent
10+
11+
**/
12+
13+
#ifndef PEI_MIGRATE_TEMP_RAM_PPI_H_
14+
#define PEI_MIGRATE_TEMP_RAM_PPI_H_
15+
16+
#define EFI_PEI_MIGRATE_TEMP_RAM_PPI_GUID \
17+
{ \
18+
0xc79dc53b, 0xafcd, 0x4a6a, {0xad, 0x94, 0xa7, 0x6a, 0x3f, 0xa9, 0xe9, 0xc2 } \
19+
}
20+
21+
extern EFI_GUID gEdkiiPeiMigrateTempRamPpiGuid;
22+
23+
#endif

MdeModulePkg/MdeModulePkg.dec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@
557557
## Include/Ppi/MemoryAttribute.h
558558
gEdkiiMemoryAttributePpiGuid = { 0x1be840de, 0x2d92, 0x41ec, { 0xb6, 0xd3, 0x19, 0x64, 0x13, 0x50, 0x51, 0xfb } }
559559

560+
## Include/Ppi/MigrateTempRam.h
561+
gEdkiiPeiMigrateTempRamPpiGuid = { 0xc79dc53b, 0xafcd, 0x4a6a, { 0xad, 0x94, 0xa7, 0x6a, 0x3f, 0xa9, 0xe9, 0xc2 } }
562+
560563
[Protocols]
561564
## Load File protocol provides capability to load and unload EFI image into memory and execute it.
562565
# Include/Protocol/LoadPe32Image.h

0 commit comments

Comments
 (0)