Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Fix fdtbus_get_cells(, 2) when running big endian.



details:   https://anonhg.NetBSD.org/src/rev/950f89e08bbb
branches:  trunk
changeset: 323344:950f89e08bbb
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Jun 11 19:54:39 2018 +0000

description:
Fix fdtbus_get_cells(, 2) when running big endian.

diffstat:

 sys/dev/fdt/fdt_subr.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 33544e66f1bb -r 950f89e08bbb sys/dev/fdt/fdt_subr.c
--- a/sys/dev/fdt/fdt_subr.c    Mon Jun 11 19:49:18 2018 +0000
+++ b/sys/dev/fdt/fdt_subr.c    Mon Jun 11 19:54:39 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.21 2018/03/06 17:40:04 bouyer Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.22 2018/06/11 19:54:39 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.21 2018/03/06 17:40:04 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.22 2018/06/11 19:54:39 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -156,7 +156,7 @@
        switch (cells) {
        case 0:         return 0;
        case 1:         return be32dec(buf);
-       case 2:         return be64dec(buf);
+       case 2:         return ((uint64_t)be32dec(buf)<<32)|be32dec(buf+4);
        default:        panic("fdtbus_get_cells: bad cells val %d\n", cells);
        }
 }



Home | Main Index | Thread Index | Old Index