public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arch: mips: Update initrd_start and initrd_end
@ 2019-04-24 15:21 Horatiu Vultur
  2019-04-29 15:00 ` Daniel Schwierzeck
  0 siblings, 1 reply; 2+ messages in thread
From: Horatiu Vultur @ 2019-04-24 15:21 UTC (permalink / raw)
  To: u-boot

Microsemi SoC defines CONFIG_SYS_SDRAM_BASE to be 0x80000000, which
represents the start of kseg0 and represents a virtual address. Meaning
that the initrd_start and initrd_end point somewhere kseg0.
When these parameters are passed to linux kernel through DT
they are pointing somewhere in kseg0 which is a virtual address but linux
kernel expects the addresses to be physical addresses(in kuseg) because
it is converting the physical address to a virtual one.

Therefore update the uboot to pass the physical address of initrd_start
and initrd_end by converting them using the function virt_to_phys before
setting up the DT.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 arch/mips/lib/bootm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 35152cb..6a462f3 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -247,6 +247,8 @@ int arch_fixup_fdt(void *blob)
 
 static int boot_setup_fdt(bootm_headers_t *images)
 {
+	images->initrd_start = virt_to_phys((void *)images->initrd_start);
+	images->initrd_end = virt_to_phys((void *)images->initrd_end);
 	return image_setup_libfdt(images, images->ft_addr, images->ft_len,
 		&images->lmb);
 }
-- 
2.7.4

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

* [U-Boot] [PATCH] arch: mips: Update initrd_start and initrd_end
  2019-04-24 15:21 [U-Boot] [PATCH] arch: mips: Update initrd_start and initrd_end Horatiu Vultur
@ 2019-04-29 15:00 ` Daniel Schwierzeck
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Schwierzeck @ 2019-04-29 15:00 UTC (permalink / raw)
  To: u-boot



Am 24.04.19 um 17:21 schrieb Horatiu Vultur:
> Microsemi SoC defines CONFIG_SYS_SDRAM_BASE to be 0x80000000, which
> represents the start of kseg0 and represents a virtual address. Meaning
> that the initrd_start and initrd_end point somewhere kseg0.
> When these parameters are passed to linux kernel through DT
> they are pointing somewhere in kseg0 which is a virtual address but linux
> kernel expects the addresses to be physical addresses(in kuseg) because
> it is converting the physical address to a virtual one.
> 
> Therefore update the uboot to pass the physical address of initrd_start
> and initrd_end by converting them using the function virt_to_phys before
> setting up the DT.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  arch/mips/lib/bootm.c | 2 ++
>  1 file changed, 2 insertions(+)

There is still a task on my TODO list to convert and interpret
CONFIG_SYS_SDRAM_BASE as physical address on MIPS so that patch would
actually not be necessary. Paul already prepared some patches in the
past, but additionally we need to properly support map_physmem() and fix
some places in common code. Until we have this, I'll apply this patch,
thanks.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

> 
> diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
> index 35152cb..6a462f3 100644
> --- a/arch/mips/lib/bootm.c
> +++ b/arch/mips/lib/bootm.c
> @@ -247,6 +247,8 @@ int arch_fixup_fdt(void *blob)
>  
>  static int boot_setup_fdt(bootm_headers_t *images)
>  {
> +	images->initrd_start = virt_to_phys((void *)images->initrd_start);
> +	images->initrd_end = virt_to_phys((void *)images->initrd_end);
>  	return image_setup_libfdt(images, images->ft_addr, images->ft_len,
>  		&images->lmb);
>  }
> 

-- 
- Daniel

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

end of thread, other threads:[~2019-04-29 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-24 15:21 [U-Boot] [PATCH] arch: mips: Update initrd_start and initrd_end Horatiu Vultur
2019-04-29 15:00 ` Daniel Schwierzeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox