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 <casey.connolly@linaro.org>
This commit is contained in:
Casey Connolly
2026-04-01 16:15:20 +02:00
committed by Tom Rini
parent 139f5292e7
commit 45c610d718
6 changed files with 204 additions and 0 deletions

View File

@@ -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)
{