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] efi_loader: allow efi_loader code to call EFI interfaces
Date: Mon, 24 Jul 2017 19:47:02 -0400	[thread overview]
Message-ID: <20170724234702.18500-1-robdclark@gmail.com> (raw)

To implement efi_load_image() for the case of loading an image from a
device path rather than image already loaded into source_buffer, it is
convenient to be able to re-use simple-file-system and efi-file
interfaces.  But these are already using EFI_ENTER()/EFI_EXIT().  Allow
entry into EFI interfaces to be recursive, since this greatly simplifies
things.

(And hypothetically this would be needed anyways to allow grub to call
into interfaces installed by something outside of grub.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 lib/efi_loader/efi_boottime.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 8735b1f418..a113124708 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -47,6 +47,7 @@ static struct efi_configuration_table __efi_runtime_data efi_conf_table[2];
  * EFI callback entry/exit.
  */
 static volatile void *efi_gd, *app_gd;
+static int entry_level = 0;
 #endif
 
 /* Called from do_bootefi_exec() */
@@ -61,6 +62,8 @@ void efi_save_gd(void)
 void efi_restore_gd(void)
 {
 #ifdef CONFIG_ARM
+	if (entry_level++)
+		return;
 	/* Only restore if we're already in EFI context */
 	if (!efi_gd)
 		return;
@@ -75,6 +78,8 @@ void efi_restore_gd(void)
 efi_status_t efi_exit_func(efi_status_t ret)
 {
 #ifdef CONFIG_ARM
+	if (--entry_level)
+		return ret;
 	gd = app_gd;
 #endif
 
-- 
2.13.0

             reply	other threads:[~2017-07-24 23:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 23:47 Rob Clark [this message]
2017-07-25  8:10 ` [U-Boot] [PATCH] efi_loader: allow efi_loader code to call EFI interfaces Alexander Graf
2017-07-25 11:10   ` Rob Clark
2017-07-25 11:17     ` Alexander Graf
2017-07-25 12:08       ` Rob Clark
2017-07-25 12:16         ` Alexander Graf
2017-07-25 12:28           ` Rob Clark
2017-07-25 14:28             ` Alexander Graf
2017-07-25 16:18               ` Rob Clark
2017-07-25 17:04                 ` Alexander Graf
2017-07-25 16:56               ` Heinrich Schuchardt
2017-07-25 17:52                 ` Rob Clark
2017-07-25 19:12                   ` Heinrich Schuchardt
2017-07-25 19:42                     ` Rob Clark
2017-07-25 21:01                       ` Heinrich Schuchardt
2017-07-25 21:26                         ` Rob Clark
2017-07-25 21:42                           ` Alexander Graf
2017-07-25 22:01                             ` Rob Clark
2017-07-25 22:10                               ` Alexander Graf
2017-07-25 22:40                                 ` Rob Clark

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=20170724234702.18500-1-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