[PATCH v2 08/35] common: Move relocate_code() to init.h

Simon Glass sjg at chromium.org
Sat Dec 28 18:44:45 CET 2019


This is an init function so move it out of the common header. Avoid using
the typedef so that we don't have to include the global_data header file.

Also tidy up the function style in comments while we are here.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 arch/arm/lib/relocate_64.S                 |  2 +-
 arch/m68k/cpu/mcf5227x/start.S             |  2 +-
 arch/m68k/cpu/mcf523x/start.S              |  2 +-
 arch/m68k/cpu/mcf52x2/start.S              |  2 +-
 arch/m68k/cpu/mcf530x/start.S              |  2 +-
 arch/m68k/cpu/mcf532x/start.S              |  2 +-
 arch/m68k/cpu/mcf5445x/start.S             |  2 +-
 arch/m68k/cpu/mcf547x_8x/start.S           |  2 +-
 arch/mips/lib/reloc.c                      |  1 +
 arch/nds32/cpu/n1213/start.S               |  2 +-
 arch/nios2/cpu/start.S                     |  2 +-
 arch/powerpc/cpu/mpc83xx/start.S           |  2 +-
 arch/powerpc/cpu/mpc85xx/start.S           |  2 +-
 arch/powerpc/cpu/mpc86xx/start.S           |  2 +-
 arch/powerpc/cpu/mpc8xx/start.S            |  2 +-
 arch/riscv/cpu/start.S                     |  2 +-
 arch/sh/lib/board.c                        |  1 +
 arch/xtensa/cpu/start.S                    |  2 +-
 board/Arcturus/ucp1020/spl.c               |  1 +
 board/Arcturus/ucp1020/spl_minimal.c       |  1 +
 board/freescale/b4860qds/spl.c             |  1 +
 board/freescale/bsc9131rdb/spl_minimal.c   |  1 +
 board/freescale/bsc9132qds/spl_minimal.c   |  1 +
 board/freescale/c29xpcie/spl.c             |  1 +
 board/freescale/c29xpcie/spl_minimal.c     |  1 +
 board/freescale/p1010rdb/spl.c             |  1 +
 board/freescale/p1010rdb/spl_minimal.c     |  1 +
 board/freescale/p1022ds/spl.c              |  1 +
 board/freescale/p1022ds/spl_minimal.c      |  1 +
 board/freescale/p1_p2_rdb_pc/spl.c         |  1 +
 board/freescale/p1_p2_rdb_pc/spl_minimal.c |  1 +
 board/freescale/t102xqds/spl.c             |  1 +
 board/freescale/t102xrdb/spl.c             |  1 +
 board/freescale/t104xrdb/spl.c             |  1 +
 board/freescale/t208xqds/spl.c             |  1 +
 board/freescale/t208xrdb/spl.c             |  1 +
 board/freescale/t4qds/spl.c                |  1 +
 board/freescale/t4rdb/spl.c                |  1 +
 include/common.h                           |  6 ------
 include/init.h                             | 10 ++++++++++
 40 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/arch/arm/lib/relocate_64.S b/arch/arm/lib/relocate_64.S
index 26d29c5324..72e91f2704 100644
--- a/arch/arm/lib/relocate_64.S
+++ b/arch/arm/lib/relocate_64.S
@@ -14,7 +14,7 @@
 #include <asm/macro.h>
 
 /*
- * void relocate_code (addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  * x0 holds the destination address.
diff --git a/arch/m68k/cpu/mcf5227x/start.S b/arch/m68k/cpu/mcf5227x/start.S
index 61f9c6859c..86c93ba3fa 100644
--- a/arch/m68k/cpu/mcf5227x/start.S
+++ b/arch/m68k/cpu/mcf5227x/start.S
@@ -386,7 +386,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S
index f57baa58f5..8c5a164955 100644
--- a/arch/m68k/cpu/mcf523x/start.S
+++ b/arch/m68k/cpu/mcf523x/start.S
@@ -150,7 +150,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S
index f7f124dd2f..747a518f6c 100644
--- a/arch/m68k/cpu/mcf52x2/start.S
+++ b/arch/m68k/cpu/mcf52x2/start.S
@@ -229,7 +229,7 @@ _after_flashbar_copy:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S
index eb4b33899f..32356d875e 100644
--- a/arch/m68k/cpu/mcf530x/start.S
+++ b/arch/m68k/cpu/mcf530x/start.S
@@ -155,7 +155,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S
index 4411e5fe28..e2d7c72cee 100644
--- a/arch/m68k/cpu/mcf532x/start.S
+++ b/arch/m68k/cpu/mcf532x/start.S
@@ -165,7 +165,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S
index db30b26c34..80eb287151 100644
--- a/arch/m68k/cpu/mcf5445x/start.S
+++ b/arch/m68k/cpu/mcf5445x/start.S
@@ -514,7 +514,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/m68k/cpu/mcf547x_8x/start.S b/arch/m68k/cpu/mcf547x_8x/start.S
index 4dd57bf39c..b70842b2b8 100644
--- a/arch/m68k/cpu/mcf547x_8x/start.S
+++ b/arch/m68k/cpu/mcf547x_8x/start.S
@@ -155,7 +155,7 @@ _start:
 /******************************************************************************/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index e68f49467c..1e3cfadd2d 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -28,6 +28,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/relocs.h>
 #include <asm/sections.h>
 
diff --git a/arch/nds32/cpu/n1213/start.S b/arch/nds32/cpu/n1213/start.S
index 691888157f..386c1998dc 100644
--- a/arch/nds32/cpu/n1213/start.S
+++ b/arch/nds32/cpu/n1213/start.S
@@ -223,7 +223,7 @@ call_board_init_f:
 	j	board_init_f		! jump to board_init_f() in lib/board.c
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 2900200dbb..f5ad184e8d 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -147,7 +147,7 @@ _reloc:
 	 * We'll call the board_init_r from here since this isn't
 	 * supposed to return.
 	 *
-	 * void relocate_code (ulong sp, gd_t *global_data,
+	 * void relocate_code(ulong sp, gd_t *global_data,
 	 *			ulong reloc_addr)
 	 *			__attribute__ ((noreturn));
 	 */
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index f4a8a766c3..9da22ce486 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -804,7 +804,7 @@ flush_dcache:
 /*-------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 38e907f5ad..dd784e7e30 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -1549,7 +1549,7 @@ write_tlb:
 	blr
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/powerpc/cpu/mpc86xx/start.S b/arch/powerpc/cpu/mpc86xx/start.S
index 59213c2dfe..f4651ce8d4 100644
--- a/arch/powerpc/cpu/mpc86xx/start.S
+++ b/arch/powerpc/cpu/mpc86xx/start.S
@@ -636,7 +636,7 @@ in32r:
 	blr
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index b8bdaaec2f..ed735cdee0 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -322,7 +322,7 @@ int_return:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
index 1a55b7d570..f3dccdbe4c 100644
--- a/arch/riscv/cpu/start.S
+++ b/arch/riscv/cpu/start.S
@@ -217,7 +217,7 @@ spl_call_board_init_r:
 #endif
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index 533fcf8906..a6a8f07e6f 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/xtensa/cpu/start.S b/arch/xtensa/cpu/start.S
index 38d2fa2fe1..580df65ea7 100644
--- a/arch/xtensa/cpu/start.S
+++ b/arch/xtensa/cpu/start.S
@@ -273,7 +273,7 @@ _start:
 	ill
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
  *
  * This "function" does not return, instead it continues in RAM
  * after relocating the monitor code.
diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c
index 9314fabdf2..ca02e9eb1b 100644
--- a/board/Arcturus/ucp1020/spl.c
+++ b/board/Arcturus/ucp1020/spl.c
@@ -11,6 +11,7 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <init.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/Arcturus/ucp1020/spl_minimal.c b/board/Arcturus/ucp1020/spl_minimal.c
index 1c4134d827..cd0022a73e 100644
--- a/board/Arcturus/ucp1020/spl_minimal.c
+++ b/board/Arcturus/ucp1020/spl_minimal.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <ns16550.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c
index 06ea877504..a16db9d59a 100644
--- a/board/freescale/b4860qds/spl.c
+++ b/board/freescale/b4860qds/spl.c
@@ -6,6 +6,7 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <init.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/board/freescale/bsc9131rdb/spl_minimal.c b/board/freescale/bsc9131rdb/spl_minimal.c
index e7ed0a90b8..79df0f3cbd 100644
--- a/board/freescale/bsc9131rdb/spl_minimal.c
+++ b/board/freescale/bsc9131rdb/spl_minimal.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <ns16550.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/board/freescale/bsc9132qds/spl_minimal.c b/board/freescale/bsc9132qds/spl_minimal.c
index 5e1cc1f4a3..dc72b2e2f2 100644
--- a/board/freescale/bsc9132qds/spl_minimal.c
+++ b/board/freescale/bsc9132qds/spl_minimal.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <ns16550.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c
index 9a2385b978..9abbfb5dbc 100644
--- a/board/freescale/c29xpcie/spl.c
+++ b/board/freescale/c29xpcie/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/c29xpcie/spl_minimal.c b/board/freescale/c29xpcie/spl_minimal.c
index 7452cec8ff..8193afdf6a 100644
--- a/board/freescale/c29xpcie/spl_minimal.c
+++ b/board/freescale/c29xpcie/spl_minimal.c
@@ -3,6 +3,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <mpc85xx.h>
 #include <asm/io.h>
 #include <ns16550.h>
diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c
index cb489140c0..240194ad80 100644
--- a/board/freescale/p1010rdb/spl.c
+++ b/board/freescale/p1010rdb/spl.c
@@ -6,6 +6,7 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <init.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/p1010rdb/spl_minimal.c b/board/freescale/p1010rdb/spl_minimal.c
index b9eb4430f1..0bb2c83872 100644
--- a/board/freescale/p1010rdb/spl_minimal.c
+++ b/board/freescale/p1010rdb/spl_minimal.c
@@ -3,6 +3,7 @@
  * Copyright 2011 Freescale Semiconductor, Inc.
  */
 #include <common.h>
+#include <init.h>
 #include <mpc85xx.h>
 #include <asm/io.h>
 #include <ns16550.h>
diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c
index 8d2c1388ec..81c5bf00e2 100644
--- a/board/freescale/p1022ds/spl.c
+++ b/board/freescale/p1022ds/spl.c
@@ -7,6 +7,7 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <init.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/p1022ds/spl_minimal.c b/board/freescale/p1022ds/spl_minimal.c
index 9ab4029836..31de26318d 100644
--- a/board/freescale/p1022ds/spl_minimal.c
+++ b/board/freescale/p1022ds/spl_minimal.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <ns16550.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c
index 908f4bc96f..4ac4756b17 100644
--- a/board/freescale/p1_p2_rdb_pc/spl.c
+++ b/board/freescale/p1_p2_rdb_pc/spl.c
@@ -7,6 +7,7 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <init.h>
 #include <ns16550.h>
 #include <malloc.h>
 #include <mmc.h>
diff --git a/board/freescale/p1_p2_rdb_pc/spl_minimal.c b/board/freescale/p1_p2_rdb_pc/spl_minimal.c
index d8ae1f835c..ced5f3c3b5 100644
--- a/board/freescale/p1_p2_rdb_pc/spl_minimal.c
+++ b/board/freescale/p1_p2_rdb_pc/spl_minimal.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <ns16550.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c
index 7a499a559f..d1dc9f8d63 100644
--- a/board/freescale/t102xqds/spl.c
+++ b/board/freescale/t102xqds/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c
index c579be1cb2..0936f28220 100644
--- a/board/freescale/t102xrdb/spl.c
+++ b/board/freescale/t102xrdb/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c
index 2d1342fb99..a1c8a47014 100644
--- a/board/freescale/t104xrdb/spl.c
+++ b/board/freescale/t104xrdb/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c
index f0499ad7e5..fa843ef212 100644
--- a/board/freescale/t208xqds/spl.c
+++ b/board/freescale/t208xqds/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c
index d7ca0dd6db..f4d68b6706 100644
--- a/board/freescale/t208xrdb/spl.c
+++ b/board/freescale/t208xrdb/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <nand.h>
diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c
index df81205e88..4cf7c09943 100644
--- a/board/freescale/t4qds/spl.c
+++ b/board/freescale/t4qds/spl.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c
index ec3978a70a..28b78f3232 100644
--- a/board/freescale/t4rdb/spl.c
+++ b/board/freescale/t4rdb/spl.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <console.h>
 #include <env_internal.h>
+#include <init.h>
 #include <asm/spl.h>
 #include <malloc.h>
 #include <ns16550.h>
diff --git a/include/common.h b/include/common.h
index e5de74af33..90391d262e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -103,12 +103,6 @@ void	fdc_hw_init   (void);
 int testdram(void);
 #endif /* CONFIG_SYS_DRAM_TEST */
 
-#if defined(CONFIG_ARM)
-void	relocate_code(ulong);
-#else
-void	relocate_code(ulong, gd_t *, ulong) __attribute__ ((noreturn));
-#endif
-
 void s_init(void);
 
 void	upmconfig     (unsigned int, unsigned int *, unsigned int);
diff --git a/include/init.h b/include/init.h
index a5a2c79a90..f6105de666 100644
--- a/include/init.h
+++ b/include/init.h
@@ -12,6 +12,8 @@
 
 #include <linux/types.h>
 
+struct global_data;
+
 #ifndef __ASSEMBLY__		/* put C only stuff in this section */
 
 /*
@@ -228,6 +230,14 @@ void trap_init(unsigned long reloc_addr);
  */
 void main_loop(void);
 
+#if defined(CONFIG_ARM)
+void relocate_code(ulong addr_moni);
+#else
+void relocate_code(ulong start_addr_sp, struct global_data *new_gd,
+		   ulong relocaddr)
+	__attribute__ ((noreturn));
+#endif
+
 #endif	/* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
-- 
2.24.1.735.g03f4e72817-goog



More information about the U-Boot mailing list