summaryrefslogtreecommitdiff
path: root/include/efi_loader.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-07-24 14:39:00 (GMT)
committerAlexander Graf <agraf@suse.de>2017-07-25 08:55:51 (GMT)
commit641833db4a3bc417e991e7d37ce7cb99657beee0 (patch)
treeb47e116b70e92f4155a55b0aeaed3992f2afdaa3 /include/efi_loader.h
parent804b1d737a366604eacd527ef9c5896a8a13b7f5 (diff)
downloadu-boot-fsl-qoriq-641833db4a3bc417e991e7d37ce7cb99657beee0.tar.xz
efi_loader: add helper macro to construct protocol objects
There are a bunch of protocols which should be exposed by GUID but are not. Add a helper macro to create an efi_object, to avoid much typing. Note that using the pointer for efiobj->handle is semi-arbitrary. We just need a unique value to match the efiobj supporting the protocol with the handle that LocateHandle() returns.. See LibLocateProtocol() in gnu-efi. It does LocateHandle() to find all the handles, and then loops over them calling HandleProtocol() with the GUID of the protocol it is trying to find. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include/efi_loader.h')
-rw-r--r--include/efi_loader.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 40f6c89..f384cbb 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -66,6 +66,14 @@ struct efi_object {
void *handle;
};
+#define EFI_PROTOCOL_OBJECT(_guid, _protocol) (struct efi_object){ \
+ .protocols = {{ \
+ .guid = &(_guid), \
+ .protocol_interface = (void *)(_protocol), \
+ }}, \
+ .handle = (void *)(_protocol), \
+}
+
/**
* struct efi_event
*