12 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
13 &gEfiPeiMemoryDiscoveredPpiGuid,
17 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
18 &gEdkiiPeiMigrateTempRamPpiGuid,
85 UINT32 AuthenticationState;
90 PeiCoreFileHandle =
NULL;
99 &gEfiPeiCoreFvLocationPpiGuid,
102 (VOID **)&PeiCoreFvLocationPpi
108 for (Index = 0; Index < PrivateData->FvCount; Index++) {
109 if (PrivateData->Fv[Index].FvHandle == PeiCoreFvLocationPpi->
PeiCoreFvLocation) {
110 PeiCoreFvIndex = Index;
115 ASSERT (Index < PrivateData->FvCount);
121 Status = PrivateData->Fv[PeiCoreFvIndex].FvPpi->FindFileByType (
122 PrivateData->Fv[PeiCoreFvIndex].FvPpi,
123 EFI_FV_FILETYPE_PEI_CORE,
124 PrivateData->Fv[PeiCoreFvIndex].FvHandle,
135 PEIM_STATE_REGISTER_FOR_SHADOW,
196 if (OldCoreData ==
NULL) {
201 PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;
202 CopyMem (&PrivateData.ServiceTableShadow, &
gPs, sizeof (
gPs));
207 if (OldCoreData->ShadowedPeiCore ==
NULL) {
211 OldCoreData->
Ps = &OldCoreData->ServiceTableShadow;
212 OldCoreData->CpuIo = &OldCoreData->ServiceTableShadow.CpuIo;
213 if (OldCoreData->HeapOffsetPositive) {
214 OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw + OldCoreData->HeapOffset);
236 for (Index = 0; Index < OldCoreData->
FvCount; Index++) {
237 if (OldCoreData->
Fv[Index].PeimState !=
NULL) {
238 OldCoreData->
Fv[Index].PeimState = (UINT8 *)OldCoreData->
Fv[Index].PeimState + OldCoreData->HeapOffset;
241 if (OldCoreData->
Fv[Index].FvFileHandles !=
NULL) {
242 OldCoreData->
Fv[Index].FvFileHandles = (
EFI_PEI_FILE_HANDLE *)((UINT8 *)OldCoreData->
Fv[Index].FvFileHandles + OldCoreData->HeapOffset);
246 OldCoreData->TempFileGuid = (
EFI_GUID *)((UINT8 *)OldCoreData->TempFileGuid + OldCoreData->HeapOffset);
247 OldCoreData->TempFileHandles = (
EFI_PEI_FILE_HANDLE *)((UINT8 *)OldCoreData->TempFileHandles + OldCoreData->HeapOffset);
249 OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw - OldCoreData->HeapOffset);
271 for (Index = 0; Index < OldCoreData->
FvCount; Index++) {
272 if (OldCoreData->
Fv[Index].PeimState !=
NULL) {
273 OldCoreData->
Fv[Index].PeimState = (UINT8 *)OldCoreData->
Fv[Index].PeimState - OldCoreData->HeapOffset;
276 if (OldCoreData->
Fv[Index].FvFileHandles !=
NULL) {
277 OldCoreData->
Fv[Index].FvFileHandles = (
EFI_PEI_FILE_HANDLE *)((UINT8 *)OldCoreData->
Fv[Index].FvFileHandles - OldCoreData->HeapOffset);
281 OldCoreData->TempFileGuid = (
EFI_GUID *)((UINT8 *)OldCoreData->TempFileGuid - OldCoreData->HeapOffset);
282 OldCoreData->TempFileHandles = (
EFI_PEI_FILE_HANDLE *)((UINT8 *)OldCoreData->TempFileHandles - OldCoreData->HeapOffset);
286 OldCoreData->DelayedDispatchTable =
NULL;
301 HandoffInformationTable = OldCoreData->HobList.HandoffInformationTable;
302 if (OldCoreData->HeapOffsetPositive) {
308 HandoffInformationTable->
EfiMemoryTop = OldCoreData->PhysicalMemoryBegin + OldCoreData->PhysicalMemoryLength;
309 HandoffInformationTable->
EfiMemoryBottom = OldCoreData->PhysicalMemoryBegin;
310 HandoffInformationTable->
EfiFreeMemoryTop = OldCoreData->FreePhysicalMemoryTop;
327 OldCoreData->PeiMemoryInstalled =
TRUE;
329 if (
PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
330 DEBUG ((DEBUG_VERBOSE,
"Early Migration - PPI lists before temporary RAM evacuation:\n"));
340 DEBUG ((DEBUG_VERBOSE,
"Early Migration - PPI lists after temporary RAM evacuation:\n"));
347 OldCoreData->PeimDispatcherReenter =
TRUE;
349 if ((
PcdGet64 (PcdLoadModuleAtFixAddressEnable) != 0) && (OldCoreData->HobList.HandoffInformationTable->
BootMode != BOOT_ON_S3_RESUME)) {
354 OldCoreData->PeiCodeMemoryRangeUsageBitMap =
AllocateZeroPool (((
PcdGet32 (PcdLoadFixAddressPeiCodePageNumber)>>6) + 1)*
sizeof (UINT64));
362 if (
PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes) ||
363 ((HandoffInformationTable->
BootMode == BOOT_ON_S3_RESUME) &&
PcdGetBool (PcdShadowPeimOnS3Boot)) ||
364 ((HandoffInformationTable->
BootMode != BOOT_ON_S3_RESUME) &&
PcdGetBool (PcdShadowPeimOnBoot)))
372 OldCoreData->ShadowedPeiCore (SecCoreData, PpiList, OldCoreData);
386 CopyMem (&NewSecCoreData, SecCoreDataPtr,
sizeof (NewSecCoreData));
387 SecCoreData = &NewSecCoreData;
389 CopyMem (&PrivateData, OldCoreData,
sizeof (PrivateData));
391 CpuIo = (VOID *)PrivateData.ServiceTableShadow.CpuIo;
392 PciCfg = (VOID *)PrivateData.ServiceTableShadow.PciCfg;
394 CopyMem (&PrivateData.ServiceTableShadow, &
gPs, sizeof (
gPs));
396 PrivateData.ServiceTableShadow.CpuIo = CpuIo;
397 PrivateData.ServiceTableShadow.PciCfg = PciCfg;
403 PrivateData.
Ps = &PrivateData.ServiceTableShadow;
423 if (OldCoreData ==
NULL) {
446 if (OldCoreData ==
NULL) {
458 if (PpiList !=
NULL) {
462 if (
PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
467 DEBUG ((DEBUG_VERBOSE,
"PPI lists before temporary RAM evacuation:\n"));
479 DEBUG ((DEBUG_VERBOSE,
"PPI lists after temporary RAM evacuation:\n"));
487 &gEfiTemporaryRamDonePpiGuid,
490 (VOID **)&TemporaryRamDonePpi
492 if (!EFI_ERROR (Status)) {
496 TemporaryRamDonePpi->TemporaryRamDone ();
518 if (PrivateData.HobList.HandoffInformationTable->
BootMode != BOOT_ON_S3_RESUME) {
522 ASSERT (PrivateData.PeiMemoryInstalled ==
TRUE);
537 (VOID **)&TempPtr.DxeIpl
541 if (EFI_ERROR (Status)) {
546 EFI_ERROR_CODE | EFI_ERROR_MAJOR,
547 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND)
555 DEBUG ((DEBUG_INFO,
"DXE IPL Entry\n"));
556 Status = TempPtr.DxeIpl->Entry (
VOID EFIAPI SetPeiServicesTablePointer(IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer)
CONST EFI_PEI_SERVICES **EFIAPI GetPeiServicesTablePointer(VOID)
VOID EFIAPI CpuDeadLoop(VOID)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EFIAPI PeiGetBootMode(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT EFI_BOOT_MODE *BootMode)
EFI_STATUS EFIAPI PeiSetBootMode(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_BOOT_MODE BootMode)
VOID InitializeImageServices(IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *OldCoreData)
EFI_STATUS PeiLoadImage(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_FILE_HANDLE FileHandle, IN UINT8 PeimState, OUT EFI_PHYSICAL_ADDRESS *EntryPoint, OUT UINT32 *AuthenticationState)
EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
VOID PeiDispatcher(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *Private)
VOID InitializeDispatcherData(IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *OldCoreData, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData)
EFI_STATUS EFIAPI PeiRegisterForShadow(IN EFI_PEI_FILE_HANDLE FileHandle)
EFI_STATUS EFIAPI EvacuateTempRam(IN PEI_CORE_INSTANCE *Private, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData)
EFI_STATUS EFIAPI PeiFfsGetVolumeInfo(IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo)
EFI_STATUS EFIAPI PeiFfsFindFileByName(IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
EFI_STATUS EFIAPI PeiFfsFindSectionData3(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData, OUT UINT32 *AuthenticationStatus)
EFI_STATUS EFIAPI PeiFfsGetFileInfo(IN EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_FV_FILE_INFO *FileInfo)
EFI_STATUS EFIAPI PeiFfsGetFileInfo2(IN EFI_PEI_FILE_HANDLE FileHandle, OUT EFI_FV_FILE_INFO2 *FileInfo)
EFI_STATUS EFIAPI PeiFfsFindNextVolume(IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Instance, IN OUT EFI_PEI_FV_HANDLE *VolumeHandle)
EFI_STATUS EFIAPI PeiFfsFindSectionData(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
EFI_STATUS EFIAPI PeiFfsFindNextFile(IN CONST EFI_PEI_SERVICES **PeiServices, IN UINT8 SearchType, IN EFI_PEI_FV_HANDLE FvHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
EFI_STATUS EFIAPI PeiGetHobList(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT VOID **HobList)
EFI_STATUS EFIAPI PeiCreateHob(IN CONST EFI_PEI_SERVICES **PeiServices, IN UINT16 Type, IN UINT16 Length, IN OUT VOID **Hob)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define REPORT_STATUS_CODE(Type, Value)
EFI_STATUS EFIAPI PeiInstallPeiMemory(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS MemoryBegin, IN UINT64 MemoryLength)
VOID ConvertMemoryAllocationHobs(IN PEI_CORE_INSTANCE *PrivateData)
EFI_STATUS EFIAPI PeiFreePages(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages)
EFI_STATUS EFIAPI PeiAllocatePages(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
VOID InitializeMemoryServices(IN PEI_CORE_INSTANCE *PrivateData, IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *OldCoreData)
EFI_STATUS EFIAPI PeiAllocatePool(IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Size, OUT VOID **Buffer)
#define PcdGet64(TokenName)
#define PcdGet32(TokenName)
#define PcdGetBool(TokenName)
VOID EFIAPI PeiCore(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreDataPtr, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, IN VOID *Data)
PEICORE_FUNCTION_POINTER ShadowPeiCore(IN PEI_CORE_INSTANCE *PrivateData)
EFI_STATUS EFIAPI PeiLocatePpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
VOID EFIAPI PeiResetSystem2(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
EFI_STATUS(EFIAPI * PEICORE_FUNCTION_POINTER)(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, IN PEI_CORE_INSTANCE *OldCoreData)
VOID InitializeSecurityServices(IN EFI_PEI_SERVICES **PeiServices, IN PEI_CORE_INSTANCE *OldCoreData)
EFI_STATUS EFIAPI PeiInstallPpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
VOID ProcessDispatchNotifyList(IN PEI_CORE_INSTANCE *PrivateData)
EFI_STATUS EFIAPI PeiReInstallPpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi)
EFI_STATUS EFIAPI PeiResetSystem(IN CONST EFI_PEI_SERVICES **PeiServices)
VOID DumpPpiList(IN PEI_CORE_INSTANCE *PrivateData)
VOID ConvertPpiPointers(IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, IN PEI_CORE_INSTANCE *PrivateData)
VOID ProcessPpiListFromSec(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
EFI_STATUS EFIAPI PeiNotifyPpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
EFI_STATUS EFIAPI PeiReportStatusCode(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL)
struct _EFI_PEI_SERVICES EFI_PEI_SERVICES
VOID(EFIAPI * EFI_PEI_COPY_MEM)(IN VOID *Destination, IN VOID *Source, IN UINTN Length)
#define PEI_SERVICES_REVISION
#define PEI_SERVICES_SIGNATURE
VOID * EFI_PEI_FILE_HANDLE
VOID(EFIAPI * EFI_PEI_SET_MEM)(IN VOID *Buffer, IN UINTN Size, IN UINT8 Value)
#define EFI_PROGRESS_CODE
UINT64 EFI_PHYSICAL_ADDRESS
PEI_CORE_UNKNOW_FORMAT_FV_INFO * UnknownFvInfo
EFI_PEI_FILE_HANDLE * CurrentFvFileHandles
EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom
EFI_PHYSICAL_ADDRESS EfiMemoryTop
EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop
EFI_PHYSICAL_ADDRESS EfiMemoryBottom
EFI_PHYSICAL_ADDRESS EfiEndOfHobList
PEI_PPI_LIST_POINTERS * NotifyPtrs
PEI_PPI_LIST_POINTERS * NotifyPtrs
PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
PEI_PPI_LIST_POINTERS * PpiPtrs