efi: Share struct efi_priv between the app and stub code
At present each of these has its own static variable and helper functions.
Move them into a shared file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
index 4a80633..214cef9 100644
--- a/lib/efi/efi_app.c
+++ b/lib/efi/efi_app.c
@@ -27,23 +27,6 @@
DECLARE_GLOBAL_DATA_PTR;
-static struct efi_priv *global_priv;
-
-struct efi_system_table *efi_get_sys_table(void)
-{
- return global_priv->sys_table;
-}
-
-struct efi_boot_services *efi_get_boot(void)
-{
- return global_priv->boot;
-}
-
-unsigned long efi_get_ram_base(void)
-{
- return global_priv->ram_base;
-}
-
int efi_info_get(enum efi_entry_t type, void **datap, int *sizep)
{
return -ENOSYS;
@@ -319,7 +302,7 @@
/* Set up access to EFI data structures */
efi_init(priv, "App", image, sys_table);
- global_priv = priv;
+ efi_set_priv(priv);
/*
* Set up the EFI debug UART so that printf() works. This is
@@ -345,7 +328,7 @@
static void efi_exit(void)
{
- struct efi_priv *priv = global_priv;
+ struct efi_priv *priv = efi_get_priv();
free_memory(priv);
printf("U-Boot EFI exiting\n");