efi/libstub: Rename efi_call_early/_runtime macros to be more intuitive
The macros efi_call_early and efi_call_runtime are used to call EFI boot services and runtime services, respectively. However, the naming is confusing, given that the early vs runtime distinction may suggest that these are used for calling the same set of services either early or late (== at runtime), while in reality, the sets of services they can be used with are completely disjoint, and efi_call_runtime is also only usable in 'early' code. So do a global sweep to replace all occurrences with efi_bs_call or efi_rt_call, respectively, where BS and RT match the idiom used by the UEFI spec to refer to boot time or runtime services. While at it, use 'func' as the macro parameter name for the function pointers, which is less likely to collide and cause weird build errors. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Cc: Arvind Sankar <nivedita@alum.mit.edu> Cc: Borislav Petkov <bp@alien8.de> Cc: James Morse <james.morse@arm.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20191224151025.32482-24-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
99ea8b1db2
commit
966291f634
@@ -20,16 +20,6 @@ static const efi_char16_t efi_MemoryOverWriteRequest_name[] =
|
||||
#define MEMORY_ONLY_RESET_CONTROL_GUID \
|
||||
EFI_GUID(0xe20939be, 0x32d4, 0x41be, 0xa1, 0x50, 0x89, 0x7f, 0x85, 0xd4, 0x98, 0x29)
|
||||
|
||||
#define get_efi_var(name, vendor, ...) \
|
||||
efi_call_runtime(get_variable, \
|
||||
(efi_char16_t *)(name), (efi_guid_t *)(vendor), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define set_efi_var(name, vendor, ...) \
|
||||
efi_call_runtime(set_variable, \
|
||||
(efi_char16_t *)(name), (efi_guid_t *)(vendor), \
|
||||
__VA_ARGS__)
|
||||
|
||||
/*
|
||||
* Enable reboot attack mitigation. This requests that the firmware clear the
|
||||
* RAM on next reboot before proceeding with boot, ensuring that any secrets
|
||||
@@ -72,8 +62,8 @@ void efi_retrieve_tpm2_eventlog(void)
|
||||
efi_tcg2_protocol_t *tcg2_protocol = NULL;
|
||||
int final_events_size = 0;
|
||||
|
||||
status = efi_call_early(locate_protocol, &tcg2_guid, NULL,
|
||||
(void **)&tcg2_protocol);
|
||||
status = efi_bs_call(locate_protocol, &tcg2_guid, NULL,
|
||||
(void **)&tcg2_protocol);
|
||||
if (status != EFI_SUCCESS)
|
||||
return;
|
||||
|
||||
@@ -125,9 +115,8 @@ void efi_retrieve_tpm2_eventlog(void)
|
||||
}
|
||||
|
||||
/* Allocate space for the logs and copy them. */
|
||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||
sizeof(*log_tbl) + log_size,
|
||||
(void **) &log_tbl);
|
||||
status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
|
||||
sizeof(*log_tbl) + log_size, (void **)&log_tbl);
|
||||
|
||||
if (status != EFI_SUCCESS) {
|
||||
efi_printk("Unable to allocate memory for event log\n");
|
||||
@@ -166,12 +155,12 @@ void efi_retrieve_tpm2_eventlog(void)
|
||||
log_tbl->version = version;
|
||||
memcpy(log_tbl->log, (void *) first_entry_addr, log_size);
|
||||
|
||||
status = efi_call_early(install_configuration_table,
|
||||
&linux_eventlog_guid, log_tbl);
|
||||
status = efi_bs_call(install_configuration_table,
|
||||
&linux_eventlog_guid, log_tbl);
|
||||
if (status != EFI_SUCCESS)
|
||||
goto err_free;
|
||||
return;
|
||||
|
||||
err_free:
|
||||
efi_call_early(free_pool, log_tbl);
|
||||
efi_bs_call(free_pool, log_tbl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user