From patchwork Fri Sep 20 05:16:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1165015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46ZMSK1Dtsz9sCJ for ; Fri, 20 Sep 2019 15:18:25 +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="WldnIY8A"; 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 46ZMSJ6RFWzF3gZ for ; Fri, 20 Sep 2019 15:18:24 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (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 46ZMQm26k6zF3dd for ; Fri, 20 Sep 2019 15:17:04 +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="WldnIY8A"; 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 46ZMQm0LYXz9sDB; Fri, 20 Sep 2019 15:17:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1568956624; bh=Ln7LnFVyA/O5+Um+huJPW8qTMFgI180AqEkj1ZMT6aE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WldnIY8AQ295f/zwOpTKnq0GOLRX7GHiOcrNS5KIfFtDkRFtjjhz7NQJYWk5hNlf6 Vwxm/to+JbRQ9WqX++yIXJxLzvsOVqNdlCBtwQBEEy0CCqk0RYJ/V1f0TaAlB8kpfL fVooiTcLDze8aKskHVCIuK4rQcLMRjhI8yTq2UF0xY3RxYya6QCXBSmnTkzFwV+tGb tBqYnVMwAsjxHpCxOfM+I1iT3+G0NYh4hM/pU4F1bdbA4OPFR8zjQBrEJNnlaW+Z2t xrZPOCD7hZT/2WoIGVPliYTKptRS5hgzCaMB3NqjoSnflbd4A/ougjWIIgLnbqlSpC oreuNvG0n5tlQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 20 Sep 2019 15:16:43 +1000 Message-Id: <20190920051651.9620-19-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920051651.9620-1-amitay@ozlabs.org> References: <20190920051651.9620-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 14/22] 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 --- libpdbg/device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libpdbg/device.c b/libpdbg/device.c index 77eac21..0742c2b 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -602,7 +602,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); @@ -733,9 +733,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(); @@ -744,7 +741,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); }