On Sun, 2016-05-29 at 12:53 +0200, Jonas Gorski wrote: > Maybe a better solution here would be to create a new symbol > fw_passed_dtb and let the code store a1 in there if a0 is -2, or > __appended_dtb in case it is valid? Then we wouldn't need to special > case APPENDED_DTB for any mach wanting to use it, and they can just > check fw_passed_dtb. > > something like: > > arch/mips/kernel/head.S: > ... > > #ifdef CONFIG_USE_OF > li t1, -2 > beq a0, t1, dtb_found > move t0, a0 > > #ifdef CONFIG_MIPS_RAW_APPENDED_DTB > PTR_LA t0, __appended_dtb > > #ifdef CONFIG_CPU_BIG_ENDIAN > li t1, 0xd00dfeed > #else > li t1, 0xedfe0dd0 > #endif > lw t2, (t0) > bne t1, t2, no_dtb_found > nop > > #endif > no_dtb_found: > li t0, 0 > dtb_found: > LONG_S t0, fw_passed_dtb > #endif That prefers the wrong DTB in case both are present. I propose this instead: #ifdef CONFIG_USE_OF #ifdef CONFIG_MIPS_RAW_APPENDED_DTB PTR_LA t0, __appended_dtb #ifdef CONFIG_CPU_BIG_ENDIAN li t1, 0xd00dfeed #else li t1, 0xedfe0dd0 #endif lw t2, (t0) beq t1, t2, dtb_found nop #endif li t1, -2 beq a0, t1, dtb_found move t0, a1 no_dtb_found: li t0, 0 dtb_found: LONG_S t0, fw_passed_dtb #endif