diff options
| author | Casey Connolly <[email protected]> | 2026-04-01 16:15:20 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-04-21 11:19:49 -0600 |
| commit | 45c610d718bd605a1b3bdf99ec0386620b54b559 (patch) | |
| tree | eaf5d00fcc52f9cedd45a17c575a9516ef3b568d /lib | |
| parent | 139f5292e7985d0326a1d18eee88720255e423dc (diff) | |
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 <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/fdtdec.c | 18 |
1 files changed, 18 insertions, 0 deletions
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) { |
