Module Name:    src
Committed By:   jakllsch
Date:           Mon Jun 11 19:54:39 UTC 2018

Modified Files:
        src/sys/dev/fdt: fdt_subr.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/fdt_subr.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/dev/fdt/fdt_subr.c
diff -u src/sys/dev/fdt/fdt_subr.c:1.21 src/sys/dev/fdt/fdt_subr.c:1.22
--- src/sys/dev/fdt/fdt_subr.c:1.21	Tue Mar  6 17:40:04 2018
+++ src/sys/dev/fdt/fdt_subr.c	Mon Jun 11 19:54:39 2018
@@ -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 <[email protected]>
@@ -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 @@ fdtbus_get_cells(const uint8_t *buf, int
 	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);
 	}
 }

Reply via email to