提交 a095aadf 编写于 作者: R Rob Clark 提交者: Alexander Graf

efi_loader: Add an EFI_CALL() macro

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: NRob Clark <robdclark@gmail.com>
Signed-off-by: NAlexander Graf <agraf@suse.de>
上级 3f1aa975
...@@ -15,17 +15,34 @@ ...@@ -15,17 +15,34 @@
#include <linux/list.h> #include <linux/list.h>
/*
* Enter the u-boot world from UEFI:
*/
#define EFI_ENTRY(format, ...) do { \ #define EFI_ENTRY(format, ...) do { \
efi_restore_gd(); \ efi_restore_gd(); \
debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \ debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
} while(0) } while(0)
/*
* Exit the u-boot world back to UEFI:
*/
#define EFI_EXIT(ret) ({ \ #define EFI_EXIT(ret) ({ \
efi_status_t _r = ret; \ efi_status_t _r = ret; \
debug("EFI: Exit: %s: %u\n", __func__, (u32)(_r & ~EFI_ERROR_MASK)); \ debug("EFI: Exit: %s: %u\n", __func__, (u32)(_r & ~EFI_ERROR_MASK)); \
efi_exit_func(_r); \ efi_exit_func(_r); \
}) })
/*
* 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_runtime_services efi_runtime_services;
extern struct efi_system_table systab; extern struct efi_system_table systab;
......
...@@ -120,9 +120,7 @@ void efi_signal_event(struct efi_event *event) ...@@ -120,9 +120,7 @@ void efi_signal_event(struct efi_event *event)
return; return;
event->signaled = 1; event->signaled = 1;
if (event->type & EVT_NOTIFY_SIGNAL) { if (event->type & EVT_NOTIFY_SIGNAL) {
EFI_EXIT(EFI_SUCCESS); EFI_CALL(event->notify_function(event, event->notify_context));
event->notify_function(event, event->notify_context);
EFI_ENTRY("returning from notification function");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册