summaryrefslogtreecommitdiff
path: root/sys/dev/ofw/openfirm.c
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-10-22 20:57:24 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-10-22 20:57:24 +0000
commit29fdf9ef00a14b61a7afb354582a121a33c60e7b (patch)
tree90ab8376158617b05727c00d24bc2aabed68cda9 /sys/dev/ofw/openfirm.c
parentc40ecff1b27dc8b78f87a8349221863cdad7cc05 (diff)
Notes
Diffstat (limited to 'sys/dev/ofw/openfirm.c')
-rw-r--r--sys/dev/ofw/openfirm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c
index 0760854079c7..95b78c596300 100644
--- a/sys/dev/ofw/openfirm.c
+++ b/sys/dev/ofw/openfirm.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/systm.h>
+#include <sys/endian.h>
#include <machine/stdarg.h>
@@ -280,6 +281,21 @@ OF_getprop(phandle_t package, const char *propname, void *buf, size_t buflen)
return (OFW_GETPROP(ofw_obj, package, propname, buf, buflen));
}
+ssize_t
+OF_getencprop(phandle_t node, const char *propname, pcell_t *buf, size_t len)
+{
+ ssize_t retval;
+ int i;
+
+ KASSERT(len % 4 == 0, "Need a multiple of 4 bytes");
+
+ retval = OF_getprop(node, propname, buf, len);
+ for (i = 0; i < len/4; i++)
+ buf[i] = be32toh(buf[i]);
+
+ return (retval);
+}
+
/*
* Recursively search the node and its parent for the given property, working
* downward from the node to the device tree root. Returns the value of the