public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_loader: allow efi_loader code to call EFI interfaces
@ 2017-07-24 23:47 Rob Clark
  2017-07-25  8:10 ` Alexander Graf
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Clark @ 2017-07-24 23:47 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-07-25 22:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 23:47 [U-Boot] [PATCH] efi_loader: allow efi_loader code to call EFI interfaces Rob Clark
2017-07-25  8:10 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox