summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/common.c')
-rw-r--r--arch/arm/cpu/common.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/arch/arm/cpu/common.c b/arch/arm/cpu/common.c
index c7d1709b8b..e9118b450d 100644
--- a/arch/arm/cpu/common.c
+++ b/arch/arm/cpu/common.c
@@ -1,19 +1,5 @@
-/*
- * Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
#include <common.h>
#include <init.h>
@@ -37,6 +23,12 @@
*/
void sync_caches_for_execution(void)
{
+ /* if caches are disabled, don't do data cache maintenance */
+ if (!(get_cr() & CR_C)) {
+ icache_invalidate();
+ return;
+ }
+
/*
* Despite the name arm_early_mmu_cache_flush not only flushes the
* data cache, but also invalidates the instruction cache.
@@ -67,18 +59,21 @@ void pbl_barebox_break(void)
/*
* relocate binary to the currently running address
*/
-void relocate_to_current_adr(void)
+void __prereloc relocate_to_current_adr(void)
{
- unsigned long offset, offset_var;
+ unsigned long offset;
unsigned long __maybe_unused *dynsym, *dynend;
void *dstart, *dend;
/* Get offset between linked address and runtime address */
offset = get_runtime_offset();
- offset_var = global_variable_offset();
- dstart = (void *)__rel_dyn_start + offset_var;
- dend = (void *)__rel_dyn_end + offset_var;
+ /*
+ * We have yet to relocate, so using runtime_address
+ * to compute the relocated address
+ */
+ dstart = runtime_address(__rel_dyn_start);
+ dend = runtime_address(__rel_dyn_end);
#if defined(CONFIG_CPU_64)
while (dstart < dend) {
@@ -98,14 +93,14 @@ void relocate_to_current_adr(void)
putc_ll(' ');
puthex_ll(rel->r_addend);
putc_ll('\n');
- panic("");
+ __hang();
}
dstart += sizeof(*rel);
}
#elif defined(CONFIG_CPU_32)
- dynsym = (void *)__dynsym_start + offset_var;
- dynend = (void *)__dynsym_end + offset_var;
+ dynsym = runtime_address(__dynsym_start);
+ dynend = runtime_address(__dynsym_end);
while (dstart < dend) {
struct elf32_rel *rel = dstart;
@@ -128,13 +123,13 @@ void relocate_to_current_adr(void)
putc_ll(' ');
puthex_ll(rel->r_offset);
putc_ll('\n');
- panic("");
+ __hang();
}
dstart += sizeof(*rel);
}
- memset(dynsym, 0, (unsigned long)dynend - (unsigned long)dynsym);
+ __memset(dynsym, 0, (unsigned long)dynend - (unsigned long)dynsym);
#else
#error "Architecture not specified"
#endif