]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
global_data: Drop spl_handoff
authorSimon Glass <sjg@chromium.org>
Wed, 21 Aug 2024 16:19:13 +0000 (10:19 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 26 Aug 2024 20:05:38 +0000 (14:05 -0600)
Provide a function to locate this information, rather than doing it
automatically on startup, to save space in global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/intel_common/cpu_from_spl.c
arch/x86/lib/fsp2/fsp_dram.c
cmd/sb.c
common/board_f.c
common/init/handoff.c
drivers/clk/rockchip/clk_rk3399.c
include/asm-generic/global_data.h
include/handoff.h

index 48b2ef253cbd23abb942a884c38548dfa2fca859..5aad2ae7309e808a17e7a1b5c41c3c2ecdcf968b 100644 (file)
@@ -24,9 +24,7 @@ int arch_cpu_init(void)
        int ret;
 
 #if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB)
-       struct spl_handoff *ho = gd->spl_handoff;
-
-       gd->arch.hob_list = ho->arch.hob_list;
+       gd->arch.hob_list = handoff_get();
 #endif
        ret = x86_cpu_reinit_f();
 
index 83c6d7bcc93f5b14ea5739898527412bd3426431..a50dc985a3cb33e26a324ae49c98c417872e19e2 100644 (file)
@@ -59,7 +59,7 @@ int dram_init(void)
 #endif
        } else {
 #if CONFIG_IS_ENABLED(HANDOFF)
-               struct spl_handoff *ho = gd->spl_handoff;
+               struct spl_handoff *ho = handoff_get();
 
                if (!ho) {
                        log_debug("No SPL handoff found\n");
@@ -82,7 +82,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
                return gd->ram_size;
 
 #if CONFIG_IS_ENABLED(HANDOFF)
-       struct spl_handoff *ho = gd->spl_handoff;
+       struct spl_handoff *ho = handoff_get();
 
        log_debug("usable_ram_top = %lx\n", ho->arch.usable_ram_top);
 
index 1aa5921f03e6695e04d89165567fd4077ac59fc3..db485fddfcaabace722f9f8fee7afb085b3354c1 100644 (file)
--- a/cmd/sb.c
+++ b/cmd/sb.c
@@ -14,8 +14,10 @@ static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
                         char *const argv[])
 {
 #if CONFIG_IS_ENABLED(HANDOFF)
-       if (gd->spl_handoff)
-               printf("SPL handoff magic %lx\n", gd->spl_handoff->arch.magic);
+       struct spl_handoff *handoff = handoff_get();
+
+       if (handoff)
+               printf("SPL handoff magic %lx\n", handoff->arch.magic);
        else
                printf("SPL handoff info not received\n");
 
index eb74bfa428a76f9c0240ec7869906227f1982c2e..eb1a5f0e1e9f604d042b78087e49dc9159ac16bf 100644 (file)
@@ -305,17 +305,6 @@ static int setup_mon_len(void)
        return 0;
 }
 
-static int setup_spl_handoff(void)
-{
-#if CONFIG_IS_ENABLED(HANDOFF)
-       gd->spl_handoff = bloblist_find(BLOBLISTT_U_BOOT_SPL_HANDOFF,
-                                       sizeof(struct spl_handoff));
-       debug("Found SPL hand-off info %p\n", gd->spl_handoff);
-#endif
-
-       return 0;
-}
-
 __weak int arch_cpu_init(void)
 {
        return 0;
@@ -891,7 +880,6 @@ static const init_fnc_t init_sequence_f[] = {
        initf_bootstage,        /* uses its own timer, so does not need DM */
        event_init,
        bloblist_maybe_init,
-       setup_spl_handoff,
 #if defined(CONFIG_CONSOLE_RECORD_INIT_F)
        console_record_init,
 #endif
index a7cd065fb385cb05089d059038dd987e5e83fd23..86c020ee0b93d78faee661bfdb5768c5d14c5803 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright 2018 Google, Inc
  */
 
+#include <bloblist.h>
 #include <handoff.h>
 #include <asm/global_data.h>
 
@@ -38,3 +39,14 @@ void handoff_load_dram_banks(struct spl_handoff *ho)
                bd->bi_dram[i].size = ho->ram_bank[i].size;
        }
 }
+
+struct spl_handoff *handoff_get(void)
+{
+       struct spl_handoff *handoff;
+
+       handoff = bloblist_find(BLOBLISTT_U_BOOT_SPL_HANDOFF,
+                               sizeof(struct spl_handoff));
+       debug("Found SPL hand-off info %p\n", handoff);
+
+       return handoff;
+}
index 24cefebd1b2a6eabb462ff51726e9ce7c0dda32c..89924041299146f9d9e664cca098990ab8db2bfc 100644 (file)
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <handoff.h>
 #include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -1467,7 +1468,7 @@ static int rk3399_clk_probe(struct udevice *dev)
        init_clocks = true;
 #elif CONFIG_IS_ENABLED(HANDOFF)
        if (!(gd->flags & GD_FLG_RELOC)) {
-               if (!(gd->spl_handoff))
+               if (!handoff_get())
                        init_clocks = true;
        }
 #endif
index 544195391bd13fcbe38168261b241b9e66fe4889..16c4b4fe676ff973b7e63c1b10f545693adc0a8d 100644 (file)
@@ -396,12 +396,6 @@ struct global_data {
         */
        struct bloblist_hdr *bloblist;
 #endif
-#if CONFIG_IS_ENABLED(HANDOFF)
-       /**
-        * @spl_handoff: SPL hand-off information
-        */
-       struct spl_handoff *spl_handoff;
-#endif
 #if defined(CONFIG_TRANSLATION_OFFSET)
        /**
         * @translation_offset: optional translation offset
index c0ae7b19a75949ebfec5109131486d7bd1ef7041..0072ea832f83828de3a1a5bc2749cabe83f422c6 100644 (file)
@@ -31,6 +31,13 @@ void handoff_save_dram(struct spl_handoff *ho);
 void handoff_load_dram_size(struct spl_handoff *ho);
 void handoff_load_dram_banks(struct spl_handoff *ho);
 
+/**
+ * handoff_get() - Get the SPL handoff information
+ *
+ * Return: Pointer to SPL handoff if received, else NULL
+ */
+struct spl_handoff *handoff_get(void);
+
 /**
  * handoff_arch_save() - Save arch-specific info into the handoff area
  *