Module Name: src
Committed By: jmcneill
Date: Sat Sep 29 20:58:31 UTC 2018
Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
Log Message:
If the total size of the DTB exceeds our static storage, attempt to pack
it in place to make it fit.
To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/fdt/fdt_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.40 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.41
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.40 Sat Sep 29 15:50:29 2018
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c Sat Sep 29 20:58:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.40 2018/09/29 15:50:29 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.41 2018/09/29 20:58:31 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.40 2018/09/29 15:50:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.41 2018/09/29 20:58:31 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_bootconfig.h"
@@ -377,6 +377,9 @@ initarm(void *arg)
/* Load FDT */
int error = fdt_check_header(fdt_addr_r);
if (error == 0) {
+ /* If the DTB is too big, try to pack it in place first. */
+ if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data))
+ (void)fdt_pack(__UNCONST(fdt_addr_r));
error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));
if (error != 0)
panic("fdt_move failed: %s", fdt_strerror(error));