diff mbox series

[v2,2/3] istep: Use the first sbefifo to run isteps

Message ID 20191017050350.26820-3-amitay@ozlabs.org
State Superseded
Headers show
Series Improve istep command usability | 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 Oct. 17, 2019, 5:03 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 src/istep.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/src/istep.c b/src/istep.c
index 810d42e..bdb13b3 100644
--- a/src/istep.c
+++ b/src/istep.c
@@ -34,8 +34,21 @@  struct istep_data {
 
 static int istep(uint32_t major, uint32_t minor)
 {
-	struct pdbg_target *target;
-	int count = 0, i;
+	struct pdbg_target *pib;
+	int count = 0, i, rc;
+
+	for_each_path_target_class("pib", pib) {
+		if (pdbg_target_index(pib))
+			continue;
+
+		if (pdbg_target_status(pib) == PDBG_TARGET_ENABLED)
+			break;
+	}
+
+	if (pib == NULL) {
+		fprintf(stderr, "No processor found to run isteps\n");
+		return 0;
+	}
 
 	if (major < 2 || major > 5) {
 		fprintf(stderr, "Istep major should be 2 to 5\n");
@@ -56,16 +69,9 @@  static int istep(uint32_t major, uint32_t minor)
 		}
 	}
 
-	for_each_path_target_class("pib", target) {
-		int rc;
-
-		if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
-			continue;
-
-		rc = sbe_istep(target, major, minor);
-		if (!rc)
-			count++;
-	}
+	rc = sbe_istep(pib, major, minor);
+	if (!rc)
+		count++;
 
 	return count;
 }