Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/fdt If the total size of the DTB exceeds our...



details:   https://anonhg.NetBSD.org/src/rev/813ec4753730
branches:  trunk
changeset: 433725:813ec4753730
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Sep 29 20:58:31 2018 +0000

description:
If the total size of the DTB exceeds our static storage, attempt to pack
it in place to make it fit.

diffstat:

 sys/arch/evbarm/fdt/fdt_machdep.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 225aaf623ef8 -r 813ec4753730 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Sat Sep 29 19:45:18 2018 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Sat Sep 29 20:58:31 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        /* 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));



Home | Main Index | Thread Index | Old Index