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 1/3] efi_loader: Add an EFI_CALL() macro
Date: Wed, 26 Jul 2017 22:15:58 +0200	[thread overview]
Message-ID: <fbc242ae-046b-85e7-8f00-9809b049ca77@gmx.de> (raw)
In-Reply-To: <20170726135559.16653-1-robdclark@gmail.com>

On 07/26/2017 03:55 PM, Rob Clark wrote:
> Rather than open-coding EFI_EXIT() + callback + EFI_ENTRY(), introduce
> an EFI_CALL() macro.  This makes callbacks into UEFI world (of which
> there will be more in the future) more concise and easier to locate in
> the code.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  include/efi_loader.h          | 17 +++++++++++++++++
>  lib/efi_loader/efi_boottime.c |  4 +---
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index f384cbbe77..09bab7dbc6 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -15,16 +15,33 @@
>  
>  #include <linux/list.h>
>  
> +/*
> + * Enter the u-boot world from UEFI:
> + */
>  #define EFI_ENTRY(format, ...) do { \
>  	efi_restore_gd(); \
>  	debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
>  	} while(0)
>  
> +/*
> + * Exit the u-boot world back to UEFI:
> + */
>  #define EFI_EXIT(ret) ({ \
>  	debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & ~EFI_ERROR_MASK)); \
>  	efi_exit_func(ret); \
>  	})
>  
> +/*
> + * Callback into UEFI world from u-boot:
> + */
> +#define EFI_CALL(exp) do { \
> +	debug("EFI: Call: %s\n", #exp); \
> +	efi_exit_func(EFI_SUCCESS); \
> +	exp; \
> +	efi_restore_gd(); \
> +	debug("EFI: Return From: %s\n", #exp); \
> +	} while(0)
> +
>  extern struct efi_runtime_services efi_runtime_services;
>  extern struct efi_system_table systab;
>  
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 9a1a93fade..76cafffc1d 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -120,9 +120,7 @@ void efi_signal_event(struct efi_event *event)
>  		return;
>  	event->signaled = 1;
>  	if (event->type & EVT_NOTIFY_SIGNAL) {
> -		EFI_EXIT(EFI_SUCCESS);
> -		event->notify_function(event, event->notify_context);
> -		EFI_ENTRY("returning from notification function");
> +		EFI_CALL(event->notify_function(event, event->notify_context));
>  	}
>  }
>  
> 

Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

      parent reply	other threads:[~2017-07-26 20:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 13:55 [U-Boot] [PATCH 1/3] efi_loader: Add an EFI_CALL() macro Rob Clark
2017-07-26 13:55 ` [U-Boot] [PATCH 2/3] efi_loader: add checking for incorrect use of EFI_ENTRY/EXIT Rob Clark
2017-07-26 15:25   ` Alexander Graf
2017-07-26 16:41     ` Rob Clark
2017-07-26 20:12       ` Alexander Graf
2017-07-26 20:55         ` Rob Clark
2017-07-26 20:16   ` Heinrich Schuchardt
2017-07-26 13:55 ` [U-Boot] [PATCH 3/3] efi_loader: indent entry/exit prints to show nesting level Rob Clark
2017-07-26 15:36   ` Alexander Graf
2017-07-26 20:16   ` Heinrich Schuchardt
2017-07-26 20:15 ` Heinrich Schuchardt [this message]

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=fbc242ae-046b-85e7-8f00-9809b049ca77@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.