TianoCore EDK2 master
Loading...
Searching...
No Matches
HstiAip.c
Go to the documentation of this file.
1
8#include "HstiDxe.h"
9
36EFIAPI
39 IN EFI_GUID *InformationType,
40 OUT VOID **InformationBlock,
41 OUT UINTN *InformationBlockSize
42 )
43{
44 HSTI_AIP_PRIVATE_DATA *HstiAip;
45
46 if ((This == NULL) || (InformationBlock == NULL) || (InformationBlockSize == NULL)) {
47 return EFI_INVALID_PARAMETER;
48 }
49
50 if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) {
51 return EFI_UNSUPPORTED;
52 }
53
54 HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS (This);
55
56 *InformationBlock = AllocateCopyPool (HstiAip->HstiSize, HstiAip->Hsti);
57 if (*InformationBlock == NULL) {
58 return EFI_OUT_OF_RESOURCES;
59 }
60
61 *InformationBlockSize = HstiAip->HstiSize;
62 return EFI_SUCCESS;
63}
64
87EFIAPI
90 IN EFI_GUID *InformationType,
91 IN VOID *InformationBlock,
92 IN UINTN InformationBlockSize
93 )
94{
95 HSTI_AIP_PRIVATE_DATA *HstiAip;
96 VOID *NewHsti;
97
98 if ((This == NULL) || (InformationBlock == NULL)) {
99 return EFI_INVALID_PARAMETER;
100 }
101
102 if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) {
103 return EFI_UNSUPPORTED;
104 }
105
106 if (!InternalHstiIsValidTable (InformationBlock, InformationBlockSize)) {
107 return EFI_VOLUME_CORRUPTED;
108 }
109
110 HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS (This);
111
112 if (InformationBlockSize > HstiAip->HstiMaxSize) {
113 NewHsti = AllocateZeroPool (InformationBlockSize);
114 if (NewHsti == NULL) {
115 return EFI_OUT_OF_RESOURCES;
116 }
117
118 FreePool (HstiAip->Hsti);
119 HstiAip->Hsti = NewHsti;
120 HstiAip->HstiSize = 0;
121 HstiAip->HstiMaxSize = InformationBlockSize;
122 }
123
124 CopyMem (HstiAip->Hsti, InformationBlock, InformationBlockSize);
125 HstiAip->HstiSize = InformationBlockSize;
126 return EFI_SUCCESS;
127}
128
152EFIAPI
155 OUT EFI_GUID **InfoTypesBuffer,
156 OUT UINTN *InfoTypesBufferCount
157 )
158{
159 if ((This == NULL) || (InfoTypesBuffer == NULL) || (InfoTypesBufferCount == NULL)) {
160 return EFI_INVALID_PARAMETER;
161 }
162
163 *InfoTypesBuffer = AllocateCopyPool (sizeof (gAdapterInfoPlatformSecurityGuid), &gAdapterInfoPlatformSecurityGuid);
164 if (*InfoTypesBuffer == NULL) {
165 return EFI_OUT_OF_RESOURCES;
166 }
167
168 *InfoTypesBufferCount = 1;
169
170 return EFI_SUCCESS;
171}
172
173EFI_ADAPTER_INFORMATION_PROTOCOL mAdapterInformationProtocol = {
177};
UINT64 UINTN
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI HstiAipGetSupportedTypes(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, OUT EFI_GUID **InfoTypesBuffer, OUT UINTN *InfoTypesBufferCount)
Definition: HstiAip.c:153
EFI_STATUS EFIAPI HstiAipGetInfo(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, IN EFI_GUID *InformationType, OUT VOID **InformationBlock, OUT UINTN *InformationBlockSize)
Definition: HstiAip.c:37
EFI_STATUS EFIAPI HstiAipSetInfo(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, IN EFI_GUID *InformationType, IN VOID *InformationBlock, IN UINTN InformationBlockSize)
Definition: HstiAip.c:88
BOOLEAN InternalHstiIsValidTable(IN VOID *HstiData, IN UINTN HstiSize)
Definition: HstiDxe.c:151
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
Definition: Base.h:213