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>
---
(no changes since v1)
include/efi.h | 7 +++++++
lib/efi_client/efi.c | 5 +++++
lib/efi_client/efi_vars.c | 9 +++------
3 files changed, 15 insertions(+), 6 deletions(-)
@@ -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
*
@@ -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;
@@ -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);
}