Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ofw OF properties are stored in big endian, but the ...



details:   https://anonhg.NetBSD.org/src/rev/4a9c65549e34
branches:  trunk
changeset: 812361:4a9c65549e34
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Dec 13 11:00:01 2015 +0000

description:
OF properties are stored in big endian, but the host might not be. Swap
the value of the "reg" property where appropriate.

diffstat:

 sys/dev/ofw/ofw_subr.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 7d65dbd8e3fb -r 4a9c65549e34 sys/dev/ofw/ofw_subr.c
--- a/sys/dev/ofw/ofw_subr.c    Sun Dec 13 04:55:12 2015 +0000
+++ b/sys/dev/ofw/ofw_subr.c    Sun Dec 13 11:00:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_subr.c,v 1.24 2015/12/12 22:22:51 jmcneill Exp $   */
+/*     $NetBSD: ofw_subr.c,v 1.25 2015/12/13 11:00:01 jmcneill Exp $   */
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.24 2015/12/12 22:22:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.25 2015/12/13 11:00:01 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -396,7 +396,7 @@
                        if (OF_getprop(node, "reg", &reg64, sizeof(reg64))
                            < sizeof(reg64))
                                continue;
-                       addr = reg64;
+                       addr = be64toh(reg64);
                        /*
                         * The i2c bus number (0 or 1) is encoded in bit 33
                         * of the register, but we encode it in bit 8 of
@@ -408,7 +408,7 @@
                        if (OF_getprop(node, "reg", &reg32, sizeof(reg32))
                            < sizeof(reg32))
                                continue;
-                       addr = reg32;
+                       addr = be32toh(reg32);
                } else {
                        continue;
                }



Home | Main Index | Thread Index | Old Index