summaryrefslogtreecommitdiffstats
path: root/libpdbg/device.c
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2018-10-25 15:47:32 +1100
committerAlistair Popple <alistair@popple.id.au>2018-11-09 11:24:59 +1100
commit936dbdcedb27375c792006481f92b48685a08039 (patch)
treec2f58c55f1cfc89596c4c3799cb9e43e1634e172 /libpdbg/device.c
parent7bbd360cf6e3ee70440bf85682b862a877a643b0 (diff)
downloadpdbg-936dbdcedb27375c792006481f92b48685a08039.tar.gz
pdbg-936dbdcedb27375c792006481f92b48685a08039.zip
libpdbg: Rework target addressing
Clean up the target addressing functions and rename them to be consistent with other libpdbg function names. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
Diffstat (limited to 'libpdbg/device.c')
-rw-r--r--libpdbg/device.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libpdbg/device.c b/libpdbg/device.c
index a7212a6..5cd8302 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -658,17 +658,16 @@ static u32 dt_n_size_cells(const struct pdbg_target *node)
return dt_prop_get_u32_def(node->parent, "#size-cells", 1);
}
-u64 dt_get_address(const struct pdbg_target *node, unsigned int index,
- u64 *out_size)
+uint64_t pdbg_target_address(struct pdbg_target *target, uint64_t *out_size)
{
const struct dt_property *p;
- u32 na = dt_n_address_cells(node);
- u32 ns = dt_n_size_cells(node);
+ u32 na = dt_n_address_cells(target);
+ u32 ns = dt_n_size_cells(target);
u32 pos, n;
- p = dt_require_property(node, "reg", -1);
+ p = dt_require_property(target, "reg", -1);
n = (na + ns) * sizeof(u32);
- pos = n * index;
+ pos = n;
assert((pos + n) <= p->len);
if (out_size)
*out_size = dt_get_number(p->prop + pos + na * sizeof(u32), ns);
OpenPOWER on IntegriCloud