diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-20 23:07:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-07-20 23:07:07 +0000 |
commit | 14539f748e8c45efce84541f62df713148035425 (patch) | |
tree | 163bed706afa3d19b044521c543f172885f04247 /sys/arch/mvme88k/dev | |
parent | b1d18f37db4c5298c66cc14d70dae75dd8d762d0 (diff) |
Forgot to put this chunk in.
Diffstat (limited to 'sys/arch/mvme88k/dev')
-rw-r--r-- | sys/arch/mvme88k/dev/vs.c | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index 327fcfb2adb..8402ce355f5 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.50 2004/07/20 20:33:18 miod Exp $ */ +/* $OpenBSD: vs.c,v 1.51 2004/07/20 23:07:06 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. @@ -647,76 +647,87 @@ vs_initialize(struct vs_softc *sc) } CRB_CLR_DONE; - /* reset SCSI bus */ - vs_reset(sc); + /* reset all SCSI buses */ + vs_reset(sc, -1); /* sync all devices */ vs_resync(sc); - printf("SCSI ID %d\n", sc->sc_pid); + return 0; } void vs_resync(struct vs_softc *sc) { - int i; - - for (i = 0; i < 8; i++) { - if (i == sc->sc_pid) - continue; - - vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE); - mce_iopb_write(2, DRCF_CMD, CNTR_DEV_REINIT); - mce_iopb_write(2, DRCF_OPTION, 0); /* no interrupts yet */ - mce_iopb_write(1, DRCF_NVCT, sc->sc_nvec); - mce_iopb_write(1, DRCF_EVCT, sc->sc_evec); - mce_iopb_write(2, DRCF_ILVL, 0); - mce_iopb_write(2, DRCF_UNIT, IOPB_UNIT_VALUE(i, 0)); + int bus, target; - vs_bzero(sh_MCE, CQE_SIZE); - mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB); - mce_write(1, CQE_IOPB_LENGTH, IOPB_SHORT_SIZE); - mce_write(1, CQE_WORK_QUEUE, 0); - mce_write(2, CQE_QECR, M_QECR_GO); + for (bus = 0; bus < 2; bus++) { + if (sc->sc_id[bus] < 0) + break; - /* poll for the command to complete */ - do_vspoll(sc, 0, 0); - if (CRSW & M_CRSW_ER) - CRB_CLR_ER; - CRB_CLR_DONE; + for (target = 0; target < 8; target++) { + if (target == sc->sc_id[bus]) + continue; + + vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE); + mce_iopb_write(2, DRCF_CMD, CNTR_DEV_REINIT); + mce_iopb_write(2, DRCF_OPTION, 0); /* prefer polling */ + mce_iopb_write(1, DRCF_NVCT, sc->sc_nvec); + mce_iopb_write(1, DRCF_EVCT, sc->sc_evec); + mce_iopb_write(2, DRCF_ILVL, 0); + mce_iopb_write(2, DRCF_UNIT, + IOPB_UNIT_VALUE(bus, target, 0)); + + vs_bzero(sh_MCE, CQE_SIZE); + mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB); + mce_write(1, CQE_IOPB_LENGTH, IOPB_SHORT_SIZE); + mce_write(1, CQE_WORK_QUEUE, 0); + mce_write(2, CQE_QECR, M_QECR_GO); + + /* poll for the command to complete */ + do_vspoll(sc, NULL, 0, 0); + if (CRSW & M_CRSW_ER) + CRB_CLR_ER; + CRB_CLR_DONE; + } } } void -vs_reset(struct vs_softc *sc) +vs_reset(struct vs_softc *sc, int bus) { - int s; + int b, s; s = splbio(); - vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE); - mce_iopb_write(2, SRCF_CMD, IOPB_RESET); - mce_iopb_write(2, SRCF_OPTION, 0); /* not interrupts yet... */ - mce_iopb_write(1, SRCF_NVCT, sc->sc_nvec); - mce_iopb_write(1, SRCF_EVCT, sc->sc_evec); - mce_iopb_write(2, SRCF_ILVL, 0); - mce_iopb_write(2, SRCF_BUSID, 0); + for (b = 0; b < 2; b++) { + if (bus >= 0 && b != bus) + continue; - vs_bzero(sh_MCE, CQE_SIZE); - mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB); - mce_write(1, CQE_IOPB_LENGTH, IOPB_SHORT_SIZE); - mce_write(1, CQE_WORK_QUEUE, 0); - mce_write(2, CQE_QECR, M_QECR_GO); + vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE); + mce_iopb_write(2, SRCF_CMD, IOPB_RESET); + mce_iopb_write(2, SRCF_OPTION, 0); /* prefer polling */ + mce_iopb_write(1, SRCF_NVCT, sc->sc_nvec); + mce_iopb_write(1, SRCF_EVCT, sc->sc_evec); + mce_iopb_write(2, SRCF_ILVL, 0); + mce_iopb_write(2, SRCF_BUSID, b << 15); - /* poll for the command to complete */ - for (;;) { - do_vspoll(sc, NULL, 0, 0); - /* ack & clear scsi error condition cause by reset */ - if (CRSW & M_CRSW_ER) { + vs_bzero(sh_MCE, CQE_SIZE); + mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB); + mce_write(1, CQE_IOPB_LENGTH, IOPB_SHORT_SIZE); + mce_write(1, CQE_WORK_QUEUE, 0); + mce_write(2, CQE_QECR, M_QECR_GO); + + /* poll for the command to complete */ + for (;;) { + do_vspoll(sc, NULL, 0, 0); + /* ack & clear scsi error condition cause by reset */ + if (CRSW & M_CRSW_ER) { + CRB_CLR_DONE; + vs_write(2, sh_RET_IOPB + IOPB_STATUS, 0); + break; + } CRB_CLR_DONE; - vs_write(2, sh_RET_IOPB + IOPB_STATUS, 0); - break; } - CRB_CLR_DONE; } thaw_all_queues(sc); |