diff options
author | Alexander Graf <agraf@suse.de> | 2016-03-04 01:10:01 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-03-15 18:03:10 -0400 |
commit | 50149ea37a21dcbed675297f1536c31a7db39c19 (patch) | |
tree | d6a18d12c1306cbc1306baed0aeea5ff2f5d2ae4 /include/efi_loader.h | |
parent | c1311ad4e0d1759788601513fac0f65620d40472 (diff) |
efi_loader: Add runtime services
After booting has finished, EFI allows firmware to still interact with the OS
using the "runtime services". These callbacks live in a separate address space,
since they are available long after U-Boot has been overwritten by the OS.
This patch adds enough framework for arbitrary code inside of U-Boot to become
a runtime service with the right section attributes set. For now, we don't make
use of it yet though.
We could maybe in the future map U-boot environment variables to EFI variables
here.
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/efi_loader.h')
-rw-r--r-- | include/efi_loader.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/efi_loader.h b/include/efi_loader.h index d9e9d8fa7b..8b3aaddd59 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -30,6 +30,7 @@ #define EFI_EXIT(ret) efi_exit_func(ret); +extern struct efi_runtime_services efi_runtime_services; extern struct efi_system_table systab; extern const struct efi_simple_text_output_protocol efi_con_out; @@ -40,6 +41,9 @@ extern const efi_guid_t efi_guid_console_control; extern const efi_guid_t efi_guid_device_path; extern const efi_guid_t efi_guid_loaded_image; +extern unsigned int __efi_runtime_start, __efi_runtime_stop; +extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; + /* * While UEFI objects can have callbacks, you can also call functions on * protocols (classes) themselves. This struct maps a protocol GUID to its @@ -101,9 +105,22 @@ void efi_save_gd(void); void efi_restore_gd(void); /* Called from EFI_EXIT on callback exit to restore the gd register */ efi_status_t efi_exit_func(efi_status_t ret); +/* Call this to relocate the runtime section to an address space */ +void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); + +/* + * Use these to indicate that your code / data should go into the EFI runtime + * section and thus still be available when the OS is running + */ +#define EFI_RUNTIME_DATA __attribute__ ((section ("efi_runtime_data"))) +#define EFI_RUNTIME_TEXT __attribute__ ((section ("efi_runtime_text"))) #else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */ +/* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */ +#define EFI_RUNTIME_DATA +#define EFI_RUNTIME_TEXT + /* No loader configured, stub out EFI_ENTRY */ static inline void efi_restore_gd(void) { } |