From patchwork Thu Nov 15 07:19:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 998138 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wXns1cyYz9sCQ for ; Thu, 15 Nov 2018 18:20:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (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="UWhOoQx7"; 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 42wXnr5ZfgzF3c9 for ; Thu, 15 Nov 2018 18:20:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="UWhOoQx7"; dkim-atps=neutral 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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42wXmt0TgFzF3bw for ; Thu, 15 Nov 2018 18:19:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (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="UWhOoQx7"; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42wXms5WXVz9sCQ; Thu, 15 Nov 2018 18:19:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1542266381; bh=ydxJ8IDu7Y0cY0fv07c/rJKO1sjC+FuFEIqUl2Oln3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWhOoQx7YdG4GjoW7nnMtr+VC44NTFGyUH6ovumewUzvaOZEAMsvShbA8Iyq68QEn XsFqrPqkcdUcdyEthcTWp7PioIbtQpvD5KgSQM7HmkhrzWmrE1Xxy2oAlkM+Z7rWbw ms4+bTiGIo9PIwU0cWVr3NATyD69LT3GBE47cRkZm2h7Hlr+gbAcX+t492jXw7MOOa PxWBUoxFxn4Gg2OpVZAWR3KZWcEiH5U2roUae/hCbYsClMvc+RKzlkEvhjcYoavUoy ZlQaDQhDe51MRwC/Zsos21C287iiW6uUX2DPKGpkyiYNO42FvNvsLUMkr7gczHjJtJ SFKp1h44CnGnA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 15 Nov 2018 18:19:26 +1100 Message-Id: <20181115071929.206974-14-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115071929.206974-1-amitay@ozlabs.org> References: <20181115071929.206974-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v3 13/16] libpdbg: Add an api for address translation 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/libpdbg.h | 4 ++++ libpdbg/target.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index f55acf4..44540e4 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -117,6 +117,10 @@ void pdbg_target_priv_set(struct pdbg_target *target, void *priv); struct pdbg_target *pdbg_target_root(void); bool pdbg_target_compatible(struct pdbg_target *target, const char *compatible); +/* Translate an address offset for a target to absolute address in address + * space of a "base" target. */ +struct pdbg_target *pdbg_address_absolute(struct pdbg_target *target, uint64_t *addr); + /* Procedures */ int fsi_read(struct pdbg_target *target, uint32_t addr, uint32_t *val); int fsi_write(struct pdbg_target *target, uint32_t addr, uint32_t val); diff --git a/libpdbg/target.c b/libpdbg/target.c index 1fc8457..af9199d 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -36,6 +36,11 @@ static struct pdbg_target *get_class_target_addr(struct pdbg_target *target, con return target; } +struct pdbg_target *pdbg_address_absolute(struct pdbg_target *target, uint64_t *addr) +{ + return get_class_target_addr(target, "pib", 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)