From patchwork Tue Oct 23 03:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 988008 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42fJvL4JGCz9sN6 for ; Tue, 23 Oct 2018 14:35:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42fJvL2L8yzDrq6 for ; Tue, 23 Oct 2018 14:35:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42fJtt6Qh1zDrqN for ; Tue, 23 Oct 2018 14:35:34 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42fJtt2Myyz9sNF; Tue, 23 Oct 2018 14:35:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au From: Alistair Popple To: pdbg@lists.ozlabs.org Date: Tue, 23 Oct 2018 14:35:23 +1100 Message-Id: <20181023033528.31256-5-alistair@popple.id.au> X-Mailer: git-send-email 2.11.0 Subject: [Pdbg] [PATCH] libpdbg: Add an api to get target address by class 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: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Alistair Popple --- libpdbg/libpdbg.h | 1 + libpdbg/target.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index b1d6655..ce11fff 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -91,6 +91,7 @@ const char *pdbg_target_dn_name(struct pdbg_target *target); void *pdbg_target_priv(struct pdbg_target *target); void pdbg_target_priv_set(struct pdbg_target *target, void *priv); struct pdbg_target *pdbg_target_root(void); +struct pdbg_target *pdbg_class_target_addr(struct pdbg_target *target, const char *name, uint64_t *addr); /* Procedures */ int fsi_read(struct pdbg_target *target, uint32_t addr, uint32_t *val); diff --git a/libpdbg/target.c b/libpdbg/target.c index 975ecec..fbcf792 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -32,6 +32,16 @@ static struct pdbg_target *get_class_target_addr(struct pdbg_target *target, con return target; } +struct pdbg_target *pdbg_class_target_addr(struct pdbg_target *target, const char *name, uint64_t *addr) +{ + uint64_t tmp; + + if (!addr) + addr = &tmp; + + return get_class_target_addr(target, name, addr); +} + /* The indirect access code was largely stolen from hw/xscom.c in skiboot */ #define PIB_IND_MAX_RETRIES 10 #define PIB_IND_READ PPC_BIT(0)