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

Amitay Isaacs amitay at ozlabs.org
Thu Oct 17 16:03:49 AEDT 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/istep.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

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;
 }
-- 
2.21.0



More information about the Pdbg mailing list