diff --git a/arch/arc/include/asm/relocate.h b/arch/arc/include/asm/relocate.h deleted file mode 100644 index 4c5f923416db769870785c4bc67f581be116977b..0000000000000000000000000000000000000000 --- 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 cff3abc23a5e324f91a9495a37bf2a7c8d7c1598..0000000000000000000000000000000000000000 --- 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 1da5210d27b6edac653c4f20488b84aa6432f60c..114f602f7abaedeb5bbacf5f12136bafe7678eed 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 9c4ce23988551871f0503a9e3c197c3863ea848f..0000000000000000000000000000000000000000 --- 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 3f747ec55a1cf699af1a3f8376de29f7f7c9f9f2..010c1b035ef59d6705369ed1cdefb000a9e5e005 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 f928c3dc736452e7b9265e47e45068c1d29af7e5..bed09e249809ed41a5b1e130f08bba87fd6027ae 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 0000000000000000000000000000000000000000..0d4b27aa2bdbe018d54eb49fdd511cb48dc6679c --- /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_ */