]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
common/board_f: introduce arch_setup_dest_addr()
authorOvidiu Panait <ovpanait@gmail.com>
Tue, 13 Sep 2022 18:31:28 +0000 (21:31 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 7 Oct 2022 01:05:17 +0000 (21:05 -0400)
In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
arch/powerpc/lib/stack.c
common/board_f.c
include/init.h

index f2a4652e081dc6f48e965666030a87a9468d0bf0..2e731aa8701dd0da2af00372e06ee715d8d0958f 100644 (file)
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <init.h>
 #include <asm/global_data.h>
+#include <asm/mp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,3 +31,19 @@ int arch_reserve_stacks(void)
 
        return 0;
 }
+
+int arch_setup_dest_addr(void)
+{
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+       /*
+        * We need to make sure the location we intend to put secondary core
+        * boot code is reserved and not used by any part of u-boot
+        */
+       if (gd->relocaddr > determine_mp_bootpg(NULL)) {
+               gd->relocaddr = determine_mp_bootpg(NULL);
+               debug("Reserving MP boot page to %08lx\n", gd->relocaddr);
+       }
+#endif
+
+       return 0;
+}
index 5201ed30cf3676a44c0cb49de86a439a817145ab..82b5828d28661c7c20afa14aec2264eb79fb752b 100644 (file)
@@ -46,9 +46,6 @@
 #include <video.h>
 #include <watchdog.h>
 #include <asm/cache.h>
-#if defined(CONFIG_MP) && defined(CONFIG_PPC)
-#include <asm/mp.h>
-#endif
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/sections.h>
@@ -343,6 +340,11 @@ __weak phys_size_t board_get_usable_ram_top(phys_size_t total_size)
        return gd->ram_top;
 }
 
+__weak int arch_setup_dest_addr(void)
+{
+       return 0;
+}
+
 static int setup_dest_addr(void)
 {
        debug("Monitor len: %08lX\n", gd->mon_len);
@@ -370,17 +372,8 @@ static int setup_dest_addr(void)
        gd->ram_top = board_get_usable_ram_top(gd->mon_len);
        gd->relocaddr = gd->ram_top;
        debug("Ram top: %08llX\n", (unsigned long long)gd->ram_top);
-#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
-       /*
-        * We need to make sure the location we intend to put secondary core
-        * boot code is reserved and not used by any part of u-boot
-        */
-       if (gd->relocaddr > determine_mp_bootpg(NULL)) {
-               gd->relocaddr = determine_mp_bootpg(NULL);
-               debug("Reserving MP boot page to %08lx\n", gd->relocaddr);
-       }
-#endif
-       return 0;
+
+       return arch_setup_dest_addr();
 }
 
 #ifdef CONFIG_PRAM
index 50a8302dc54c61918614836a684f322cfac33e99..d40d11f33d22770b4fccce49962f29126e3bad4b 100644 (file)
@@ -103,6 +103,19 @@ phys_size_t get_effective_memsize(void);
 
 int testdram(void);
 
+/**
+ * arch_setup_dest_addr() - Fix up initial reloc address
+ *
+ * This is called in generic board init sequence in common/board_f.c at the end
+ * of the setup_dest_addr() initcall. Each architecture could provide this
+ * function to make adjustments to the initial reloc address.
+ *
+ * If an implementation is not provided, it will just be a nop stub.
+ *
+ * Return: 0 if OK
+ */
+int arch_setup_dest_addr(void);
+
 /**
  * arch_reserve_stacks() - Reserve all necessary stacks
  *