For MIPS, we don't actually have boards which lack PBL in the resulting image. As such, the code in _start() is mostly redundant: the stack was setup in ENTRY_FUNCTION_END, while copying the code to the link location is not needed - it should already be executing at TEXT_BASE, where we have decompressed it. Other than that, disabling interrupts with watchpoints and enabling 64-bit addressing was already moved into PBL, so we don't really need to repeat it there. Replace the assembly implementation of _start() with the C one, as the only thing it now does is jump straight into 'relocate_code()'. Signed-off-by: Denis Orlov <denorl2009@xxxxxxxxx> --- arch/mips/boot/start.S | 46 ------------------------------------------ arch/mips/boot/start.c | 17 ++++++++++++++++ 2 files changed, 17 insertions(+), 46 deletions(-) delete mode 100644 arch/mips/boot/start.S create mode 100644 arch/mips/boot/start.c diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S deleted file mode 100644 index 30828ad9ef..0000000000 --- a/arch/mips/boot/start.S +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Startup Code for MIPS CPU - * - * Copyright (C) 2011, 2015 Antony Pavlov <antonynpavlov@xxxxxxxxx> - */ - -#include <asm/pbl_macros.h> - - .set noreorder - .section ".text_entry" - .align 4 - -EXPORT(_start) - - mips_barebox_10h - - /* save dtb pointer */ - move s0, a0 - move s1, a1 - move s2, a2 - - /* disable watchpoints */ - mtc0 zero, CP0_WATCHLO - mtc0 zero, CP0_WATCHHI - - mips_disable_interrupts - - mips64_enable_64bit_addressing - - copy_to_link_location _start - - stack_setup - - /* restore dtb pointer */ - move a0, s0 - move a1, s1 - move a2, s2 - PTR_LA v0, relocate_code - jal v0 - nop - - /* No return */ -__error: - b __error - nop diff --git a/arch/mips/boot/start.c b/arch/mips/boot/start.c new file mode 100644 index 0000000000..81603c8d7a --- /dev/null +++ b/arch/mips/boot/start.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Startup Code for MIPS CPU + * + * Copyright (C) 2011, 2015 Antony Pavlov <antonynpavlov@xxxxxxxxx> + */ + +#include <linux/kernel.h> + +void __noreturn _start(void *fdt, u32 fdt_size, u32 relocaddr); +void __noreturn relocate_code(void *fdt, u32 fdt_size, u32 relocaddr); + +void __noreturn __section(.text_entry) _start(void *fdt, u32 fdt_size, + u32 relocaddr) +{ + relocate_code(fdt, fdt_size, relocaddr); +} -- 2.41.0