* [PATCH 0/3] MIPS: pbl fixes
@ 2024-06-12 23:28 Antony Pavlov
2024-06-12 23:28 ` [PATCH 1/3] MIPS: don't pass fdt_size into main_entry() Antony Pavlov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Antony Pavlov @ 2024-06-12 23:28 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum
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%)
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] MIPS: don't pass fdt_size into main_entry()
2024-06-12 23:28 [PATCH 0/3] MIPS: pbl fixes Antony Pavlov
@ 2024-06-12 23:28 ` Antony Pavlov
2024-06-12 23:28 ` [PATCH 2/3] MIPS: pbl_main_entry(): inline barebox_uncompress() Antony Pavlov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2024-06-12 23:28 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum
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().
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
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(-)
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c
index ece1494e5fd..5a62ef41e34 100644
--- a/arch/mips/boot/dtb.c
+++ b/arch/mips/boot/dtb.c
@@ -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)
diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c
index 389dc94f370..01833a508d3 100644
--- a/arch/mips/boot/main_entry-pbl.c
+++ b/arch/mips/boot/main_entry-pbl.c
@@ -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);
}
diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
index d0c69f3c82c..1f8f7529a31 100644
--- a/arch/mips/boot/main_entry.c
+++ b/arch/mips/boot/main_entry.c
@@ -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();
}
diff --git a/arch/mips/boot/start.c b/arch/mips/boot/start.c
index 81603c8d7a5..2d258047fea 100644
--- a/arch/mips/boot/start.c
+++ b/arch/mips/boot/start.c
@@ -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);
}
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index a9078aa8136..ec351b66f75 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -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));
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] MIPS: pbl_main_entry(): inline barebox_uncompress()
2024-06-12 23:28 [PATCH 0/3] MIPS: pbl fixes Antony Pavlov
2024-06-12 23:28 ` [PATCH 1/3] MIPS: don't pass fdt_size into main_entry() Antony Pavlov
@ 2024-06-12 23:28 ` Antony Pavlov
2024-06-12 23:28 ` [PATCH 3/3] MIPS: rename pbl_main_entry() -> barebox_pbl_start() Antony Pavlov
2024-06-13 6:59 ` [PATCH 0/3] MIPS: pbl fixes Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2024-06-12 23:28 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum
Unify MIPS pbl_main_entry() with RISC-V barebox_pbl_start().
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
arch/mips/boot/main_entry-pbl.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c
index 01833a508d3..7b5e81817e0 100644
--- a/arch/mips/boot/main_entry-pbl.c
+++ b/arch/mips/boot/main_entry-pbl.c
@@ -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) {
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] MIPS: rename pbl_main_entry() -> barebox_pbl_start()
2024-06-12 23:28 [PATCH 0/3] MIPS: pbl fixes Antony Pavlov
2024-06-12 23:28 ` [PATCH 1/3] MIPS: don't pass fdt_size into main_entry() Antony Pavlov
2024-06-12 23:28 ` [PATCH 2/3] MIPS: pbl_main_entry(): inline barebox_uncompress() Antony Pavlov
@ 2024-06-12 23:28 ` Antony Pavlov
2024-06-13 6:59 ` [PATCH 0/3] MIPS: pbl fixes Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2024-06-12 23:28 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum
Unify function and file names with ARM and RISC-V.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
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(-)
diff --git a/arch/mips/boards/board-dt-2nd.S b/arch/mips/boards/board-dt-2nd.S
index a1465f09e36..1e70574509c 100644
--- a/arch/mips/boards/board-dt-2nd.S
+++ b/arch/mips/boards/board-dt-2nd.S
@@ -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
diff --git a/arch/mips/boards/netgear-wg102/lowlevel.S b/arch/mips/boards/netgear-wg102/lowlevel.S
index 6fdcfa3ccae..3d9715e8fc7 100644
--- a/arch/mips/boards/netgear-wg102/lowlevel.S
+++ b/arch/mips/boards/netgear-wg102/lowlevel.S
@@ -61,7 +61,7 @@ sdram_configured:
stack_setup;
lw a0, 0;
- la v0, pbl_main_entry;
+ la v0, barebox_pbl_start;
jal v0;
nop;
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index d1e27b5e6b8..da3f53d3123 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -5,4 +5,4 @@ obj-y += main_entry.o
obj-$(CONFIG_OFDEVICE) += dtb.o
-pbl-y += main_entry-pbl.o
+pbl-y += uncompress.o
diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/uncompress.c
similarity index 87%
rename from arch/mips/boot/main_entry-pbl.c
rename to arch/mips/boot/uncompress.c
index 7b5e81817e0..9344679a6b8 100644
--- a/arch/mips/boot/main_entry-pbl.c
+++ b/arch/mips/boot/uncompress.c
@@ -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);
diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index f6daae67579..d07e26cff03 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -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; \
\
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] MIPS: pbl fixes
2024-06-12 23:28 [PATCH 0/3] MIPS: pbl fixes Antony Pavlov
` (2 preceding siblings ...)
2024-06-12 23:28 ` [PATCH 3/3] MIPS: rename pbl_main_entry() -> barebox_pbl_start() Antony Pavlov
@ 2024-06-13 6:59 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-06-13 6:59 UTC (permalink / raw)
To: barebox, Antony Pavlov; +Cc: Oleksij Rempel, Ahmad Fatoum
On Thu, 13 Jun 2024 02:28:04 +0300, Antony Pavlov wrote:
> 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%)
>
> [...]
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,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-13 6:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12 23:28 [PATCH 0/3] MIPS: pbl fixes Antony Pavlov
2024-06-12 23:28 ` [PATCH 1/3] MIPS: don't pass fdt_size into main_entry() Antony Pavlov
2024-06-12 23:28 ` [PATCH 2/3] MIPS: pbl_main_entry(): inline barebox_uncompress() Antony Pavlov
2024-06-12 23:28 ` [PATCH 3/3] MIPS: rename pbl_main_entry() -> barebox_pbl_start() Antony Pavlov
2024-06-13 6:59 ` [PATCH 0/3] MIPS: pbl fixes Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox