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 2/2] efi_loader: expose protocols via GUID
Date: Mon, 24 Jul 2017 10:39:01 -0400	[thread overview]
Message-ID: <20170724143901.8888-3-robdclark@gmail.com> (raw)
In-Reply-To: <20170724143901.8888-1-robdclark@gmail.com>

shim.efi (or rather gnu-efi's LibLocateProtocol() which shim.efi uses)
resolves protocols via efi_locate_handle() so the console protocols
need to be added to the efi object list.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/efi_api.h            |  9 +++++++++
 include/efi_loader.h         |  1 +
 lib/efi_loader/efi_console.c | 15 ++++++++++++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 2c443080b6..d8fecb6980 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -393,6 +393,11 @@ struct simple_text_output_mode {
 	bool cursor_visible;
 };
 
+
+#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
+	EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
+		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
+
 struct efi_simple_text_output_protocol {
 	void *reset;
 	efi_status_t (EFIAPI *output_string)(
@@ -427,6 +432,10 @@ struct efi_input_key {
 	s16 unicode_char;
 };
 
+#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
+	EFI_GUID(0x387477c1, 0x69c7, 0x11d2, \
+		 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
+
 struct efi_simple_input_interface {
 	efi_status_t(EFIAPI *reset)(struct efi_simple_input_interface *this,
 			bool ExtendedVerification);
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 51fbf23864..48eeb4cdd8 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -109,6 +109,7 @@ int efi_net_register(void **handle);
 /* Called by bootefi to make SMBIOS tables available */
 void efi_smbios_register(void);
 
+
 /* Called by networking code to memorize the dhcp ack package */
 void efi_net_set_dhcp_ack(void *pkt, int len);
 
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index dbe98ac08b..ba0a8b90cd 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -426,7 +426,6 @@ struct efi_simple_input_interface efi_con_in = {
 	.read_key_stroke = efi_cin_read_key_stroke,
 	.wait_for_key = NULL,
 };
-
 static struct efi_event *console_timer_event;
 
 static void efi_key_notify(struct efi_event *event, void *context)
@@ -441,10 +440,24 @@ static void efi_console_timer_notify(struct efi_event *event, void *context)
 	EFI_EXIT(EFI_SUCCESS);
 }
 
+
+static struct efi_object efi_console_control_obj =
+	EFI_PROTOCOL_OBJECT(efi_guid_console_control, &efi_console_control);
+static struct efi_object efi_console_output_obj =
+	EFI_PROTOCOL_OBJECT(EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, &efi_con_out);
+static struct efi_object efi_console_input_obj =
+	EFI_PROTOCOL_OBJECT(EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, &efi_con_in);
+
 /* This gets called from do_bootefi_exec(). */
 int efi_console_register(void)
 {
 	efi_status_t r;
+
+	/* Hook up to the device list */
+	list_add_tail(&efi_console_control_obj.link, &efi_obj_list);
+	list_add_tail(&efi_console_output_obj.link, &efi_obj_list);
+	list_add_tail(&efi_console_input_obj.link, &efi_obj_list);
+
 	r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK,
 			     efi_key_notify, NULL, &efi_con_in.wait_for_key);
 	if (r != EFI_SUCCESS) {
-- 
2.13.0

  parent 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 ` [U-Boot] [PATCH 1/2] efi_loader: add helper macro to construct protocol objects Rob Clark
2017-07-28 22:27   ` [U-Boot] [U-Boot, " Alexander Graf
2017-07-24 14:39 ` Rob Clark [this message]
2017-07-28 22:25   ` [U-Boot] [U-Boot,2/2] efi_loader: expose protocols via GUID 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-3-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