On 2/15/25 04:22, Simon Glass wrote:
The EFI app likes to use a simple variable for global data. Implement
this for ARM (for use only with 64-bit ARM at present).

Signed-off-by: Simon Glass <s...@chromium.org>
Reviewed-by: Tom Rini <tr...@konsulko.com>

Reviewed-by: Caleb Connolly <caleb.conno...@linaro.org>
---

(no changes since v2)

Changes in v2:
- Mention '64-bit ARM' here, rather than just 'ARM'

  arch/arm/include/asm/global_data.h | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/global_data.h 
b/arch/arm/include/asm/global_data.h
index 6e4471662a3..8d51111f095 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -115,7 +115,13 @@ struct arch_global_data {
#include <asm-generic/global_data.h> -#if defined(__clang__) || defined(LTO_ENABLE)
+#ifdef CONFIG_EFI_APP
+
+#define DECLARE_GLOBAL_DATA_PTR   extern struct global_data *global_data_ptr
+
+#define gd global_data_ptr
+
+#elif defined(__clang__) || defined(LTO_ENABLE)
#define DECLARE_GLOBAL_DATA_PTR
  #define gd    get_gd()
@@ -144,7 +150,11 @@ static inline gd_t *get_gd(void)
static inline void set_gd(volatile gd_t *gd_ptr)
  {
-#ifdef CONFIG_ARM64
+#ifdef CONFIG_EFI_APP
+       extern struct global_data *global_data_ptr;
+
+       global_data_ptr = (void *)gd_ptr;
+#elif defined CONFIG_ARM64
        __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
  #elif __ARM_ARCH >= 7
        __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));

--
Caleb (they/them)

Reply via email to