Commit e47b2d674f0acd137412535647cb3072bf11dbb0

Authored by Simon Glass
Committed by Tom Rini
1 parent 96d4b75c0d

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
... ... @@ -17,8 +17,8 @@
17 17  
18 18 #include <common.h>
19 19 #include <inttypes.h>
  20 +#include <relocate.h>
20 21 #include <asm/u-boot-x86.h>
21   -#include <asm/relocate.h>
22 22 #include <asm/sections.h>
23 23 #include <elf.h>
24 24  
arch/xtensa/include/asm/relocate.h
1   -/*
2   - * Copyright (C) 2016 Cadence Design Systems Inc.
3   - *
4   - * SPDX-License-Identifier: GPL-2.0+
5   - */
6   -
7   -#ifndef _ASM_XTENSA_RELOCATE_H
8   -#define _ASM_XTENSA_RELOCATE_H
9   -
10   -#include <common.h>
11   -
12   -int clear_bss(void);
13   -
14   -#endif /* _ASM_XTENSA_RELOCATE_H */
arch/xtensa/lib/relocate.c
... ... @@ -4,7 +4,7 @@
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
6 6  
7   -#include <asm/relocate.h>
  7 +#include <relocate.h>
8 8 #include <asm/sections.h>
9 9 #include <asm/string.h>
10 10  
... ... @@ -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  
  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_ */