EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
EFI_FIRMWARE_VOLUME_HEADER *ChildFvHeader;\r
EFI_FIRMWARE_VOLUME_HEADER *MigratedFvHeader;\r
+ EFI_FIRMWARE_VOLUME_HEADER *RawDataFvHeader;\r
EFI_FIRMWARE_VOLUME_HEADER *MigratedChildFvHeader;\r
\r
PEI_CORE_FV_HANDLE PeiCoreFvHandle;\r
EFI_PEI_CORE_FV_LOCATION_PPI *PeiCoreFvLocationPpi;\r
+ EDKII_MIGRATED_FV_INFO MigratedFvInfo;\r
\r
ASSERT (Private->PeiMemoryInstalled);\r
\r
(((EFI_PHYSICAL_ADDRESS)(UINTN) FvHeader + (FvHeader->FvLength - 1)) < Private->FreePhysicalMemoryTop)\r
)\r
) {\r
+ //\r
+ // Allocate page to save the rebased PEIMs, the PEIMs will get dispatched later.\r
+ //\r
Status = PeiServicesAllocatePages (\r
EfiBootServicesCode,\r
EFI_SIZE_TO_PAGES ((UINTN) FvHeader->FvLength),\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ //\r
+ // Allocate pool to save the raw PEIMs, which is used to keep consistent context across\r
+ // multiple boot and PCR0 will keep the same no matter if the address of allocated page is changed.\r
+ //\r
+ Status = PeiServicesAllocatePages (\r
+ EfiBootServicesCode,\r
+ EFI_SIZE_TO_PAGES ((UINTN) FvHeader->FvLength),\r
+ (EFI_PHYSICAL_ADDRESS *) &RawDataFvHeader\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
DEBUG ((\r
DEBUG_VERBOSE,\r
" Migrating FV[%d] from 0x%08X to 0x%08X\n",\r
(UINTN) MigratedFvHeader\r
));\r
\r
+ //\r
+ // Copy the context to the rebased pages and raw pages, and create hob to save the\r
+ // information. The MigratedFvInfo HOB will never be produced when\r
+ // PcdMigrateTemporaryRamFirmwareVolumes is FALSE, because the PCD control the\r
+ // feature.\r
+ //\r
CopyMem (MigratedFvHeader, FvHeader, (UINTN) FvHeader->FvLength);\r
+ CopyMem (RawDataFvHeader, MigratedFvHeader, (UINTN) FvHeader->FvLength);\r
+ MigratedFvInfo.FvOrgBase = (UINT32) (UINTN) FvHeader;\r
+ MigratedFvInfo.FvNewBase = (UINT32) (UINTN) MigratedFvHeader;\r
+ MigratedFvInfo.FvDataBase = (UINT32) (UINTN) RawDataFvHeader;\r
+ MigratedFvInfo.FvLength = (UINT32) (UINTN) FvHeader->FvLength;\r
+ BuildGuidDataHob (&gEdkiiMigratedFvInfoGuid, &MigratedFvInfo, sizeof (MigratedFvInfo));\r
\r
//\r
// Migrate any children for this FV now\r
--- /dev/null
+/** @file\r
+ Migrated FV information\r
+\r
+Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__\r
+#define __EDKII_MIGRATED_FV_INFO_GUID_H__\r
+\r
+typedef struct {\r
+ UINT32 FvOrgBase; // original FV address\r
+ UINT32 FvNewBase; // new FV address\r
+ UINT32 FvDataBase; // original FV data\r
+ UINT32 FvLength; // Fv Length\r
+} EDKII_MIGRATED_FV_INFO;\r
+\r
+extern EFI_GUID gEdkiiMigratedFvInfoGuid;\r
+\r
+#endif // #ifndef __EDKII_MIGRATED_FV_INFO_GUID_H__\r
+\r
## GUID indicates the capsule is to store Capsule On Disk file names.\r
gEdkiiCapsuleOnDiskNameGuid = { 0x98c80a4f, 0xe16b, 0x4d11, { 0x93, 0x9a, 0xab, 0xe5, 0x61, 0x26, 0x3, 0x30 } }\r
\r
+ ## Include/Guid/MigratedFvInfo.h\r
+ gEdkiiMigratedFvInfoGuid = { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2, 0xf4, 0xc6, 0xce, 0xfd, 0x17, 0x98, 0x71 } }\r
+\r
[Ppis]\r
## Include/Ppi/AtaController.h\r
gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}\r