summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-09-15 10:06:10 +0200
committerAlexander Graf <agraf@suse.de>2017-09-18 23:53:56 +0200
commitea630ce9eae4858a2108bd019a6ef22e2bc1b3f6 (patch)
tree38f01f98e68db51b22c65868450cddb0cf864235 /include
parent29f1a3670e25d4778c1a066ae2a90186e6ce8e95 (diff)
efi_loader: allow return value in EFI_CALL
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. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/efi_loader.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 46d684f6df..f27192555e 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -42,9 +42,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; \