Module Name: src
Committed By: jmcneill
Date: Sun Dec 13 11:00:02 UTC 2015
Modified Files:
src/sys/dev/ofw: ofw_subr.c
Log Message:
OF properties are stored in big endian, but the host might not be. Swap
the value of the "reg" property where appropriate.
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ofw/ofw_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/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.24 src/sys/dev/ofw/ofw_subr.c:1.25
--- src/sys/dev/ofw/ofw_subr.c:1.24 Sat Dec 12 22:22:51 2015
+++ src/sys/dev/ofw/ofw_subr.c Sun Dec 13 11:00:01 2015
@@ -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 @@ of_enter_i2c_devs(prop_dictionary_t prop
if (OF_getprop(node, "reg", ®64, 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 @@ of_enter_i2c_devs(prop_dictionary_t prop
if (OF_getprop(node, "reg", ®32, sizeof(reg32))
< sizeof(reg32))
continue;
- addr = reg32;
+ addr = be32toh(reg32);
} else {
continue;
}