[PATCH 1/3] MIPS: don't pass fdt_size into main_entry()

Antony Pavlov antonynpavlov at gmail.com
Wed Jun 12 16:28:05 PDT 2024


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 at 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




More information about the barebox mailing list