All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/4] efi_loader: use efi_start_image() for bootefi
Date: Fri,  8 Feb 2019 19:46:49 +0100	[thread overview]
Message-ID: <20190208184650.22765-4-xypron.glpk@gmx.de> (raw)
In-Reply-To: <20190208184650.22765-1-xypron.glpk@gmx.de>

Remove the duplicate code in efi_do_enter() and use efi_start_image() to
start the image invoked by the bootefi command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2
	use EFI_CALL
---
 cmd/bootefi.c                 | 22 +---------------------
 include/efi_loader.h          |  4 ++++
 lib/efi_loader/efi_boottime.c |  6 +++---
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 7f9913c0ee..a2d38256e9 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -133,20 +133,6 @@ done:
 	return ret;
 }
 
-static efi_status_t efi_do_enter(
-			efi_handle_t image_handle, struct efi_system_table *st,
-			EFIAPI efi_status_t (*entry)(
-				efi_handle_t image_handle,
-				struct efi_system_table *st))
-{
-	efi_status_t ret = EFI_LOAD_ERROR;
-
-	if (entry)
-		ret = entry(image_handle, st);
-	st->boottime->exit(image_handle, ret, 0, NULL);
-	return ret;
-}
-
 /*
  * efi_carve_out_dt_rsv() - Carve out DT reserved memory ranges
  *
@@ -315,13 +301,7 @@ static efi_status_t do_bootefi_exec(void *efi,
 
 	/* Call our payload! */
 	debug("%s: Jumping to 0x%p\n", __func__, image_obj->entry);
-
-	if (setjmp(&image_obj->exit_jmp)) {
-		ret = image_obj->exit_status;
-		goto err_prepare;
-	}
-
-	ret = efi_do_enter(&image_obj->header, &systab, image_obj->entry);
+	ret = EFI_CALL(efi_start_image(&image_obj->header, NULL, NULL));
 
 err_prepare:
 	/* image has returned, loaded-image obj goes *poof*: */
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 3ce43f7a6f..512880ab8f 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -320,6 +320,10 @@ efi_status_t efi_create_handle(efi_handle_t *handle);
 void efi_delete_handle(efi_handle_t obj);
 /* Call this to validate a handle and find the EFI object for it */
 struct efi_object *efi_search_obj(const efi_handle_t handle);
+/* Start image */
+efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
+				    efi_uintn_t *exit_data_size,
+				    u16 **exit_data);
 /* Find a protocol on a handle */
 efi_status_t efi_search_protocol(const efi_handle_t handle,
 				 const efi_guid_t *protocol_guid,
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 7a61a905f4..6c4e2f82ba 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1770,9 +1770,9 @@ error:
  *
  * Return: status code
  */
-static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
-					   efi_uintn_t *exit_data_size,
-					   u16 **exit_data)
+efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
+				    efi_uintn_t *exit_data_size,
+				    u16 **exit_data)
 {
 	struct efi_loaded_image_obj *image_obj =
 		(struct efi_loaded_image_obj *)image_handle;
-- 
2.20.1

  parent reply	other threads:[~2019-02-08 18:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 18:46 [U-Boot] [PATCH v2 0/4] efi_loader: rework loading and starting of images Heinrich Schuchardt
2019-02-08 18:46 ` [U-Boot] [PATCH v2 1/4] efi_loader: LoadImage: always allocate new pages Heinrich Schuchardt
2019-02-08 18:46 ` [U-Boot] [PATCH v2 2/4] efi_loader: set entry point in efi_load_pe() Heinrich Schuchardt
2019-02-08 18:46 ` Heinrich Schuchardt [this message]
2019-07-18  6:00   ` [U-Boot] [PATCH v2 3/4] efi_loader: use efi_start_image() for bootefi Jonathan Gray
2019-07-18  8:39     ` Mark Kettenis
2019-07-18  9:16       ` Jonathan Gray
2019-07-18 17:33         ` Heinrich Schuchardt
2019-07-18 17:40           ` Alexander Graf
2019-07-18 17:45             ` Heinrich Schuchardt
2019-07-18 18:50           ` Alexander Graf
2019-07-18 23:07             ` Mark Kettenis
2019-07-19  5:43               ` Heinrich Schuchardt
2019-07-19  6:14                 ` Jonathan Gray
2019-07-19 17:52                   ` Heinrich Schuchardt
2019-07-19 18:36                     ` Heinrich Schuchardt
2019-02-08 18:46 ` [U-Boot] [PATCH v2 4/4] efi_loader: clean up bootefi_test_prepare() Heinrich Schuchardt

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=20190208184650.22765-4-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.