[Pdbg] [PATCH v4 13/16] libpdbg: Add an api for address translation
Amitay Isaacs
amitay at ozlabs.org
Fri Nov 16 12:14:28 AEDT 2018
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
Reviewed-by: Alistair Popple <alistair at popple.id.au>
---
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)
--
2.19.1
More information about the Pdbg
mailing list