summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/reloc.c
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2020-06-03 09:20:32 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-08 06:55:19 +0200
commit34d18aaa2a47522a8b607fb2e61c79f5b10ecb9a (patch)
tree086481199c6ecc67b7451cd333922f12fafd0de1 /arch/mips/lib/reloc.c
parentc0f0cbd1759a6ca6cbda4001dff5764f6633c825 (diff)
downloadbarebox-34d18aaa2a47522a8b607fb2e61c79f5b10ecb9a.tar.gz
MIPS: correctly work with disabled CONFIG_MMU
There are some issues with CONFIG_MMU=n in MIPS configuration (e.g. qemu-malta_defconfig): * "Cannot request SDRAM region for stack" error message on start; * empty kseg1_ram0 region in the iomem command output. The patch fixes the problems by forcing KSEG1 memory region usage for CONFIG_MMU=n MIPS configurations. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/lib/reloc.c')
-rw-r--r--arch/mips/lib/reloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 4b0e252..b084a88 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -120,7 +120,11 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
length = __bss_stop - __image_start;
relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K);
- relocaddr = KSEG0ADDR(relocaddr);
+ if (IS_ENABLED(CONFIG_MMU)) {
+ relocaddr = KSEG0ADDR(relocaddr);
+ } else {
+ relocaddr = KSEG1ADDR(relocaddr);
+ }
new_stack = relocaddr - MALLOC_SIZE - 16;
/*