TianoCore EDK2 master
Loading...
Searching...
No Matches
Tcg2PlatformPei.c
Go to the documentation of this file.
1
10#include <PiPei.h>
12#include <Library/DebugLib.h>
15#include <Library/HobLib.h>
19#include <Library/RngLib.h>
20
21#include <Ppi/EndOfPeiPhase.h>
22
23#define MAX_NEW_AUTHORIZATION_SIZE SHA512_DIGEST_SIZE
24
37EFIAPI
39 IN CONST EFI_PEI_SERVICES **PeiServices,
40 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
41 IN VOID *Ppi
42 )
43{
44 VOID *TcgEventLog;
45
46 //
47 // Try to get TcgEventLog in S3 to see if S3 error is reported.
48 //
49 TcgEventLog = GetFirstGuidHob (&gTcgEventEntryHobGuid);
50 if (TcgEventLog == NULL) {
51 TcgEventLog = GetFirstGuidHob (&gTcgEvent2EntryHobGuid);
52 }
53
54 if (TcgEventLog == NULL) {
55 //
56 // no S3 error reported
57 //
58 return EFI_SUCCESS;
59 }
60
61 //
62 // If there is S3 error on TPM_SU_STATE and success on TPM_SU_CLEAR,
63 // configure the TPM Platform Hierarchy.
64 //
66
67 return EFI_SUCCESS;
68}
69
70static EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList = {
71 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
72 &gEfiEndOfPeiSignalPpiGuid,
74};
75
86EFIAPI
88 IN EFI_PEI_FILE_HANDLE FileHandle,
89 IN CONST EFI_PEI_SERVICES **PeiServices
90 )
91{
92 EFI_STATUS Status;
93 EFI_BOOT_MODE BootMode;
94
95 Status = PeiServicesGetBootMode (&BootMode);
96 ASSERT_EFI_ERROR (Status);
97
98 if (BootMode != BOOT_ON_S3_RESUME) {
99 return EFI_SUCCESS;
100 }
101
102 //
103 // Performing PlatformInitEndOfPei after EndOfPei PPI produced
104 //
105 Status = PeiServicesNotifyPpi (&mEndOfPeiNotifyList);
106
107 return Status;
108}
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
EFI_STATUS EFIAPI PeiServicesGetBootMode(OUT EFI_BOOT_MODE *BootMode)
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
#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
VOID EFIAPI ConfigureTpmPlatformHierarchy()
UINT32 EFI_BOOT_MODE
Definition: PiBootMode.h:18
VOID * EFI_PEI_FILE_HANDLE
Definition: PiPeiCis.h:26
EFI_STATUS(EFIAPI * EFI_PEIM_NOTIFY_ENTRY_POINT)(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
Definition: PiPeiCis.h:71
EFI_STATUS EFIAPI PlatformInitEndOfPei(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
EFI_STATUS EFIAPI Tcg2PlatformPeiEntryPoint(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112