TianoCore EDK2 master
Loading...
Searching...
No Matches
ThunkPpiList.c
Go to the documentation of this file.
1
11#include <PiPei.h>
12#include <Library/BaseLib.h>
14
15UINTN gThunkPpiListSize = 0;
16EFI_PEI_PPI_DESCRIPTOR *gThunkPpiList = NULL;
17
19GetThunkPpiList (
20 VOID
21 )
22{
23 UINTN Index;
24
25 if (gThunkPpiList == NULL) {
26 return NULL;
27 }
28
29 Index = (gThunkPpiListSize/sizeof (EFI_PEI_PPI_DESCRIPTOR)) - 1;
30 gThunkPpiList[Index].Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
31
32 return gThunkPpiList;
33}
34
36EFIAPI
37AddThunkPpi (
38 IN UINTN Flags,
39 IN EFI_GUID *Guid,
40 IN VOID *Ppi
41 )
42{
43 UINTN Index;
44
45 gThunkPpiList = ReallocatePool (
46 gThunkPpiListSize,
47 gThunkPpiListSize + sizeof (EFI_PEI_PPI_DESCRIPTOR),
48 gThunkPpiList
49 );
50 if (gThunkPpiList == NULL) {
51 return EFI_OUT_OF_RESOURCES;
52 }
53
54 Index = (gThunkPpiListSize/sizeof (EFI_PEI_PPI_DESCRIPTOR));
55 gThunkPpiList[Index].Flags = Flags;
56 gThunkPpiList[Index].Guid = Guid;
57 gThunkPpiList[Index].Ppi = Ppi;
58 gThunkPpiListSize += sizeof (EFI_PEI_PPI_DESCRIPTOR);
59
60 return EFI_SUCCESS;
61}
UINT64 UINTN
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
Definition: Base.h:213