diff options
Diffstat (limited to 'sys/dev/isp/isp_library.c')
-rw-r--r-- | sys/dev/isp/isp_library.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c index 6003d00..9e8f3ab 100644 --- a/sys/dev/isp/isp_library.c +++ b/sys/dev/isp/isp_library.c @@ -394,33 +394,31 @@ isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg) int isp_fc_runstate(ispsoftc_t *isp, int chan, int tval) { - fcparam *fcp; + fcparam *fcp = FCPARAM(isp, chan); + int res; - fcp = FCPARAM(isp, chan); - if (fcp->role == ISP_ROLE_NONE) { - return (0); - } - if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan); - return (-1); - } - if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop failed on channel %d", chan); - return (LOOP_LTEST_DONE); - } - if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric failed on channel %d", chan); - return (LOOP_LSCAN_DONE); - } - if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync failed on channel %d", chan); - return (LOOP_FSCAN_DONE); - } - if (fcp->isp_loopstate != LOOP_READY) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: not ready again on channel %d", chan); +again: + if (fcp->role == ISP_ROLE_NONE) return (-1); - } - return (0); + res = isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_SCAN_LOOP, chan); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_SCAN_FABRIC, chan); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_PDB_SYNC, chan); + if (res > 0) + goto again; + return (fcp->isp_loopstate); } /* @@ -545,6 +543,7 @@ isp_fc_loop_statename(int state) { switch (state) { case LOOP_NIL: return "NIL"; + case LOOP_HAVE_LINK: return "Have Link"; case LOOP_TESTING_LINK: return "Testing Link"; case LOOP_LTEST_DONE: return "Link Test Done"; case LOOP_SCANNING_LOOP: return "Scanning Loop"; |