[U-Boot] [PATCH 17/29] blackfin: Call C code to relocate
Simon Glass
sjg at chromium.org
Thu Dec 15 04:27:48 CET 2016
Rather than jumping directly to the assembler relocation code, call a C
function first. This will allow us to add board-specific adjustments.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
arch/blackfin/cpu/cpu.c | 7 +++++++
arch/blackfin/cpu/start.S | 6 +++---
arch/blackfin/include/asm/u-boot.h | 5 +++++
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c
index 0ae5ac6..d46e251 100644
--- a/arch/blackfin/cpu/cpu.c
+++ b/arch/blackfin/cpu/cpu.c
@@ -19,6 +19,7 @@
#include <asm/cplb.h>
#include <asm/clock.h>
#include <asm/sections.h>
+#include <asm/u-boot.h>
#include <asm/mach-common/bits/core.h>
#include <asm/mach-common/bits/ebiu.h>
#include <asm/mach-common/bits/trace.h>
@@ -360,6 +361,12 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
global_board_data_init();
}
+void relocate_code(ulong sp, gd_t *new_gd, ulong relocaddr)
+{
+ /* Jump to board_init_r() with a new stack */
+ asm_relocate_code(sp, new_gd);
+}
+
int arch_cpu_init(void)
{
serial_early_puts("Init CPLB tables\n");
diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S
index 404e710..a5fd76c 100644
--- a/arch/blackfin/cpu/start.S
+++ b/arch/blackfin/cpu/start.S
@@ -245,12 +245,12 @@ LENTRY(_get_pc)
rts;
ENDPROC(_get_pc)
-ENTRY(_relocate_code)
+ENTRY(_asm_relocate_code)
/* Fake relocate code. Setup the new stack only */
sp = r0;
fp = sp;
- r0 = p3;
+ r0 = r1
r1.h = 0x2000;
r1.l = 0x10;
jump.l _board_init_r
-ENDPROC(_relocate_code)
+ENDPROC(_asm_relocate_code)
diff --git a/arch/blackfin/include/asm/u-boot.h b/arch/blackfin/include/asm/u-boot.h
index 1ada44e..ae035f7 100644
--- a/arch/blackfin/include/asm/u-boot.h
+++ b/arch/blackfin/include/asm/u-boot.h
@@ -33,4 +33,9 @@ typedef struct bd_info {
int arch_misc_init(void);
+struct global_data;
+void asm_relocate_code(ulong sp, struct global_data *new_gd)
+ __attribute__ ((noreturn));
+
+
#endif /* _U_BOOT_H_ */
--
2.8.0.rc3.226.g39d4020
More information about the U-Boot
mailing list