summaryrefslogtreecommitdiffstats
path: root/arch/arc/lib/relocate.c
diff options
context:
space:
mode:
authorAlexey Brodkin <abrodkin@synopsys.com>2015-02-24 19:40:36 +0300
committerAlexey Brodkin <abrodkin@synopsys.com>2015-04-03 09:47:49 +0300
commit3fb8016360d5433f3c4da51f8dd57550e7ef9018 (patch)
tree1cc2fe2a4723565e60279386122a35abe44cb36a /arch/arc/lib/relocate.c
parent8ee28251d95e237302c7c44929e59a813e147622 (diff)
downloadtalos-obmc-uboot-3fb8016360d5433f3c4da51f8dd57550e7ef9018.tar.gz
talos-obmc-uboot-3fb8016360d5433f3c4da51f8dd57550e7ef9018.zip
arc: clean-up init procedure
Intention behind this work was elimination of as much assembly-written code as it is possible. In case of ARC we already have relocation fix-up implemented in C so why don't we use C for U-Boot copying, .bss zeroing etc. It turned out x86 uses pretty similar approach so we re-used parts of code in "board_f.c" initially implemented for x86. Now assembly usage during init is limited to stack- and frame-pointer setup before and after relocation. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/arc/lib/relocate.c')
-rw-r--r--arch/arc/lib/relocate.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arc/lib/relocate.c b/arch/arc/lib/relocate.c
index 7797782563..5c2c2d1930 100644
--- a/arch/arc/lib/relocate.c
+++ b/arch/arc/lib/relocate.c
@@ -10,6 +10,25 @@
DECLARE_GLOBAL_DATA_PTR;
+int copy_uboot_to_ram(void)
+{
+ size_t len = (size_t)&__image_copy_end - (size_t)&__image_copy_start;
+
+ memcpy((void *)gd->relocaddr, (void *)&__image_copy_start, len);
+
+ return 0;
+}
+
+int clear_bss(void)
+{
+ ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
+ size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
+
+ memset((void *)dst_addr, 0x00, len);
+
+ return 0;
+}
+
/*
* Base functionality is taken from x86 version with added ARC-specifics
*/
OpenPOWER on IntegriCloud