diff mbox series

[v5,15/19] libpdbg: Remove special case thread procedures using sbefifo

Message ID 20200430023440.225504-16-amitay@ozlabs.org
State Accepted
Headers show
Series Add sbefifo backend | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (6c10b68bf774a9fe21affd5ef0b40084cd49800d)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Amitay Isaacs April 30, 2020, 2:34 a.m. UTC
Always check if the all thread procedures are provided by pib.  If not,
use individual thread operations.

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
Reviewed-by: Alistair Popple <alistair@popple.id.au>
---
 libpdbg/chip.c | 60 +++++++++++++++++---------------------------------
 1 file changed, 20 insertions(+), 40 deletions(-)
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 848a831..86e91bd 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -156,21 +156,16 @@  int thread_sreset(struct pdbg_target *thread_target)
 
 int thread_step_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_step_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_step(chipop, 0xff, 0xf);
+		rc |= pib->thread_step_all(pib, 1);
 		count++;
 	}
 
@@ -189,21 +184,16 @@  int thread_step_all(void)
 
 int thread_start_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_start_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_start(chipop, 0xff, 0xf);
+		rc |= pib->thread_start_all(pib);
 		count++;
 	}
 
@@ -222,21 +212,16 @@  int thread_start_all(void)
 
 int thread_stop_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_stop_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_stop(chipop, 0xff, 0xf);
+		rc |= pib->thread_stop_all(pib);
 		count++;
 	}
 
@@ -255,21 +240,16 @@  int thread_stop_all(void)
 
 int thread_sreset_all(void)
 {
-	struct pdbg_target *pib, *thread;
+	struct pdbg_target *target, *thread;
 	int rc = 0, count = 0;
 
-	pdbg_for_each_class_target("pib", pib) {
-		struct chipop *chipop;
+	pdbg_for_each_class_target("pib", target) {
+		struct pib *pib = target_to_pib(target);
 
-		chipop = pib_to_chipop(pib);
-		if (!chipop)
+		if (!pib->thread_sreset_all)
 			break;
 
-		/*
-		 * core_id = 0xff (all SMT4 cores)
-		 * thread_id = 0xf (all 4 threads in the SMT4 core)
-		 */
-		rc |= chipop->thread_sreset(chipop, 0xff, 0xf);
+		rc |= pib->thread_sreset_all(pib);
 		count++;
 	}