summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2011-05-03 13:24:08 -0500
committerKumar Gala <galak@kernel.crashing.org>2011-07-29 08:53:39 -0500
commit90f89f099d0741ed5557adbce4a2dde96887a824 (patch)
treee0fcc251d49ee7742d02bfd28a4d1d4a5d40dcc7 /arch/powerpc/lib
parent21cd5815a7e956e689ac78be2ade05e61fd5dce7 (diff)
downloadblackbird-obmc-uboot-90f89f099d0741ed5557adbce4a2dde96887a824.tar.gz
blackbird-obmc-uboot-90f89f099d0741ed5557adbce4a2dde96887a824.zip
powerpc/85xx: verify the device tree before booting Linux
Introduce ft_verify_fdt(), a function that is called after the device tree has been fixed up, that displays warning messages if there is a mismatch between the physical addresses of some devices that U-Boot has configured with what the device tree says the addresses are. This is a particular problem when booting a 36-bit device tree from a 32-bit U-Boot (or vice versa), because the physical address of CCSR is wrong in the device tree. When the operating system boots, no messages are displayed, so the user generally has no idea what's wrong. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/bootm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 05adadabb7..137547451b 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -226,6 +226,24 @@ static int boot_bd_t_linux(bootm_headers_t *images)
return ret;
}
+/*
+ * Verify the device tree.
+ *
+ * This function is called after all device tree fix-ups have been enacted,
+ * so that the final device tree can be verified. The definition of "verified"
+ * is up to the specific implementation. However, it generally means that the
+ * addresses of some of the devices in the device tree are compared with the
+ * actual addresses at which U-Boot has placed them.
+ *
+ * Returns 1 on success, 0 on failure. If 0 is returned, U-boot will halt the
+ * boot process.
+ */
+static int __ft_verify_fdt(void *fdt)
+{
+ return 1;
+}
+__attribute__((weak, alias("__ft_verify_fdt"))) int ft_verify_fdt(void *fdt);
+
static int boot_body_linux(bootm_headers_t *images)
{
ulong rd_len;
@@ -298,6 +316,9 @@ static int boot_body_linux(bootm_headers_t *images)
/* fixup the initrd now that we know where it should be */
if (*initrd_start && *initrd_end)
fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1);
+
+ if (!ft_verify_fdt(*of_flat_tree))
+ return -1;
}
#endif /* CONFIG_OF_LIBFDT */
return 0;
OpenPOWER on IntegriCloud