From patchwork Wed Jan 15 05:18:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1223177 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 47yFxl36kwz9sRV for ; Wed, 15 Jan 2020 16:19:39 +1100 (AEDT) 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.a=rsa-sha256 header.s=201707 header.b=jgTcJTDM; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47yFxl1KLHzDqFS for ; Wed, 15 Jan 2020 16:19:39 +1100 (AEDT) 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) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47yFxJ2jdGzDqDt for ; Wed, 15 Jan 2020 16:19:16 +1100 (AEDT) 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.a=rsa-sha256 header.s=201707 header.b=jgTcJTDM; 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 47yFxH4h2Dz9sR0; Wed, 15 Jan 2020 16:19:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1579065555; bh=1+t/10GFgPymrk1k+mY6k4TYOuMfp+x5hdNYDbIUHTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgTcJTDMO207EYEV/WKIa3ze1GOTsCG86IneUDXzz/38NF9Ui8yHWJ7eBz7n1xphw 3QF2CNz0Sogk9h7UXBmc519NWGC4UdqOClkB0yYKtkdv/Ae+SemDmReOjDScGlHUoC 4yz1MDiBCAGrfgqvuRzFf3jL15yhdicdbUYhuKOx4jn6IFEMqnzcnMoyyG34SDbTz1 Gy+8rrQ040D8cEFW/yhkeMRMitTPDKxdGLCmoDZxChipPqNU9FiB1b0OnuNP8MrrMu XChxdD3SH+TFb8zJ2zhtfvijymkRWjXmtTO029pqlZkDKsAUxhgIGOCxFDLUB4mlKT KWdnKsiV8bfQg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 15 Jan 2020 16:18:49 +1100 Message-Id: <20200115051901.17514-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200115051901.17514-1-amitay@ozlabs.org> References: <20200115051901.17514-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 01/13] libpdbg: Cache device tree pointer and offset for each node 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" Signed-off-by: Amitay Isaacs Reviewed-by: Alistair Popple --- libpdbg/device.c | 9 ++++++--- libpdbg/target.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libpdbg/device.c b/libpdbg/device.c index ad498dc..ac2351d 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -115,7 +115,7 @@ static struct pdbg_target *dt_pdbg_target_new(const void *fdt, int node_offset) return target; } -static struct pdbg_target *dt_new_node(const char *name, const void *fdt, int node_offset) +static struct pdbg_target *dt_new_node(const char *name, void *fdt, int node_offset) { struct pdbg_target *node = NULL; size_t size = sizeof(*node); @@ -131,6 +131,9 @@ static struct pdbg_target *dt_new_node(const char *name, const void *fdt, int no abort(); } + node->fdt = fdt; + node->fdt_offset = fdt ? node_offset : -1; + node->dn_name = take_name(name); node->parent = NULL; list_head_init(&node->properties); @@ -547,7 +550,7 @@ static enum pdbg_target_status str_to_status(const char *status) assert(0); } -static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_node) +static int dt_expand_node(struct pdbg_target *node, void *fdt, int fdt_node) { const struct fdt_property *prop; int offset, nextoffset, err; @@ -604,7 +607,7 @@ static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_nod return nextoffset; } -static void dt_expand(struct pdbg_target *root, const void *fdt) +static void dt_expand(struct pdbg_target *root, void *fdt) { PR_DEBUG("FDT: Parsing fdt @%p\n", fdt); diff --git a/libpdbg/target.h b/libpdbg/target.h index a8f777d..9e25a43 100644 --- a/libpdbg/target.h +++ b/libpdbg/target.h @@ -39,6 +39,8 @@ struct pdbg_target { int (*probe)(struct pdbg_target *target); void (*release)(struct pdbg_target *target); uint64_t (*translate)(struct pdbg_target *target, uint64_t addr); + void *fdt; + int fdt_offset; int index; enum pdbg_target_status status; const char *dn_name;