All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 15/16] board_f: Make relocation functions generic
Date: Fri, 31 Mar 2017 08:40:38 -0600	[thread overview]
Message-ID: <20170331144039.14587-16-sjg@chromium.org> (raw)
In-Reply-To: <20170331144039.14587-1-sjg@chromium.org>

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

 arch/arc/include/asm/relocate.h    | 16 ----------------
 arch/x86/include/asm/relocate.h    | 17 -----------------
 arch/x86/lib/relocate.c            |  2 +-
 arch/xtensa/include/asm/relocate.h | 14 --------------
 arch/xtensa/lib/relocate.c         |  2 +-
 common/board_f.c                   |  4 +---
 include/relocate.h                 | 39 ++++++++++++++++++++++++++++++++++++++
 7 files changed, 42 insertions(+), 52 deletions(-)
 delete mode 100644 arch/arc/include/asm/relocate.h
 delete mode 100644 arch/x86/include/asm/relocate.h
 delete mode 100644 arch/xtensa/include/asm/relocate.h
 create mode 100644 include/relocate.h

diff --git a/arch/arc/include/asm/relocate.h b/arch/arc/include/asm/relocate.h
deleted file mode 100644
index 4c5f923416..0000000000
--- a/arch/arc/include/asm/relocate.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _ASM_ARC_RELOCATE_H
-#define _ASM_ARC_RELOCATE_H
-
-#include <common.h>
-
-int copy_uboot_to_ram(void);
-int clear_bss(void);
-int do_elf_reloc_fixups(void);
-
-#endif	/* _ASM_ARC_RELOCATE_H */
diff --git a/arch/x86/include/asm/relocate.h b/arch/x86/include/asm/relocate.h
deleted file mode 100644
index cff3abc23a..0000000000
--- a/arch/x86/include/asm/relocate.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * (C) Copyright 2011
- * Graeme Russ, <graeme.russ@gmail.com>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _RELOCATE_H_
-#define _RELOCATE_H_
-
-#include <common.h>
-
-int copy_uboot_to_ram(void);
-int clear_bss(void);
-int do_elf_reloc_fixups(void);
-
-#endif	/* !_RELOCATE_H_ */
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index 1da5210d27..114f602f7a 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -17,8 +17,8 @@
 
 #include <common.h>
 #include <inttypes.h>
+#include <relocate.h>
 #include <asm/u-boot-x86.h>
-#include <asm/relocate.h>
 #include <asm/sections.h>
 #include <elf.h>
 
diff --git a/arch/xtensa/include/asm/relocate.h b/arch/xtensa/include/asm/relocate.h
deleted file mode 100644
index 9c4ce23988..0000000000
--- a/arch/xtensa/include/asm/relocate.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (C) 2016 Cadence Design Systems Inc.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#ifndef _ASM_XTENSA_RELOCATE_H
-#define _ASM_XTENSA_RELOCATE_H
-
-#include <common.h>
-
-int clear_bss(void);
-
-#endif	/* _ASM_XTENSA_RELOCATE_H */
diff --git a/arch/xtensa/lib/relocate.c b/arch/xtensa/lib/relocate.c
index 3f747ec55a..010c1b035e 100644
--- a/arch/xtensa/lib/relocate.c
+++ b/arch/xtensa/lib/relocate.c
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#include <asm/relocate.h>
+#include <relocate.h>
 #include <asm/sections.h>
 #include <asm/string.h>
 
diff --git a/common/board_f.c b/common/board_f.c
index 1b6c2b9789..bbcf6f4fe5 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -39,6 +39,7 @@
 
 #include <os.h>
 #include <post.h>
+#include <relocate.h>
 #include <spi.h>
 #include <status_led.h>
 #include <timer.h>
@@ -47,9 +48,6 @@
 #include <watchdog.h>
 #include <asm/io.h>
 #include <asm/sections.h>
-#if defined(CONFIG_X86) || defined(CONFIG_ARC) || defined(CONFIG_XTENSA)
-#include <asm/relocate.h>
-#endif
 #include <dm/root.h>
 #include <linux/errno.h>
 
diff --git a/include/relocate.h b/include/relocate.h
new file mode 100644
index 0000000000..0d4b27aa2b
--- /dev/null
+++ b/include/relocate.h
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _RELOCATE_H_
+#define _RELOCATE_H_
+
+#include <common.h>
+
+/**
+ * copy_uboot_to_ram() - Copy U-Boot to its new relocated position
+ *
+ * @return 0 if OK, -ve on error
+ */
+int copy_uboot_to_ram(void);
+
+/**
+ * clear_bss() - Clear the BSS (Blocked Start by Symbol) segment
+ *
+ * This clears the memory used by global variables
+ *
+ * @return 0 if OK, -ve on error
+ */
+int clear_bss(void);
+
+/**
+ * do_elf_reloc_fixups() - Fix up ELF relocations in the relocated code
+ *
+ * This processes the relocation tables to ensure that the code can run in its
+ * new location.
+ *
+ * @return 0 if OK, -ve on error
+ */
+int do_elf_reloc_fixups(void);
+
+#endif	/* _RELOCATE_H_ */
-- 
2.12.2.564.g063fe858b8-goog

  parent reply	other threads:[~2017-03-31 14:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 14:40 [U-Boot] [PATCH 00/16] Clean up board_f sequence a little more Simon Glass
2017-03-31 14:40 ` [U-Boot] [PATCH 01/16] board_f: Drop board_type parameter from initdram() Simon Glass
2017-04-03  6:19   ` Stefan Roese
2017-04-03 15:56   ` york sun
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 02/16] board_f: Drop return value " Simon Glass
2017-04-03  6:25   ` Stefan Roese
2017-04-03 15:56   ` york sun
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 03/16] board_f: Rename initdram() to dram_init() Simon Glass
2017-04-03  6:25   ` Stefan Roese
2017-04-03 15:56   ` york sun
2017-04-05 20:36   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-05 21:11     ` Simon Glass
2017-03-31 14:40 ` [U-Boot] [PATCH 04/16] xtensa: Place relocated U-Boot in the normal place Simon Glass
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 05/16] board_f: Use a single condition for reserve_logbuffer() Simon Glass
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 06/16] board_f: Move the extra #ifdef condition into reserve_mmu() Simon Glass
2017-04-03 15:55   ` york sun
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 07/16] board_f: Put video memory reservation in one function Simon Glass
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 08/16] board_f: Drop CONFIG_SPL_BUILD check Simon Glass
2017-04-03 15:55   ` york sun
2017-04-06 16:25   ` [U-Boot] [U-Boot,08/16] " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 09/16] board_f: Drop setup_dram_config() wrapper Simon Glass
2017-04-03  6:25   ` Stefan Roese
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 10/16] Move dram_init_banksize() to a common header Simon Glass
2017-04-06 16:25   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 11/16] board_f: Drop unused headers Simon Glass
2017-04-03 15:55   ` york sun
2017-04-06 16:25   ` [U-Boot] [U-Boot,11/16] " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 12/16] board_f: Move errno.h down to the bottom Simon Glass
2017-04-03 15:55   ` york sun
2017-04-06 16:26   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 13/16] powerpc: Move setup_board_extra() into a PPC file Simon Glass
2017-04-03  6:26   ` Stefan Roese
2017-04-06 16:26   ` [U-Boot] [U-Boot, " Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 14/16] board_f: Make init_helpers generic Simon Glass
2017-04-06 16:26   ` [U-Boot] [U-Boot,14/16] " Tom Rini
2017-03-31 14:40 ` Simon Glass [this message]
2017-04-06 16:26   ` [U-Boot] [U-Boot, 15/16] board_f: Make relocation functions generic Tom Rini
2017-03-31 14:40 ` [U-Boot] [PATCH 16/16] board_f: powerpc: Drop unused headers Simon Glass
2017-04-03  6:26   ` Stefan Roese
2017-04-03 15:56   ` york sun
2017-04-06 16:26   ` [U-Boot] [U-Boot,16/16] " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331144039.14587-16-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.