Commit e47b2d674f0acd137412535647cb3072bf11dbb0
Committed by
Tom Rini
1 parent
96d4b75c0d
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
board_f: Make relocation functions generic
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>
Showing 7 changed files with 42 additions and 52 deletions Side-by-side Diff
arch/arc/include/asm/relocate.h
| 1 | -/* | |
| 2 | - * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved. | |
| 3 | - * | |
| 4 | - * SPDX-License-Identifier: GPL-2.0+ | |
| 5 | - */ | |
| 6 | - | |
| 7 | -#ifndef _ASM_ARC_RELOCATE_H | |
| 8 | -#define _ASM_ARC_RELOCATE_H | |
| 9 | - | |
| 10 | -#include <common.h> | |
| 11 | - | |
| 12 | -int copy_uboot_to_ram(void); | |
| 13 | -int clear_bss(void); | |
| 14 | -int do_elf_reloc_fixups(void); | |
| 15 | - | |
| 16 | -#endif /* _ASM_ARC_RELOCATE_H */ |
arch/x86/include/asm/relocate.h
| 1 | -/* | |
| 2 | - * (C) Copyright 2011 | |
| 3 | - * Graeme Russ, <graeme.russ@gmail.com> | |
| 4 | - * | |
| 5 | - * SPDX-License-Identifier: GPL-2.0+ | |
| 6 | - */ | |
| 7 | - | |
| 8 | -#ifndef _RELOCATE_H_ | |
| 9 | -#define _RELOCATE_H_ | |
| 10 | - | |
| 11 | -#include <common.h> | |
| 12 | - | |
| 13 | -int copy_uboot_to_ram(void); | |
| 14 | -int clear_bss(void); | |
| 15 | -int do_elf_reloc_fixups(void); | |
| 16 | - | |
| 17 | -#endif /* !_RELOCATE_H_ */ |
arch/x86/lib/relocate.c
arch/xtensa/include/asm/relocate.h
arch/xtensa/lib/relocate.c
common/board_f.c
| ... | ... | @@ -39,6 +39,7 @@ |
| 39 | 39 | |
| 40 | 40 | #include <os.h> |
| 41 | 41 | #include <post.h> |
| 42 | +#include <relocate.h> | |
| 42 | 43 | #include <spi.h> |
| 43 | 44 | #include <status_led.h> |
| 44 | 45 | #include <timer.h> |
| ... | ... | @@ -47,9 +48,6 @@ |
| 47 | 48 | #include <watchdog.h> |
| 48 | 49 | #include <asm/io.h> |
| 49 | 50 | #include <asm/sections.h> |
| 50 | -#if defined(CONFIG_X86) || defined(CONFIG_ARC) || defined(CONFIG_XTENSA) | |
| 51 | -#include <asm/relocate.h> | |
| 52 | -#endif | |
| 53 | 51 | #include <dm/root.h> |
| 54 | 52 | #include <linux/errno.h> |
| 55 | 53 |
include/relocate.h
| 1 | +/* | |
| 2 | + * (C) Copyright 2011 | |
| 3 | + * Graeme Russ, <graeme.russ@gmail.com> | |
| 4 | + * | |
| 5 | + * SPDX-License-Identifier: GPL-2.0+ | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _RELOCATE_H_ | |
| 9 | +#define _RELOCATE_H_ | |
| 10 | + | |
| 11 | +#include <common.h> | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * copy_uboot_to_ram() - Copy U-Boot to its new relocated position | |
| 15 | + * | |
| 16 | + * @return 0 if OK, -ve on error | |
| 17 | + */ | |
| 18 | +int copy_uboot_to_ram(void); | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * clear_bss() - Clear the BSS (Blocked Start by Symbol) segment | |
| 22 | + * | |
| 23 | + * This clears the memory used by global variables | |
| 24 | + * | |
| 25 | + * @return 0 if OK, -ve on error | |
| 26 | + */ | |
| 27 | +int clear_bss(void); | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * do_elf_reloc_fixups() - Fix up ELF relocations in the relocated code | |
| 31 | + * | |
| 32 | + * This processes the relocation tables to ensure that the code can run in its | |
| 33 | + * new location. | |
| 34 | + * | |
| 35 | + * @return 0 if OK, -ve on error | |
| 36 | + */ | |
| 37 | +int do_elf_reloc_fixups(void); | |
| 38 | + | |
| 39 | +#endif /* _RELOCATE_H_ */ |