public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] efi_loader: add helper macro to construct protocol objects
Date: Mon, 24 Jul 2017 10:39:00 -0400	[thread overview]
Message-ID: <20170724143901.8888-2-robdclark@gmail.com> (raw)
In-Reply-To: <20170724143901.8888-1-robdclark@gmail.com>

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>
---
 include/efi_loader.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 27c741ba0c..51fbf23864 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -63,6 +63,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
  *
-- 
2.13.0

  reply	other threads:[~2017-07-24 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 14:38 [U-Boot] [PATCH] efi_loader: add back optional efi_handler::open() Rob Clark
2017-07-24 14:39 ` Rob Clark [this message]
2017-07-28 22:27   ` [U-Boot] [U-Boot, 1/2] efi_loader: add helper macro to construct protocol objects Alexander Graf
2017-07-24 14:39 ` [U-Boot] [PATCH 2/2] efi_loader: expose protocols via GUID Rob Clark
2017-07-28 22:25   ` [U-Boot] [U-Boot,2/2] " Alexander Graf
2017-07-25  8:52 ` [U-Boot] [PATCH] efi_loader: add back optional efi_handler::open() Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170724143901.8888-2-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox