Re: [U-Boot] [PATCH 01/23] efi_loader: allow return value in EFI_CALL

2017-09-04 Thread Simon Glass
Hi Alex,

On 31 August 2017 at 21:58, Alexander Graf  wrote:
>
> On 08/31/2017 02:51 PM, Simon Glass wrote:
>>
>> On 27 August 2017 at 06:51, Heinrich Schuchardt  wrote:
>>>
>>> Macro EFI_CALL was introduced to call an UEFI function.
>>
>> Should this be 'an EFI'. Or 'a UEFI'?
>
>
> In a nutshell, EFI is the v1, proprietary, for pay, closed protocol while 
> UEFI is v2 and what edk2 implements, what you can get specs for, etc. But 
> since people started implementing things for v1 back in the day and they are 
> reasonable compatible, nobody calls UEFI UEFI, but just EFI :).
>
> It's a mess and I certainly didn't help it by calling everything EFI, but 
> it's what we're in and we should rather stay coherent IMHO. So EFI_CALL 
> really does call UEFI functions ;).

OK that's fine. Using EFI consistently seems like a good idea.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/23] efi_loader: allow return value in EFI_CALL

2017-08-31 Thread Alexander Graf

On 08/31/2017 02:51 PM, Simon Glass wrote:

On 27 August 2017 at 06:51, Heinrich Schuchardt  wrote:

Macro EFI_CALL was introduced to call an UEFI function.

Should this be 'an EFI'. Or 'a UEFI'?


In a nutshell, EFI is the v1, proprietary, for pay, closed protocol 
while UEFI is v2 and what edk2 implements, what you can get specs for, 
etc. But since people started implementing things for v1 back in the day 
and they are reasonable compatible, nobody calls UEFI UEFI, but just EFI :).


It's a mess and I certainly didn't help it by calling everything EFI, 
but it's what we're in and we should rather stay coherent IMHO. So 
EFI_CALL really does call UEFI functions ;).



Alex

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/23] efi_loader: allow return value in EFI_CALL

2017-08-31 Thread Simon Glass
On 27 August 2017 at 06:51, Heinrich Schuchardt  wrote:
> Macro EFI_CALL was introduced to call an UEFI function.

Should this be 'an EFI'. Or 'a UEFI'?

> Unfortunately it does not support return values.
> Most UEFI functions have a return value.
>
> So let's rename EFI_CALL to EFI_CALL_VOID and introduce a
> new EFI_CALL macro that supports return values.
>
> Cc: Rob Clark 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/efi_loader.h  | 17 +++--
>  lib/efi_loader/efi_boottime.c |  3 ++-
>  2 files changed, 17 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 01/23] efi_loader: allow return value in EFI_CALL

2017-08-26 Thread Heinrich Schuchardt
Macro EFI_CALL was introduced to call an UEFI function.
Unfortunately it does not support return values.
Most UEFI functions have a return value.

So let's rename EFI_CALL to EFI_CALL_VOID and introduce a
new EFI_CALL macro that supports return values.

Cc: Rob Clark 
Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h  | 17 +++--
 lib/efi_loader/efi_boottime.c |  3 ++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 1179234f68..6f71a6202b 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -41,9 +41,22 @@ const char *__efi_nesting_dec(void);
})
 
 /*
- * Callback into UEFI world from u-boot:
+ * Call non-void UEFI function from u-boot and retrieve return value:
  */
-#define EFI_CALL(exp) do { \
+#define EFI_CALL(exp) ({ \
+   debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
+   assert(__efi_exit_check()); \
+   typeof(exp) _r = exp; \
+   assert(__efi_entry_check()); \
+   debug("%sEFI: %lu returned by %s\n", __efi_nesting_dec(), \
+ (unsigned long)((uintptr_t)_r & ~EFI_ERROR_MASK), #exp); \
+   _r; \
+})
+
+/*
+ * Call void UEFI function from u-boot:
+ */
+#define EFI_CALL_VOID(exp) do { \
debug("%sEFI: Call: %s\n", __efi_nesting_inc(), #exp); \
assert(__efi_exit_check()); \
exp; \
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index ea953dca82..ab26e2989b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -158,7 +158,8 @@ void efi_signal_event(struct efi_event *event)
return;
event->signaled = 1;
if (event->type & EVT_NOTIFY_SIGNAL) {
-   EFI_CALL(event->notify_function(event, event->notify_context));
+   EFI_CALL_VOID(event->notify_function(event,
+event->notify_context));
}
 }
 
-- 
2.14.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot