[Skiboot] [PATCH 4/7 v3] core/mem_region: allow pre-existing reserved-memory nodes

Jeremy Kerr jk at ozlabs.org
Mon Aug 17 16:49:53 AEST 2015


If the HB device tree provides a top-level reserved-memory node, we'll
abort(). We want to be able to handle a pre-populated reserved-memory
node in a future change, so handle this case gracefully.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---
 core/mem_region.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/mem_region.c b/core/mem_region.c
index f46afda..f4cab8c 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -1011,10 +1011,13 @@ void mem_region_add_dt_reserved(void)
 	mem_regions_finalised = true;
 
 	/* establish top-level reservation node */
-	node = dt_new(dt_root, "reserved-memory");
-	dt_add_property_cells(node, "#address-cells", 2);
-	dt_add_property_cells(node, "#size-cells", 2);
-	dt_add_property(node, "ranges", NULL, 0);
+	node = dt_find_by_path(dt_root, "reserved-memory");
+	if (!node) {
+		node = dt_new(dt_root, "reserved-memory");
+		dt_add_property_cells(node, "#address-cells", 2);
+		dt_add_property_cells(node, "#size-cells", 2);
+		dt_add_property(node, "ranges", NULL, 0);
+	}
 
 	/* First pass: calculate length of property data */
 	list_for_each(&regions, region, list) {


More information about the Skiboot mailing list