[Pdbg] [PATCH] libpdbg/host.c: Use reg property index of index to find chip-id
Alistair Popple
alistair at popple.id.au
Mon Oct 14 16:50:04 AEDT 2019
The host backend needs the hardware chip-id to find the correct
debugfs xscom file but incorrectly derives this from the index. This
means the chip path contains the actual chip-id rather than the index
which should be a logcal index starting at zero as it does for all
other backends.
This patch updates the host backend to use reg property for the
chip-id. A future patch will alter the device-trees to make this the
case.
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
libpdbg/host.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libpdbg/host.c b/libpdbg/host.c
index 061ff2a..428c18b 100644
--- a/libpdbg/host.c
+++ b/libpdbg/host.c
@@ -85,9 +85,10 @@ static int host_pib_probe(struct pdbg_target *target)
struct pib *pib = target_to_pib(target);
int fd;
char *access_fn;
- uint32_t index;
+ uint32_t chip;
- index = pdbg_target_index(target);
+ if (pdbg_target_u32_property(target, "reg", &chip))
+ return -1;
/* This check should probably be done earlier */
if (access(XSCOM_BASE_PATH, F_OK) == -1)
@@ -97,7 +98,7 @@ static int host_pib_probe(struct pdbg_target *target)
PR_ERROR("You may need to re-run the command as root.\n");
}
- if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, index) < 0)
+ if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, chip) < 0)
return -1;
fd = open(access_fn, O_RDWR);
--
2.20.1
More information about the Pdbg
mailing list