
From: Simon Glass <sjg@chromium.org> Add a function which allows the app to obtain the runtime services without first obtaining the priv data. Make use of this in efi_vars.c Signed-off-by: Simon Glass <sjg@chromium.org> --- include/efi.h | 7 +++++++ lib/efi_client/efi.c | 5 +++++ lib/efi_client/efi_vars.c | 9 +++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/efi.h b/include/efi.h index 9ff945ae1c3..742c40bfd8c 100644 --- a/include/efi.h +++ b/include/efi.h @@ -604,6 +604,13 @@ struct efi_system_table *efi_get_sys_table(void); */ struct efi_boot_services *efi_get_boot(void); +/** + * efi_get_run() - Get access to the EFI runtime-services table + * + * Returns: pointer to EFI runtime-services table + */ +struct efi_runtime_services *efi_get_run(void); + /** * efi_get_parent_image() - Get the handle of the parent image * diff --git a/lib/efi_client/efi.c b/lib/efi_client/efi.c index c5573dd67f9..e2cc9d3eae3 100644 --- a/lib/efi_client/efi.c +++ b/lib/efi_client/efi.c @@ -65,6 +65,11 @@ struct efi_boot_services *efi_get_boot(void) return global_priv->boot; } +struct efi_runtime_services *efi_get_run(void) +{ + return global_priv->run; +} + efi_handle_t efi_get_parent_image(void) { return global_priv->parent_image; diff --git a/lib/efi_client/efi_vars.c b/lib/efi_client/efi_vars.c index 099a59b2a1e..e652ee3f243 100644 --- a/lib/efi_client/efi_vars.c +++ b/lib/efi_client/efi_vars.c @@ -18,8 +18,7 @@ efi_status_t efi_get_variable_int(const u16 *variable_name, const efi_guid_t *ve u32 *attributes, efi_uintn_t *data_size, void *data, u64 *timep) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->get_variable((u16 *)variable_name, vendor, attributes, data_size, data); } @@ -28,8 +27,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, const efi_guid_t *ve u32 attributes, efi_uintn_t data_size, const void *data, bool ro_check) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->set_variable((u16 *)variable_name, vendor, attributes, data_size, data); } @@ -37,8 +35,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, const efi_guid_t *ve efi_status_t efi_get_next_variable_name_int(efi_uintn_t *variable_name_size, u16 *variable_name, efi_guid_t *vendor) { - struct efi_priv *priv = efi_get_priv(); - struct efi_runtime_services *run = priv->run; + struct efi_runtime_services *run = efi_get_run(); return run->get_next_variable_name(variable_name_size, variable_name, vendor); } -- 2.43.0