Commit 150ebd38 authored by David Howells's avatar David Howells

x86/efi: Allow invocation of arbitrary runtime services

Provide the ability to perform mixed-mode runtime service calls for x86 in
the same way that commit 0a637ee6
("x86/efi: Allow invocation of arbitrary boot services") provides the
ability to invoke arbitrary boot services.
Suggested-by: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent d1d50531
...@@ -32,6 +32,7 @@ static void setup_boot_services##bits(struct efi_config *c) \ ...@@ -32,6 +32,7 @@ static void setup_boot_services##bits(struct efi_config *c) \
\ \
table = (typeof(table))sys_table; \ table = (typeof(table))sys_table; \
\ \
c->runtime_services = table->runtime; \
c->boot_services = table->boottime; \ c->boot_services = table->boottime; \
c->text_output = table->con_out; \ c->text_output = table->con_out; \
} }
......
...@@ -82,7 +82,7 @@ ENTRY(efi_pe_entry) ...@@ -82,7 +82,7 @@ ENTRY(efi_pe_entry)
/* Relocate efi_config->call() */ /* Relocate efi_config->call() */
leal efi32_config(%esi), %eax leal efi32_config(%esi), %eax
add %esi, 32(%eax) add %esi, 40(%eax)
pushl %eax pushl %eax
call make_boot_params call make_boot_params
...@@ -108,7 +108,7 @@ ENTRY(efi32_stub_entry) ...@@ -108,7 +108,7 @@ ENTRY(efi32_stub_entry)
/* Relocate efi_config->call() */ /* Relocate efi_config->call() */
leal efi32_config(%esi), %eax leal efi32_config(%esi), %eax
add %esi, 32(%eax) add %esi, 40(%eax)
pushl %eax pushl %eax
2: 2:
call efi_main call efi_main
...@@ -264,7 +264,7 @@ relocated: ...@@ -264,7 +264,7 @@ relocated:
#ifdef CONFIG_EFI_STUB #ifdef CONFIG_EFI_STUB
.data .data
efi32_config: efi32_config:
.fill 4,8,0 .fill 5,8,0
.long efi_call_phys .long efi_call_phys
.long 0 .long 0
.byte 0 .byte 0
......
...@@ -265,7 +265,7 @@ ENTRY(efi_pe_entry) ...@@ -265,7 +265,7 @@ ENTRY(efi_pe_entry)
/* /*
* Relocate efi_config->call(). * Relocate efi_config->call().
*/ */
addq %rbp, efi64_config+32(%rip) addq %rbp, efi64_config+40(%rip)
movq %rax, %rdi movq %rax, %rdi
call make_boot_params call make_boot_params
...@@ -285,7 +285,7 @@ handover_entry: ...@@ -285,7 +285,7 @@ handover_entry:
* Relocate efi_config->call(). * Relocate efi_config->call().
*/ */
movq efi_config(%rip), %rax movq efi_config(%rip), %rax
addq %rbp, 32(%rax) addq %rbp, 40(%rax)
2: 2:
movq efi_config(%rip), %rdi movq efi_config(%rip), %rdi
call efi_main call efi_main
...@@ -457,14 +457,14 @@ efi_config: ...@@ -457,14 +457,14 @@ efi_config:
#ifdef CONFIG_EFI_MIXED #ifdef CONFIG_EFI_MIXED
.global efi32_config .global efi32_config
efi32_config: efi32_config:
.fill 4,8,0 .fill 5,8,0
.quad efi64_thunk .quad efi64_thunk
.byte 0 .byte 0
#endif #endif
.global efi64_config .global efi64_config
efi64_config: efi64_config:
.fill 4,8,0 .fill 5,8,0
.quad efi_call .quad efi_call
.byte 1 .byte 1
#endif /* CONFIG_EFI_STUB */ #endif /* CONFIG_EFI_STUB */
......
...@@ -191,6 +191,7 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( ...@@ -191,6 +191,7 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
struct efi_config { struct efi_config {
u64 image_handle; u64 image_handle;
u64 table; u64 table;
u64 runtime_services;
u64 boot_services; u64 boot_services;
u64 text_output; u64 text_output;
efi_status_t (*call)(unsigned long, ...); efi_status_t (*call)(unsigned long, ...);
...@@ -226,6 +227,10 @@ static inline bool efi_is_64bit(void) ...@@ -226,6 +227,10 @@ static inline bool efi_is_64bit(void)
#define __efi_call_early(f, ...) \ #define __efi_call_early(f, ...) \
__efi_early()->call((unsigned long)f, __VA_ARGS__); __efi_early()->call((unsigned long)f, __VA_ARGS__);
#define efi_call_runtime(f, ...) \
__efi_early()->call(efi_table_attr(efi_runtime_services, f, \
__efi_early()->runtime_services), __VA_ARGS__)
extern bool efi_reboot_required(void); extern bool efi_reboot_required(void);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment