[U-Boot] [PATCH v5 05/14] arm: Add pivot_to_board_init_r() to each start.S

Simon Glass sjg at chromium.org
Thu Feb 23 14:03:39 CET 2012


We don't want this in a common file, or at least not yet, so add
this function to every start.S individually. The existing code tacked
on the end of a long relocation function and does not suit our needs
since it doesn't allow the address of board_init_r() to be passed in
and cannot be called from C since it expects values in registers r4
and above.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v4:
- Put start_call_board_init_r() into each start.S, sadly
- Split out start_call_board_init_r() addition into new patch

Changes in v5:
- Rename start_call_board_init_r() to pivot_to_board_init_r()

 arch/arm/cpu/arm1136/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/arm1176/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/arm720t/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/arm920t/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/arm925t/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/arm926ejs/start.S |   19 +++++++++++++++++++
 arch/arm/cpu/arm946es/start.S  |   19 +++++++++++++++++++
 arch/arm/cpu/arm_intcm/start.S |   19 +++++++++++++++++++
 arch/arm/cpu/armv7/start.S     |   19 +++++++++++++++++++
 arch/arm/cpu/ixp/start.S       |   19 +++++++++++++++++++
 arch/arm/cpu/lh7a40x/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/pxa/start.S       |   20 ++++++++++++++++++++
 arch/arm/cpu/s3c44b0/start.S   |   19 +++++++++++++++++++
 arch/arm/cpu/sa1100/start.S    |   19 +++++++++++++++++++
 14 files changed, 267 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 28e059e..8cb145e 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -295,6 +295,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index 0c749b4..f531f1b 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -397,6 +397,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 #ifdef CONFIG_ENABLE_MMU
 _mmu_table_base:
 	.word mmu_table
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index 80814d6..8d53b80 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -266,6 +266,25 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 57b2b59..16da876 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -317,6 +317,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm925t/start.S b/arch/arm/cpu/arm925t/start.S
index 5dafc11..a237e32 100644
--- a/arch/arm/cpu/arm925t/start.S
+++ b/arch/arm/cpu/arm925t/start.S
@@ -311,6 +311,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 6b8fdc5..b36dd41 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -350,6 +350,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm946es/start.S b/arch/arm/cpu/arm946es/start.S
index 448979f..13ecbc9 100644
--- a/arch/arm/cpu/arm946es/start.S
+++ b/arch/arm/cpu/arm946es/start.S
@@ -277,6 +277,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/arm_intcm/start.S b/arch/arm/cpu/arm_intcm/start.S
index 7a9dbd1..7d5120f 100644
--- a/arch/arm/cpu/arm_intcm/start.S
+++ b/arch/arm/cpu/arm_intcm/start.S
@@ -278,6 +278,25 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 8a616fa..90a1f61 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -298,6 +298,25 @@ jump_2_ram:
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*************************************************************************
  *
  * cpu_init_cp15
diff --git a/arch/arm/cpu/ixp/start.S b/arch/arm/cpu/ixp/start.S
index 68d8029..54e1f41 100644
--- a/arch/arm/cpu/ixp/start.S
+++ b/arch/arm/cpu/ixp/start.S
@@ -372,6 +372,25 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /****************************************************************************/
 /*									    */
 /* Interrupt handling							    */
diff --git a/arch/arm/cpu/lh7a40x/start.S b/arch/arm/cpu/lh7a40x/start.S
index 3274f43..a9b60d3 100644
--- a/arch/arm/cpu/lh7a40x/start.S
+++ b/arch/arm/cpu/lh7a40x/start.S
@@ -280,6 +280,25 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index 9de1a4a..203e98d 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -303,6 +303,26 @@ _board_init_r_ofs:
 #endif
 
 #endif
+
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/s3c44b0/start.S b/arch/arm/cpu/s3c44b0/start.S
index ffb3ebf..fc71774 100644
--- a/arch/arm/cpu/s3c44b0/start.S
+++ b/arch/arm/cpu/s3c44b0/start.S
@@ -255,6 +255,25 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S
index 168b11f..5527527 100644
--- a/arch/arm/cpu/sa1100/start.S
+++ b/arch/arm/cpu/sa1100/start.S
@@ -256,6 +256,25 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
 _board_init_r_ofs:
 	.word board_init_r - _start
 
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd	Pointer to global data
+ * @param dest_addr	Destination address from global data
+ * @param func	Address of board_init_r function (relocated)
+ * @param sp	New stack pointer
+ */
+.globl pivot_to_board_init_r
+pivot_to_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+	mcr	p15, 0, r0, c7, c5, 0	@ invalidate icache
+	mcr     p15, 0, r0, c7, c10, 4	@ DSB
+	mcr     p15, 0, r0, c7, c5, 4	@ ISB
+#endif
+	mov	sp, r3
+	/* jump to it ... */
+	mov	pc, r2
+
 /*
  *************************************************************************
  *
-- 
1.7.7.3



More information about the U-Boot mailing list