struct fdt_memory fb;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb);
+ err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb, NULL);
if (err < 0) {
if (err != -FDT_ERR_NOTFOUND)
printf("failed to get carveout for %s: %d\n", node,
struct fdt_memory fb;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb);
+ err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb, NULL);
if (err < 0) {
if (err != -FDT_ERR_NOTFOUND)
printf("failed to get carveout for %s: %d\n", node,
struct fdt_memory fb;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb);
+ err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb, NULL);
if (err < 0) {
if (err != -FDT_ERR_NOTFOUND)
printf("failed to get carveout for %s: %d\n", node,
*
* @param blob FDT blob
* @param node name of a node
- * @param name name of the property in the given node that contains
+ * @param prop_name name of the property in the given node that contains
* the phandle for the carveout
* @param index index of the phandle for which to read the carveout
* @param carveout return location for the carveout information
+ * @param name return location for the carveout name
* @return 0 on success or a negative error code on failure
*/
-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);
/**
* fdtdec_set_carveout() - sets a carveout region for a given node
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;
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;
}
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);
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)) {