From 45c610d718bd605a1b3bdf99ec0386620b54b559 Mon Sep 17 00:00:00 2001 From: Casey Connolly Date: Wed, 1 Apr 2026 16:15:20 +0200 Subject: ofnode: add read_u64_array and count_elems_of_size These are similar to their Linux counterparts, adding helpers for reading arrays of 64-bit values with of_access and fdtdec implementations. Signed-off-by: Casey Connolly --- lib/fdtdec.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/fdtdec.c') diff --git a/lib/fdtdec.c b/lib/fdtdec.c index c38738b48c7..e23e53f58f2 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -714,6 +714,24 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name, return err; } +int fdtdec_get_long_array(const void *blob, int node, const char *prop_name, + u64 *array, int count) +{ + const u64 *cell; + int err = 0; + + debug("%s: %s\n", __func__, prop_name); + cell = get_prop_check_min_len(blob, node, prop_name, + sizeof(u64) * count, &err); + if (!err) { + int i; + + for (i = 0; i < count; i++) + array[i] = fdt64_to_cpu(cell[i]); + } + return err; +} + int fdtdec_get_int_array_count(const void *blob, int node, const char *prop_name, u32 *array, int count) { -- cgit v1.3.1