diff mbox series

[v2,16/19] libpdbg: Remove special case thread procedures using sbefifo

Message ID 20200407061613.21325-17-amitay@ozlabs.org
State Superseded
Headers show
Series Add sbefifo backend | expand

Checks

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

Commit Message

Amitay Isaacs April 7, 2020, 6:16 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>
---
 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 b961e87..4ab5a4c 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++;
 	}