mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
fdt: Add fdtdec_get_uint64 to decode a 64-bit value from a property
It decodes a 64-bit value from a property that is at least 8 bytes long. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Gerald Van Baren
parent
79289c0b5f
commit
aadef0a1bc
13
lib/fdtdec.c
13
lib/fdtdec.c
@@ -111,6 +111,19 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
|
||||
return default_val;
|
||||
}
|
||||
|
||||
uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
|
||||
uint64_t default_val)
|
||||
{
|
||||
const uint64_t *cell64;
|
||||
int length;
|
||||
|
||||
cell64 = fdt_getprop(blob, node, prop_name, &length);
|
||||
if (!cell64 || length < sizeof(*cell64))
|
||||
return default_val;
|
||||
|
||||
return fdt64_to_cpu(*cell64);
|
||||
}
|
||||
|
||||
int fdtdec_get_is_enabled(const void *blob, int node)
|
||||
{
|
||||
const char *cell;
|
||||
|
Reference in New Issue
Block a user