From patchwork Thu Oct 3 04:19:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1171059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46kKZ24vqKz9sPJ for ; Thu, 3 Oct 2019 14:20:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="nnis2IeZ"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46kKZ20QNPzDqXN for ; Thu, 3 Oct 2019 14:20:58 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46kKX60gYpzDqWq for ; Thu, 3 Oct 2019 14:19:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="nnis2IeZ"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46kKX55bPWz9sDB; Thu, 3 Oct 2019 14:19:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1570076357; bh=F/+U7kJZ91MV0heRqgmYmyD0dCf3HoY4dklfbtL18o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnis2IeZzYvrf9hyqdWIuJ6vijIJ08dLtIUpbEwYtc8s40pWB507XHz/P6+lu1umz sBG4jaM9Wb/H/Jm7nef+902dTsw1zoDyxVoMDGElD0U/5XZABB98D0P4bwPW0tLFLC 5uvnGwPfr4cXyShFas/V3ORxfcgqfQ7nNJIZDssHJV5ZQ297YLw/vLQHpjAfHHqP4x 5uwNYt1+dhJWEfvdrQOY3gAMwSfslPX1WpuFurN4toy4lXUk2e8EP8mKxXASfqWDJo cYZd5E3KRnZqS09GctA/Ua++gDkZVdXlT3mGXEJGiTlbGZo/pGl+t13SS0FdGnb/Uo xW7KOjuYIGIyw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 3 Oct 2019 14:19:01 +1000 Message-Id: <20191003041909.23187-23-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191003041909.23187-1-amitay@ozlabs.org> References: <20191003041909.23187-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v4 22/30] libpdbg: Pass root node to dt_expand X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This will enable parsing more than one device tree. Signed-off-by: Amitay Isaacs Reviewed-by: Alistair Popple --- libpdbg/device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libpdbg/device.c b/libpdbg/device.c index d7cd980..3ed113c 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -604,7 +604,7 @@ static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_nod return nextoffset; } -static void dt_expand(void *root, const void *fdt) +static void dt_expand(struct pdbg_target *root, const void *fdt) { PR_DEBUG("FDT: Parsing fdt @%p\n", fdt); @@ -749,9 +749,6 @@ skip: void pdbg_targets_init(void *fdt) { - /* Root node needs to be valid when this function returns */ - pdbg_dt_root = dt_new_node("", NULL, 0); - if (!fdt) fdt = pdbg_default_dtb(); @@ -760,7 +757,12 @@ void pdbg_targets_init(void *fdt) return; } + /* Root node needs to be valid when this function returns */ + pdbg_dt_root = dt_new_node("", NULL, 0); + assert(pdbg_dt_root); + dt_expand(pdbg_dt_root, fdt); + pdbg_targets_init_virtual(pdbg_dt_root, pdbg_dt_root); }