From patchwork Fri Jul 24 06:50:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 499607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0E41F1402A0 for ; Fri, 24 Jul 2015 16:51:26 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id E742E1A09DB for ; Fri, 24 Jul 2015 16:51:25 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id B636A1A0743 for ; Fri, 24 Jul 2015 16:51:01 +1000 (AEST) Received: by ozlabs.org (Postfix, from userid 1023) id 9A78D140B04; Fri, 24 Jul 2015 16:51:01 +1000 (AEST) MIME-Version: 1.0 Message-Id: <1437720657.166663.906213462701.4.gpush@pablo> In-Reply-To: <1437720657.165281.93625520876.0.gpush@pablo> To: skiboot@lists.ozlabs.org From: Jeremy Kerr Date: Fri, 24 Jul 2015 14:50:57 +0800 Subject: [Skiboot] [PATCH 4/7 v2] core/mem_region: allow pre-existing reserved-memory nodes X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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(®ions, region, list) {