17#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]"
43 DEBUG ((DEBUG_INFO,
" %a %a - Entry.\n", _DBGMSGID_, __func__));
45 if ((HandlerGuid ==
NULL) || (ModuleContextBuffers ==
NULL) || (ContextBuffer ==
NULL)) {
46 return EFI_INVALID_PARAMETER;
49 for (Index = 0; Index < ModuleContextBuffers->BufferCount; Index++) {
50 if (
CompareGuid (&ModuleContextBuffers->Buffer[Index].HandlerGuid, HandlerGuid)) {
51 *ContextBuffer = &ModuleContextBuffers->Buffer[Index];
92 DEBUG ((DEBUG_INFO,
" %a %a - Entry.\n", _DBGMSGID_, __func__));
94 if ((Guid ==
NULL) || (PrmModuleContextBuffers ==
NULL)) {
95 return EFI_INVALID_PARAMETER;
98 *PrmModuleContextBuffers =
NULL;
100 Status =
gBS->LocateHandleBuffer (
102 &gPrmConfigProtocolGuid,
107 if (!EFI_ERROR (Status)) {
108 for (Index = 0; Index < HandleCount; Index++) {
109 Status =
gBS->HandleProtocol (
111 &gPrmConfigProtocolGuid,
112 (VOID **)&PrmConfigProtocol
115 if (EFI_ERROR (Status) || (PrmConfigProtocol ==
NULL)) {
120 if (
CompareGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, Guid)) {
123 " %a %a: Found a PRM configuration protocol for PRM module %g.\n",
129 *PrmModuleContextBuffers = &PrmConfigProtocol->ModuleContextBuffers;
134 if (!EFI_ERROR (Status)) {
135 *PrmModuleContextBuffers = &PrmConfigProtocol->ModuleContextBuffers;
144 " %a %a: Could not locate a PRM configuration protocol for PRM handler %g.\n",
150 return EFI_NOT_FOUND;
179 DEBUG ((DEBUG_INFO,
" %a %a - Entry.\n", _DBGMSGID_, __func__));
181 if ((PrmHandlerGuid ==
NULL) || (PrmContextBuffer ==
NULL)) {
182 return EFI_INVALID_PARAMETER;
185 *PrmContextBuffer =
NULL;
187 if (PrmModuleContextBuffers ==
NULL) {
189 if (EFI_ERROR (Status)) {
190 return EFI_NOT_FOUND;
193 ContextBuffers = PrmModuleContextBuffers;
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
EFI_STATUS FindContextBufferInModuleBuffers(IN CONST EFI_GUID *HandlerGuid, IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers, OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer)
EFI_STATUS GetContextBuffer(IN CONST EFI_GUID *PrmHandlerGuid, IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL, OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer)
EFI_STATUS GetModuleContextBuffers(IN PRM_GUID_SEARCH_TYPE GuidSearchType, IN CONST EFI_GUID *Guid, OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)