summaryrefslogtreecommitdiff
path: root/sys/dev/ofw/fdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ofw/fdt.c')
-rw-r--r--sys/dev/ofw/fdt.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/ofw/fdt.c b/sys/dev/ofw/fdt.c
index 9646d74eeb8..62ca7392c45 100644
--- a/sys/dev/ofw/fdt.c
+++ b/sys/dev/ofw/fdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdt.c,v 1.25 2020/07/18 09:44:59 kettenis Exp $ */
+/* $OpenBSD: fdt.c,v 1.26 2020/12/30 06:06:31 gkoehler Exp $ */
/*
* Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
@@ -1005,6 +1005,22 @@ OF_getpropint64(int handle, char *prop, uint64_t defval)
}
int
+OF_getpropint64array(int handle, char *prop, uint64_t *buf, int buflen)
+{
+ int len;
+ int i;
+
+ len = OF_getprop(handle, prop, buf, buflen);
+ if (len < 0 || (len % sizeof(uint64_t)))
+ return -1;
+
+ for (i = 0; i < len / sizeof(uint64_t); i++)
+ buf[i] = betoh64(buf[i]);
+
+ return len;
+}
+
+int
OF_nextprop(int handle, char *prop, void *nextprop)
{
void *node = (char *)tree.header + handle;