All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: Use armlinux_bootparams address for DTB
@ 2013-07-09 12:56 Alexander Shiyan
  2013-07-09 17:54 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Shiyan @ 2013-07-09 12:56 UTC (permalink / raw)
  To: barebox

In some cases, the address of the devicetree, which is obtained
dynamically, may be located in the kernel text area, which leads
to malfunction of the devicetree. The patch uses the address of
the devicetree, designed for the board, if it possible.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/lib/armlinux.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 40a63ea..12fb06d 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -261,16 +261,20 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
 		unsigned long initrd_size, void *oftree)
 {
 	void (*kernel)(int zero, int arch, void *params) = adr;
-	void *params = NULL;
 	int architecture;
 
 	if (oftree) {
-		printf("booting Linux kernel with devicetree\n");
-		params = oftree;
-	} else {
+		if (armlinux_bootparams) {
+			struct fdt_header *header = oftree;
+
+			printf("Relocate DTB to 0x%p\n", armlinux_bootparams);
+			memcpy(armlinux_bootparams, oftree,
+			       fdt32_to_cpu(header->totalsize));
+		} else
+			armlinux_bootparams = oftree;
+	} else
 		setup_tags(initrd_address, initrd_size, swap);
-		params = armlinux_bootparams;
-	}
+
 	architecture = armlinux_get_architecture();
 
 	shutdown_barebox();
@@ -288,10 +292,10 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
 		"mov r2, %1\n"
 		"bx %2\n"
 		:
-		: "r" (architecture), "r" (params), "r" (kernel)
+		: "r" (architecture), "r" (armlinux_bootparams), "r" (kernel)
 		: "r0", "r1", "r2"
 	);
 #else
-	kernel(0, architecture, params);
+	kernel(0, architecture, armlinux_bootparams);
 #endif
 }
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-09 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09 12:56 [PATCH] ARM: Use armlinux_bootparams address for DTB Alexander Shiyan
2013-07-09 17:54 ` Sascha Hauer
2013-07-09 18:00   ` Alexander Shiyan
2013-07-09 18:11     ` Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.