efi: app: Provide easy access to runtime services

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>
This commit is contained in:
Simon Glass
2025-08-15 17:18:37 -06:00
parent 9a94bdebbf
commit 7cc4e9b062
3 changed files with 15 additions and 6 deletions

View File

@@ -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;

View File

@@ -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);
}