aboutsummaryrefslogtreecommitdiff
path: root/lib/efi/efi.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-12-29 11:57:45 -0700
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-12-31 06:45:01 +0100
commit2a1cf03ea4ff9a43fd990dc9ae0110464569c59b (patch)
tree065ee5c259e3d84d434a765a2bfc49c3b9322c2e /lib/efi/efi.c
parent184be592580178dd149800459c8817199160ca22 (diff)
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>
Diffstat (limited to 'lib/efi/efi.c')
-rw-r--r--lib/efi/efi.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/efi/efi.c b/lib/efi/efi.c
index 69e52e4574..cd6bf47b18 100644
--- a/lib/efi/efi.c
+++ b/lib/efi/efi.c
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
+ * Functions shared by the app and stub
+ *
* Copyright (c) 2015 Google, Inc
*
* EFI information obtained here:
@@ -17,6 +19,33 @@
#include <efi.h>
#include <efi_api.h>
+static struct efi_priv *global_priv;
+
+struct efi_priv *efi_get_priv(void)
+{
+ return global_priv;
+}
+
+void efi_set_priv(struct efi_priv *priv)
+{
+ global_priv = 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;
+}
+
/*
* Global declaration of gd.
*