In arm64 case, how is fdt address passed to x0 before switching to linux?

Chan Kim ckim at etri.re.kr
Mon Jan 10 09:04:49 CET 2022


Hello experts,

 

I'm doing debug for arm64 linux booting using u-boot-spl.

Because I can use only 8MB on-chip ram in place of DDR located at 0x80000000
for now, 

I modified the spl code so that kernel image is placed at 0x80080000 and fdt
is located at 0x80700000. (memcopy-ied from FIT image loaded at 0x80100000).

I'm sure the cpu has switched to linux but don't see kernel messages. 

Because I can't use debugger for actual board now, I'm using qemu to find
what's wrong using the emulation. So far the behavior is the same with the
FPGA board.

 

Now, the x0 register is supposed to point to fdt when linux is entered, but
I found the x0 value was not set before switching to linux.

I think this malfunction came from the modifications I made to the source
made for our special situation.

I searched common/spl/spl.c and arch/arm/lib/spl.c but couldn't find where
x0 register is set. 

(the spl_image->fdt_address has been already set to 0x80700000 already).

 

<< common/spl/spl.c >>

#ifdef CONFIG_SPL_OS_BOOT   // set to yes

    case IH_OS_LINUX:

        debug("Jumping to Linux\n");

#if defined(CONFIG_SYS_SPL_ARGS_ADDR)   // not set

        spl_fixup_fdt((void *)CONFIG_SYS_SPL_ARGS_ADDR);

#endif

        spl_board_prepare_for_linux();

        jump_to_image_linux(&spl_image);

#endif

 

<< arch/arm/lib/spl.c >>

#ifdef CONFIG_SPL_OS_BOOT   // set to yes

#ifdef CONFIG_ARM64  // set to yes

void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)

{

    debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);

    cleanup_before_linux();

    armv8_switch_to_el2((u64)spl_image->arg, 0, 0, 0,

                spl_image->entry_point, ES_TO_AARCH64);

}   

#else

void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)

{   

    unsigned long machid = 0xffffffff;

#ifdef CONFIG_MACH_TYPE

    machid = CONFIG_MACH_TYPE;

#endif

 

Where in the u-boot-spl code is the x0 register set with fdt address?

Any comment/advice will be really appreciated.

 

Thank you!

Chan Kim

 



More information about the U-Boot mailing list