summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/fdtdec.c12
-rw-r--r--lib/fdtdec_test.c3
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index f2861eb395d..3ada77d80c5 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1406,8 +1406,9 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
return 0;
}
-int fdtdec_get_carveout(const void *blob, const char *node, const char *name,
- unsigned int index, struct fdt_memory *carveout)
+int fdtdec_get_carveout(const void *blob, const char *node,
+ const char *prop_name, unsigned int index,
+ struct fdt_memory *carveout, const char **name)
{
const fdt32_t *prop;
uint32_t phandle;
@@ -1418,9 +1419,9 @@ int fdtdec_get_carveout(const void *blob, const char *node, const char *name,
if (offset < 0)
return offset;
- prop = fdt_getprop(blob, offset, name, &len);
+ prop = fdt_getprop(blob, offset, prop_name, &len);
if (!prop) {
- debug("failed to get %s for %s\n", name, node);
+ debug("failed to get %s for %s\n", prop_name, node);
return -FDT_ERR_NOTFOUND;
}
@@ -1442,6 +1443,9 @@ int fdtdec_get_carveout(const void *blob, const char *node, const char *name,
return offset;
}
+ if (name)
+ *name = fdt_get_name(blob, offset, NULL);
+
carveout->start = fdtdec_get_addr_size_auto_noparent(blob, offset,
"reg", 0, &size,
true);
diff --git a/lib/fdtdec_test.c b/lib/fdtdec_test.c
index e0c6e0971cd..760aca2669d 100644
--- a/lib/fdtdec_test.c
+++ b/lib/fdtdec_test.c
@@ -214,7 +214,8 @@ static int check_fdt_carveout(void *fdt, uint32_t address_cells,
printf("carveout: %pap-%pap na=%u ns=%u: ", &expected.start,
&expected.end, address_cells, size_cells);
- CHECK(fdtdec_get_carveout(fdt, name, "memory-region", 0, &carveout));
+ CHECK(fdtdec_get_carveout(fdt, name, "memory-region", 0, &carveout,
+ NULL));
if ((carveout.start != expected.start) ||
(carveout.end != expected.end)) {