aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-08-17 14:49:53 +0800
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-08-17 17:04:14 +1000
commit29f62984d7c62c9bec7eb422f6ca1e24431bd5a7 (patch)
treecde696664126102b5286473f88e697c845662a55
parent03676d28dd4f2c05c9a1f1c695ded90182458d8b (diff)
downloadskiboot-29f62984d7c62c9bec7eb422f6ca1e24431bd5a7.zip
skiboot-29f62984d7c62c9bec7eb422f6ca1e24431bd5a7.tar.gz
skiboot-29f62984d7c62c9bec7eb422f6ca1e24431bd5a7.tar.bz2
core/mem_region: allow pre-existing reserved-memory nodes
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@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/mem_region.c11
1 files 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) {