Message ID | 20190704081133.7818-3-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Improve istep command usability | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (6a4185ca278930693a6edb6d003267f74df3d2e8) |
snowpatch_ozlabs/build-multiarch | success | Test build-multiarch on branch master |
Does this just affect the default sbefifo? Ie. does it prevent a user explicitly targeting the secondary sbefifo with -P sbefifo1 ? Seems like we should be able to target either (although to be honest I'm not sure how much sense that makes in practice as I haven't tried starting the secondary SBE yet). - Alistair On Thursday, 4 July 2019 6:11:32 PM AEST Amitay Isaacs wrote: > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > src/istep.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/src/istep.c b/src/istep.c > index a9acbe7..a141a31 100644 > --- a/src/istep.c > +++ b/src/istep.c > @@ -34,8 +34,18 @@ struct istep_data { > > static int istep(uint32_t major, uint32_t minor) > { > - struct pdbg_target *target; > - int count = 0, i; > + struct pdbg_target *sbefifo; > + int count = 0, i, rc; > + > + for_each_path_target_class("sbefifo", sbefifo) { > + if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED) > + break; > + } > + > + if (sbefifo == NULL) { > + fprintf(stderr, "No sbefifo found to run isteps\n"); > + return 0; > + } > > if (major < 2 || major > 5) { > fprintf(stderr, "Istep major should be 2 to 5\n"); > @@ -56,16 +66,9 @@ static int istep(uint32_t major, uint32_t minor) > } > } > > - for_each_path_target_class("sbefifo", target) { > - int rc; > - > - if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) > - continue; > - > - rc = sbe_istep(target, major, minor); > - if (!rc) > - count++; > - } > + rc = sbe_istep(sbefifo, major, minor); > + if (!rc) > + count++; > > return count; > }
diff --git a/src/istep.c b/src/istep.c index a9acbe7..a141a31 100644 --- a/src/istep.c +++ b/src/istep.c @@ -34,8 +34,18 @@ struct istep_data { static int istep(uint32_t major, uint32_t minor) { - struct pdbg_target *target; - int count = 0, i; + struct pdbg_target *sbefifo; + int count = 0, i, rc; + + for_each_path_target_class("sbefifo", sbefifo) { + if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED) + break; + } + + if (sbefifo == NULL) { + fprintf(stderr, "No sbefifo found to run isteps\n"); + return 0; + } if (major < 2 || major > 5) { fprintf(stderr, "Istep major should be 2 to 5\n"); @@ -56,16 +66,9 @@ static int istep(uint32_t major, uint32_t minor) } } - for_each_path_target_class("sbefifo", target) { - int rc; - - if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) - continue; - - rc = sbe_istep(target, major, minor); - if (!rc) - count++; - } + rc = sbe_istep(sbefifo, major, minor); + if (!rc) + count++; return count; }
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/istep.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)