TianoCore EDK2 master
Loading...
Searching...
No Matches
FspWrapperPlatformSecLibSample.c
Go to the documentation of this file.
1
9#include <PiPei.h>
10
12#include <Ppi/SecPerformance.h>
13
15#include <Library/DebugLib.h>
17
30EFIAPI
32 IN CONST EFI_PEI_SERVICES **PeiServices,
33 IN OUT UINT64 *StructureSize,
34 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
35 );
36
54EFIAPI
56 IN CONST EFI_PEI_SERVICES **PeiServices,
58 OUT FIRMWARE_SEC_PERFORMANCE *Performance
59 );
60
61PEI_SEC_PERFORMANCE_PPI mSecPerformancePpi = {
63};
64
65EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] = {
66 {
67 EFI_PEI_PPI_DESCRIPTOR_PPI,
68 &gTopOfTemporaryRamPpiGuid,
69 NULL // To be patched later.
70 },
71 {
72 EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
73 &gPeiSecPerformancePpiGuid,
74 &mSecPerformancePpi
75 },
76};
77
96EFIAPI
98 IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData
99 )
100{
101 EFI_PEI_PPI_DESCRIPTOR *PpiList;
102
103 DEBUG ((DEBUG_INFO, "SecPlatformMain\n"));
104
105 DEBUG ((DEBUG_INFO, "BootFirmwareVolumeBase - 0x%x\n", SecCoreData->BootFirmwareVolumeBase));
106 DEBUG ((DEBUG_INFO, "BootFirmwareVolumeSize - 0x%x\n", SecCoreData->BootFirmwareVolumeSize));
107 DEBUG ((DEBUG_INFO, "TemporaryRamBase - 0x%x\n", SecCoreData->TemporaryRamBase));
108 DEBUG ((DEBUG_INFO, "TemporaryRamSize - 0x%x\n", SecCoreData->TemporaryRamSize));
109 DEBUG ((DEBUG_INFO, "PeiTemporaryRamBase - 0x%x\n", SecCoreData->PeiTemporaryRamBase));
110 DEBUG ((DEBUG_INFO, "PeiTemporaryRamSize - 0x%x\n", SecCoreData->PeiTemporaryRamSize));
111 DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", SecCoreData->StackBase));
112 DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", SecCoreData->StackSize));
113
114 InitializeApicTimer (0, (UINT32)-1, TRUE, 5);
115
116 //
117 // Use middle of Heap as temp buffer, it will be copied by caller.
118 // Do not use Stack, because it will cause wrong calculation on stack by PeiCore
119 //
120 PpiList = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + (UINTN)SecCoreData->PeiTemporaryRamSize/2);
121 CopyMem (PpiList, mPeiSecPlatformPpi, sizeof (mPeiSecPlatformPpi));
122
123 //
124 // Patch TopOfTemporaryRamPpi
125 //
126 PpiList[0].Ppi = (VOID *)((UINTN)SecCoreData->TemporaryRamBase + SecCoreData->TemporaryRamSize);
127
128 return PpiList;
129}
UINT64 UINTN
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_PEI_PPI_DESCRIPTOR *EFIAPI SecPlatformMain(IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData)
EFI_STATUS EFIAPI SecGetPerformance(IN CONST EFI_PEI_SERVICES **PeiServices, IN PEI_SEC_PERFORMANCE_PPI *This, OUT FIRMWARE_SEC_PERFORMANCE *Performance)
EFI_STATUS EFIAPI SecPlatformInformation(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT UINT64 *StructureSize, OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord)
VOID EFIAPI InitializeApicTimer(IN UINTN DivideValue, IN UINT32 InitCount, IN BOOLEAN PeriodicMode, IN UINT8 Vector)
Definition: BaseXApicLib.c:732
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29