@@ -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;
}
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/istep.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)