[Pdbg] [PATCH] libpdbg: Add an api to get target address by class
Alistair Popple
alistair at popple.id.au
Tue Oct 23 14:35:23 AEDT 2018
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
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)
--
2.11.0
More information about the Pdbg
mailing list