summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-04-02 13:18:41 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-05-15 08:31:36 +0200
commit96875e7d3b9900d0e63f0b591ff5693b31c4d9c3 (patch)
tree0960bc43115c34d73b07b67248a87a54217bde3a /lib
parent39007ec8cdd8ecfee659dca90f3b267b8e68da3c (diff)
downloadblackbird-obmc-uboot-96875e7d3b9900d0e63f0b591ff5693b31c4d9c3.tar.gz
blackbird-obmc-uboot-96875e7d3b9900d0e63f0b591ff5693b31c4d9c3.zip
fdt: Add function to locate an array in the device tree
fdtdec_locate_array() locates an integer array but does not copy it. This saves the caller having to allocated wasted space. Access to array elements should be through the fdt32_to_cpu() macro. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index bdec1a0d96..4a5ab712b5 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -363,6 +363,17 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
return err;
}
+const u32 *fdtdec_locate_array(const void *blob, int node,
+ const char *prop_name, int count)
+{
+ const u32 *cell;
+ int err;
+
+ cell = get_prop_check_min_len(blob, node, prop_name,
+ sizeof(u32) * count, &err);
+ return err ? NULL : cell;
+}
+
int fdtdec_get_bool(const void *blob, int node, const char *prop_name)
{
const s32 *cell;
OpenPOWER on IntegriCloud