ARM: Use armlinux_bootparams address for DTB
PATCH 1/1 ARM: Use armlinux_bootparams address for DTB
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.
--- arch/arm/lib/armlinux.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/arm/lib/armlinux.c +12 -8
@@ -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 }
Signature · 7 lines
1.8.1.5 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 15 lines · Alexander Shiyan
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 <[email protected]>--- arch/arm/lib/armlinux.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/arm/lib/armlinux.c +0
-0
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 268
Quoted 8 lines
arch/arm/lib/armlinux.c +0
-2@@ -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" );
This is a useful information that gets removed here. Could you keep it?
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 270
Quoted 6 lines
arch/arm/lib/armlinux.c +4
-2- params = oftree; - }else { +if (armlinux_bootparams) { +struct fdt_header *header = oftree; + +printf ("Relocate DTB to 0x%p\n" , armlinux_bootparams);
This is more useful for verbose mode, but I think not for the normal case.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 22 lines · Alexander Shiyan
Quoted 21 lines
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 <[email protected]>--- arch/arm/lib/armlinux.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/arm/lib/armlinux.c +0
-1@@ -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;
Quoted 4 lines
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 268
Quoted 2 lines
arch/arm/lib/armlinux.c +0
-1if (oftree) { -printf ("booting Linux kernel with devicetree\n" );This is a useful information that gets removed here. Could you keep it?
Yes, but I think this is duplicate previous message "using internal devicetree".
Quoted 9 lines
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 270
Quoted 6 lines
arch/arm/lib/armlinux.c +4
-2- params = oftree; - }else { +if (armlinux_bootparams) { +struct fdt_header *header = oftree; + +printf ("Relocate DTB to 0x%p\n" , armlinux_bootparams);This is more useful for verbose mode, but I think not for the normal case.
This is note about address, since barebox reports us address of devicetree before and it different than armlinux_params. Remove anyway?
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 22 lines · Alexander Shiyan
Quoted 22 lines · Alexander Shiyan
Quoted 21 lines
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 <[email protected]>--- arch/arm/lib/armlinux.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)arch/arm/lib/armlinux.c +0
-1@@ -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;
Quoted 6 lines
Quoted 4 lines
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 268
Quoted 2 lines
arch/arm/lib/armlinux.c +0
-1if (oftree) { -printf ("booting Linux kernel with devicetree\n" );This is a useful information that gets removed here. Could you keep it?
Yes, but I think this is duplicate previous message "using internal devicetree".
Not really a duplicate since the 'internal devicetree' message will only come if we are using an internal devicetree (i.e. no devicetree specified on the commandline).
We could move the message to common/bootm.c instead of removing it.
Quoted 11 lines
Quoted 10 lines
arch/arm/lib/armlinux.c void start_linux(void *adr, int swap, unsigned long initrd_address, · line 270
Quoted 7 lines
arch/arm/lib/armlinux.c +4
-2- params = oftree; - }else { +if (armlinux_bootparams) { +struct fdt_header *header = oftree; + +printf ("Relocate DTB to 0x%p\n" , armlinux_bootparams);This is more useful for verbose mode, but I think not for the normal case.
Quoted 2 lines
This is note about address, since barebox reports us address of devicetree before and it different than
armlinux_params. Remove anyway?
My idea was not to remove them but encapsulate it in bootm_verbose(). That's not so easy though since this code is called from non bootm code.
We could add an additional verbose argument to this function.
Often the boot code is critical. During normal boot you don't want to see many messages because they add to the boot time, but when something doesn't work one is happy about every line that comes out, so I think it's worth it to pass a verbose parameter around.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox