Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: platform: Allow for DTB to be moved during kernel relocation

Add plat_fdt_relocated(void*) API to allow the kernel relocation code to
update platform's information about the DTB location if the DTB had to
be moved due to being placed in a location used by the relocated kernel.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14611/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Marcin Nowakowski and committed by
Ralf Baechle
0063fded 73346081

+26
+13
arch/mips/generic/init.c
··· 88 88 return (void *)fdt; 89 89 } 90 90 91 + void __init plat_fdt_relocated(void *new_location) 92 + { 93 + /* 94 + * reset fdt as the cached value would point to the location 95 + * before relocations happened and update the location argument 96 + * if it was passed using UHI 97 + */ 98 + fdt = NULL; 99 + 100 + if (fw_arg0 == -2) 101 + fw_arg1 = (unsigned long)new_location; 102 + } 103 + 91 104 void __init plat_mem_setup(void) 92 105 { 93 106 if (mach && mach->fixup_fdt)
+13
arch/mips/include/asm/bootinfo.h
··· 164 164 * Return: Pointer to the flattened device tree blob. 165 165 */ 166 166 extern void *plat_get_fdt(void); 167 + 168 + #ifdef CONFIG_RELOCATABLE 169 + 170 + /** 171 + * plat_fdt_relocated() - Update platform's information about relocated dtb 172 + * 173 + * This function provides a platform-independent API to set platform's 174 + * information about relocated DTB if it needs to be moved due to kernel 175 + * relocation occurring at boot. 176 + */ 177 + void plat_fdt_relocated(void *new_location); 178 + 179 + #endif /* CONFIG_RELOCATABLE */ 167 180 #endif /* CONFIG_USE_OF */ 168 181 169 182 #endif /* _ASM_BOOTINFO_H */