From patchwork Fri Nov 16 01:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 998660 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42x0fR03kJz9sBQ for ; Fri, 16 Nov 2018 12:15:43 +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="VKGRPepD"; 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 42x0fQ4qhYzF3h6 for ; Fri, 16 Nov 2018 12:15:42 +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="VKGRPepD"; 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 42x0dN6l2XzF3gv for ; Fri, 16 Nov 2018 12:14:48 +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="VKGRPepD"; 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 42x0dN3JxTz9sBQ; Fri, 16 Nov 2018 12:14:48 +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=1542330888; bh=gtXzxu8r9yyCNCiTmCVy++Gzcy6nr6QGIGWc9wSfhrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKGRPepDlMdcm/kq+fPeMBNyRVFXZtIjEYulgQzKIFD8GlvlUerGUis4EmGGfXM/V 98E1o3gUaCkTX5XQSCxQ8csY4TsLdgdiqaZY9KHXXMh1nCXZr5I/DF5ZwHauyA5Ebn L/wPbAwJGuzcGAHbpbnCXKbMh+KeXgYFZBP2afavjoHaU+HGh37U7YAOYSimggTQKx Uwg+PJC4n6GicJ9nkE0qk9ZoYwofhkwhyfqaG2IM9zZYHhatGNuiL1el/dBEjb17Xx p+JvbU1ajVsR8gc41k4lJMi7hrNBbNkqRUge3y3RsNUi7UaFInR3xGqRiDJRtZuttk 0REBopt3BgTcQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 16 Nov 2018 12:14:28 +1100 Message-Id: <20181116011431.246208-14-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116011431.246208-1-amitay@ozlabs.org> References: <20181116011431.246208-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v4 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)