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 Fix the calculation of the end address o...



details:   https://anonhg.NetBSD.org/src/rev/b7b926cddb0f
branches:  trunk
changeset: 828450:b7b926cddb0f
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Dec 14 11:39:31 2017 +0000

description:
Fix the calculation of the end address of a reserved memory range.
>From Nick. Makes my CubieTruck boot again.

diffstat:

 sys/arch/evbarm/fdt/fdt_machdep.c |  21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (53 lines):

diff -r bdeaf1813788 -r b7b926cddb0f sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Thu Dec 14 10:39:32 2017 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Thu Dec 14 11:39:31 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.17 2017/12/13 00:22:24 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.18 2017/12/14 11:39:31 martin 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.17 2017/12/13 00:22:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.18 2017/12/14 11:39:31 martin Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -178,17 +178,16 @@
 void
 fdt_add_reserved_memory_range(uint64_t addr, uint64_t size)
 {
-       int error;
+       uint64_t start = trunc_page(addr);
+       uint64_t end = round_page(addr + size);
 
-       addr = trunc_page(addr);
-       size = round_page(size);
-
-       error = extent_free(fdt_memory_ext, addr, size, EX_NOWAIT);
+       int error = extent_free(fdt_memory_ext, start,
+            end - start, EX_NOWAIT);
        if (error != 0)
                printf("MEM ERROR: res %llx-%llx failed: %d\n",
-                   addr, addr + size, error);
+                   start, end, error);
        else
-               DPRINTF("MEM: res %llx-%llx\n", addr, addr + size);
+               DPRINTF("MEM: res %llx-%llx\n", start, end);
 }
 
 /*
@@ -242,8 +241,8 @@
                    EX_NOWAIT);
                if (error != 0)
                        printf("MEM ERROR: add %llx-%llx failed: %d\n",
-                           addr, size, error);
-               DPRINTF("MEM: add %llx-%llx\n", addr, size);
+                           addr, addr + size, error);
+               DPRINTF("MEM: add %llx-%llx\n", addr, addr + size);
        }
 
        fdt_add_reserved_memory(max_addr);



Home | Main Index | Thread Index | Old Index