TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuFeaturesPei.c
Go to the documentation of this file.
1
9#include <PiPei.h>
10
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
15#include <Library/HobLib.h>
16
18
19EFI_PEI_PPI_DESCRIPTOR mPeiCpuFeaturesInitDonePpiDesc = {
20 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
21 &gEdkiiCpuFeaturesInitDoneGuid,
22 NULL
23};
24
37EFIAPI
39 IN EFI_PEI_FILE_HANDLE FileHandle,
40 IN CONST EFI_PEI_SERVICES **PeiServices
41 )
42{
43 EFI_STATUS Status;
44 EFI_BOOT_MODE BootMode;
45
46 Status = PeiServicesGetBootMode (&BootMode);
47 ASSERT_EFI_ERROR (Status);
48
49 if ((BootMode == BOOT_ON_S3_RESUME) &&
50 !PcdGetBool (PcdCpuFeaturesInitOnS3Resume))
51 {
52 //
53 // Does nothing when if PcdCpuFeaturesInitOnS3Resume is FLASE
54 // on S3 boot mode
55 //
56 return EFI_SUCCESS;
57 }
58
60
62
63 //
64 // Install CPU Features Init Done PPI
65 //
66 Status = PeiServicesInstallPpi (&mPeiCpuFeaturesInitDonePpiDesc);
67 ASSERT_EFI_ERROR (Status);
68
69 //
70 // Build HOB to let CpuFeatureDxe driver skip the initialization process.
71 //
72 BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid, 0);
73
74 return EFI_SUCCESS;
75}
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
Definition: HobLib.c:336
EFI_STATUS EFIAPI CpuFeaturesPeimInitialize(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
EFI_STATUS EFIAPI PeiServicesGetBootMode(OUT EFI_BOOT_MODE *BootMode)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
UINT32 EFI_BOOT_MODE
Definition: PiBootMode.h:18
VOID * EFI_PEI_FILE_HANDLE
Definition: PiPeiCis.h:26
VOID EFIAPI CpuFeaturesDetect(VOID)
VOID EFIAPI CpuFeaturesInitialize(VOID)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112