[Pdbg] [PATCH 3/3] libpdbg: Add thread_sreset_all() api to sreset all threads

Amitay Isaacs amitay at ozlabs.org
Wed Jul 3 17:20:26 AEST 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/chip.c    | 12 ++++++++++++
 libpdbg/libpdbg.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 9034cb6..03de44f 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -154,6 +154,18 @@ int thread_sreset(struct pdbg_target *thread_target)
 	return thread->sreset(thread);
 }
 
+int thread_sreset_all(void)
+{
+	struct pdbg_target *thread;
+	int rc = 0;
+
+	pdbg_for_each_class_target("thread", thread) {
+		rc |= thread_sreset(thread);
+	}
+
+	return rc;
+}
+
 /*
  * RAMs the opcodes in *opcodes and store the results of each opcode
  * into *results. *results must point to an array the same size as
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index 9dd012d..ad43469 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -198,6 +198,7 @@ int thread_start(struct pdbg_target *target);
 int thread_step(struct pdbg_target *target, int steps);
 int thread_stop(struct pdbg_target *target);
 int thread_sreset(struct pdbg_target *target);
+int thread_sreset_all(void);
 struct thread_state thread_status(struct pdbg_target *target);
 
 int getring(struct pdbg_target *chiplet_target, uint64_t ring_addr, uint64_t ring_len, uint32_t result[]);
-- 
2.21.0



More information about the Pdbg mailing list