Commit 5e7c1c91 authored by Matt Redfearn's avatar Matt Redfearn Committed by Ralf Baechle

MIPS: Introduce plat_get_fdt a platform API to retrieve the FDT

Early access to the kernel command line requires early access to the FDT
for platforms which pass the command line within the device tree. There
was no common way to retrieve the location of the FDT without incurring
side effects, such as plat_mem_setup which, on Malta at least,
initializes a bunch of other stuff.

This patch adds plat_get_ftd() for IMG platforms.
Signed-off-by: default avatarMatt Redfearn <matt.redfearn@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: kernel-hardening@lists.openwall.com
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/12988/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 8c530ea3
...@@ -144,4 +144,22 @@ static inline void plat_swiotlb_setup(void) {} ...@@ -144,4 +144,22 @@ static inline void plat_swiotlb_setup(void) {}
#endif /* CONFIG_SWIOTLB */ #endif /* CONFIG_SWIOTLB */
#ifdef CONFIG_USE_OF
/**
* plat_get_fdt() - Return a pointer to the platform's device tree blob
*
* This function provides a platform independent API to get a pointer to the
* flattened device tree blob. The interface between bootloader and kernel
* is not consistent across platforms so it is necessary to provide this
* API such that common startup code can locate the FDT.
*
* This is used by the KASLR code to get command line arguments and random
* seed from the device tree. Any platform wishing to use KASLR should
* provide this API and select SYS_SUPPORTS_RELOCATABLE.
*
* Return: Pointer to the flattened device tree blob.
*/
extern void *plat_get_fdt(void);
#endif /* CONFIG_USE_OF */
#endif /* _ASM_BOOTINFO_H */ #endif /* _ASM_BOOTINFO_H */
...@@ -248,10 +248,15 @@ static void __init bonito_quirks_setup(void) ...@@ -248,10 +248,15 @@ static void __init bonito_quirks_setup(void)
#endif #endif
} }
void __init *plat_get_fdt(void)
{
return (void *)__dtb_start;
}
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
{ {
unsigned int i; unsigned int i;
void *fdt = __dtb_start; void *fdt = plat_get_fdt();
fdt = malta_dt_shim(fdt); fdt = malta_dt_shim(fdt);
__dt_setup_arch(fdt); __dt_setup_arch(fdt);
......
...@@ -83,6 +83,11 @@ static void __init parse_memsize_param(void) ...@@ -83,6 +83,11 @@ static void __init parse_memsize_param(void)
} }
} }
void __init *plat_get_fdt(void)
{
return (void *)__dtb_start;
}
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
{ {
/* allow command line/bootloader env to override memory size in DT */ /* allow command line/bootloader env to override memory size in DT */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment