-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProtocol.c
49 lines (44 loc) · 1023 Bytes
/
Protocol.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <Protocol.h>
EFI_STATUS getHandleByProtocol(
IN EFI_HANDLE imageHandle,
IN EFI_GUID *type,
OUT EFI_HANDLE **handleBuffer)
{
UINTN no_handle = 0;
EFI_STATUS status = gBS->LocateHandleBuffer(
ByProtocol, //通过Protocol
type, // GUID
NULL,
&no_handle,
handleBuffer);
#ifdef LOG
if (EFI_ERROR(status))
{
Print(L"Faild to LocateHandleBuffer.err = %d\n", status);
}
#endif ///*define*/
return status;
}
EFI_STATUS openHandleByBuffer(
IN EFI_HANDLE imageHandle,
IN EFI_HANDLE buffer,
IN EFI_GUID *type,
OUT void **handle
)
{
EFI_STATUS status = gBS->OpenProtocol(
buffer,
type,
handle,
imageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
#ifdef LOG
if (EFI_ERROR(status))
{
Print(L"buffer count buffer=%d", sizeof(buffer));
Print(L"Faild to open&getHandle err code=%d\n", status);
}
#endif
return status;
}