Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 0dcf7d7

Browse files
libefiwrapper/protocol: add LocateProtocol() support
Change-Id: Id005005305a417cb33801527b011514a3d0169e5 Signed-off-by: Jeremy Compostella <[email protected]>
1 parent b1051b6 commit 0dcf7d7

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

libefiwrapper/protocol.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Intel Corporation
2+
* Copyright (c) 2016-2020, Intel Corporation
33
* All rights reserved.
44
*
55
* Author: Jérémy Compostella <[email protected]>
@@ -349,11 +349,26 @@ locate_handle_buffer(EFI_LOCATE_SEARCH_TYPE SearchType,
349349
}
350350

351351
static EFIAPI EFI_STATUS
352-
locate_protocol(__attribute__((__unused__)) EFI_GUID *Protocol,
352+
locate_protocol(EFI_GUID *Protocol,
353353
__attribute__((__unused__)) VOID *Registration,
354-
__attribute__((__unused__)) VOID **Interface)
354+
VOID **Interface)
355355
{
356-
return EFI_UNSUPPORTED;
356+
interface_t *inte;
357+
size_t i;
358+
359+
if (!Interface)
360+
return EFI_INVALID_PARAMETER;
361+
362+
for (i = 0; i < ARRAY_SIZE(INTERFACES); i++) {
363+
inte = &INTERFACES[i];
364+
if (inte->installed &&
365+
!guidcmp(&inte->protocol, Protocol)) {
366+
*Interface = inte->interface;
367+
return EFI_SUCCESS;
368+
}
369+
}
370+
371+
return EFI_NOT_FOUND;
357372
}
358373

359374
EFI_STATUS protocol_init_bs(EFI_BOOT_SERVICES *bs)

0 commit comments

Comments
 (0)