MIPS: pbl fixes
Subsystems (2)
cover MIPS: pbl fixes
Antony Pavlov (3):
MIPS: don't pass fdt_size into main_entry()
MIPS: pbl_main_entry(): inline barebox_uncompress()
MIPS: rename pbl_main_entry() -> barebox_pbl_start()
arch/mips/boards/board-dt-2nd.S | 4 +--
arch/mips/boards/netgear-wg102/lowlevel.S | 2 +-
arch/mips/boot/Makefile | 2 +-
arch/mips/boot/dtb.c | 1 -
arch/mips/boot/main_entry.c | 6 ++---
arch/mips/boot/start.c | 9 +++----
.../boot/{main_entry-pbl.c => uncompress.c} | 26 ++++++++-----------
arch/mips/include/asm/asm.h | 2 +-
arch/mips/lib/reloc.c | 12 ++++-----
9 files changed, 27 insertions(+), 37 deletions(-)
rename arch/mips/boot/{main_entry-pbl.c => uncompress.c} (71%)Signature · 1 line
2.39.0
PATCH 1/3 MIPS: don't pass fdt_size into main_entry()
The commit 113c2bc244649430 ("MIPS: remove request_sdram_region "fdt"") makes glob_fdt_size unused. The patch drops glob_fdt_size and all variables used for glob_fdt_size initialization inside main_entry().
--- arch/mips/boot/dtb.c | 1 - arch/mips/boot/main_entry-pbl.c | 4 ++-- arch/mips/boot/main_entry.c | 6 ++---- arch/mips/boot/start.c | 9 ++++----- arch/mips/lib/reloc.c | 12 +++++------- 5 files changed, 13 insertions(+), 19 deletions(-)
arch/mips/boot/dtb.c +0 -1
@@ -12,7 +12,6 @@#include <asm/addrspace.h> void *glob_fdt; -u32 glob_fdt_size;int of_add_memory_bank (struct device_node *node,bool dump,int r,u64 base,u64 size)
arch/mips/boot/main_entry-pbl.c +2 -2
@@ -35,7 +35,7 @@ void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end, {u32 piggy_len, fdt_len;void *fdt_new; -void (*barebox)(void *fdt,u32 fdt_len,u32 ram_size); +void (*barebox)(void *fdt,u32 ram_size);puts_ll ("pbl_main_entry()\n" );
@@ -53,5 +53,5 @@ void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end,memcpy (fdt_new, fdt, fdt_len); barebox = (void *)TEXT_BASE ; -barebox (fdt_new, fdt_len, ram_size); +barebox (fdt_new, ram_size); }
arch/mips/boot/main_entry.c +2 -4
@@ -17,7 +17,7 @@extern void exception_vec (void );extern void exception_vec_end (void ); -void main_entry (void *fdt,u32 fdt_size); +void main_entry (void *fdt);static void trap_init (void ) {
@@ -36,7 +36,6 @@ static void trap_init(void) }extern void *glob_fdt; -extern u32 glob_fdt_size;extern unsigned long mips_stack_top;/**
@@ -44,7 +43,7 @@ extern unsigned long mips_stack_top;* * @note The C environment isn't initialized yet */ -void __bare_init main_entry(void *fdt, u32 fdt_size) +void __bare_init main_entry(void *fdt) {unsigned long malloc_start, malloc_end;/* clear the BSS first */
@@ -68,7 +67,6 @@ void __bare_init main_entry(void *fdt, u32 fdt_size) mips_stack_top = malloc_start; glob_fdt = fdt; - glob_fdt_size = fdt_size;start_barebox (); }
arch/mips/boot/start.c +4 -5
@@ -7,11 +7,10 @@#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 _start (void *fdt,u32 relocaddr); +void __noreturn relocate_code (void *fdt,u32 relocaddr); -void __noreturn __section(.text_entry) _start(void *fdt, u32 fdt_size, - u32 relocaddr) +void __noreturn __section(.text_entry) _start(void *fdt, u32 relocaddr) { -relocate_code (fdt, fdt_size, relocaddr); +relocate_code (fdt, relocaddr); }
arch/mips/lib/reloc.c +5 -7
@@ -40,8 +40,8 @@#include <linux/sizes.h> #include <asm-generic/memory_layout.h> -void main_entry (void *fdt,u32 fdt_size); -void __noreturn relocate_code (void *fdt,u32 fdt_size,u32 relocaddr); +void main_entry (void *fdt); +void __noreturn relocate_code (void *fdt,u32 relocaddr);/** * read_uint() - Read an unsigned integer from the buffer
@@ -106,7 +106,7 @@ static void apply_reloc(unsigned int type, void *addr, long off) } } -void __noreturn relocate_code (void *fdt,u32 fdt_size,u32 ram_size) +void __noreturn relocate_code (void *fdt,u32 ram_size) {unsigned long addr, length, bss_len, relocaddr, new_stack;uint8_t *buf;
@@ -156,13 +156,11 @@ void __noreturn relocate_code(void *fdt, u32 fdt_size, u32 ram_size) __asm__ __volatile__ ("move $a0, %0\n" -" move $a1, %1\n" " move $31, $0\n" -" move $sp, %2\n" -" jr %3\n" +" move $sp, %1\n" +" jr %2\n" :/* no outputs */ :"r" (fdt), -"r" (fdt_size),"r" (new_stack),"r" ((unsigned long )main_entry + off));
Signature · 1 line
2.39.0
PATCH 2/3 MIPS: pbl_main_entry(): inline barebox_uncompress()
In reply to Antony PavlovUnify MIPS pbl_main_entry() with RISC-V barebox_pbl_start().
--- arch/mips/boot/main_entry-pbl.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
arch/mips/boot/main_entry-pbl.c +6 -10
@@ -21,15 +21,6 @@ unsigned long free_mem_end_ptr;void pbl_main_entry (void *fdt,void *fdt_end,u32 ram_size); -static void barebox_uncompress (void *compressed_start,unsigned int len) -{ -/* set 128 KiB at the end of the MALLOC_BASE for early malloc */ - free_mem_ptr =TEXT_BASE -SZ_128K ; - free_mem_end_ptr = free_mem_ptr +SZ_128K ; - -pbl_barebox_uncompress ((void *)TEXT_BASE , compressed_start, len); -} - void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end, u32 ram_size) {
@@ -42,8 +33,13 @@ void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end,/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start); +/* set 128 KiB at the end of the MALLOC_BASE for early malloc */ + free_mem_ptr =TEXT_BASE -SZ_128K ; + free_mem_end_ptr = free_mem_ptr +SZ_128K ; + piggy_len = (unsigned long )&input_data_end - (unsigned long )&input_data; -barebox_uncompress (&input_data, piggy_len); + +pbl_barebox_uncompress ((void *)TEXT_BASE , &input_data, piggy_len); fdt_len = (unsigned long )fdt_end - (unsigned long )fdt;if (!fdt_len) {
Signature · 1 line
2.39.0
PATCH 3/3 MIPS: rename pbl_main_entry() -> barebox_pbl_start()
In reply to Antony PavlovUnify function and file names with ARM and RISC-V.
---
arch/mips/boards/board-dt-2nd.S | 4 ++--
arch/mips/boards/netgear-wg102/lowlevel.S | 2 +-
arch/mips/boot/Makefile | 2 +-
arch/mips/boot/{main_entry-pbl.c => uncompress.c} | 6 +++---
arch/mips/include/asm/asm.h | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)arch/mips/boards/board-dt-2nd.S +2 -2
@@ -20,12 +20,12 @@ ENTRY_FUNCTION(start_dt_2nd) stack_setup - /* pbl_main_entry() computes fdt_len by itself + /* barebox_pbl_start() computes fdt_len by itself * if fdt == fdt_end */ move a0, v1 /* fdt */ move a1, v1 /* fdt_end */ PTR_LI a2, SZ_256M /* ram_size */ - PTR_LA v0, pbl_main_entry + PTR_LA v0, barebox_pbl_start jal v0 nop
arch/mips/boards/netgear-wg102/lowlevel.S +1 -1
@@ -61,7 +61,7 @@ sdram_configured: stack_setup; lw a0, 0; - la v0, pbl_main_entry; + la v0, barebox_pbl_start; jal v0; nop;
arch/mips/boot/Makefile +1 -1
@@ -5,4 +5,4 @@ obj-y += main_entry.o obj-$(CONFIG_OFDEVICE) += dtb.o -pbl-y += main_entry-pbl.o +pbl-y += uncompress.o
arch/mips/boot/uncompress.c renamed from arch/mips/boot/main_entry-pbl.c +3 -3
@@ -19,16 +19,16 @@ extern void *input_data_end;unsigned long free_mem_ptr;unsigned long free_mem_end_ptr; -void pbl_main_entry (void *fdt,void *fdt_end,u32 ram_size); +void barebox_pbl_start (void *fdt,void *fdt_end,u32 ram_size); -void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end, +void __section(.text_entry) barebox_pbl_start(void *fdt, void *fdt_end, u32 ram_size) {u32 piggy_len, fdt_len;void *fdt_new;void (*barebox)(void *fdt,u32 ram_size); -puts_ll ("pbl_main_entry()\n" ); +puts_ll ("barebox_pbl_start()\n" );/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start);
arch/mips/include/asm/asm.h +1 -1
@@ -97,7 +97,7 @@ EXPORT(symbol) \ PTR_LA a0, __dtb_ ## dtb##_start; \ PTR_LA a1, __dtb_ ## dtb##_end; \ PTR_LI a2, ram_size; \ - PTR_LA v0, pbl_main_entry; \ + PTR_LA v0, barebox_pbl_start; \ jal v0; \ nop; \ \
Signature · 1 line
2.39.0
Sascha Hauer
AppliedQuoted 17 lines · Antony Pavlov
Antony Pavlov (3):
MIPS: don't passfdt_sizeintomain_entry()
MIPS:pbl_main_entry(): inlinebarebox_uncompress()
MIPS: renamepbl_main_entry()->barebox_pbl_start()
arch/mips/boards/board-dt-2nd.S| 4 +--arch/mips/boards/netgear-wg102/lowlevel.S | 2 +- arch/mips/boot/Makefile | 2 +- arch/mips/boot/dtb.c | 1 - arch/mips/boot/main_entry.c | 6 ++--- arch/mips/boot/start.c | 9 +++---- .../boot/{main_entry-pbl.c => uncompress.c} | 26 ++++++++----------- arch/mips/include/asm/asm.h | 2 +- arch/mips/lib/reloc.c | 12 ++++----- 9 files changed, 27 insertions(+), 37 deletions(-) rename arch/mips/boot/{main_entry-pbl.c => uncompress.c} (71%)
Quoted 1 line
[...]
Applied, thanks!
[1/3] MIPS: don't pass fdt_size into main_entry()
https://git.pengutronix.de/cgit/barebox/commit/?id=e4b849bffef1 (link may not be stable)
[2/3] MIPS: pbl_main_entry(): inline barebox_uncompress()
https://git.pengutronix.de/cgit/barebox/commit/?id=20074e4eb2f1 (link may not be stable)
[3/3] MIPS: rename pbl_main_entry() -> barebox_pbl_start()
https://git.pengutronix.de/cgit/barebox/commit/?id=a8e268d7524d (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>