Add a new member to the softc (sc_parity_disable) with per-target

bits that tell the driver not to expect parity from those targets.
XXX: For now, it is up to MD code to set this mask.  Eventually,
XXX: we should identify targets first (without demanding parity)
XXX: and then use a new "SCSI quirk" to set the right bit.
This commit is contained in:
gwr 1996-05-10 18:04:01 +00:00
parent d6ea9eae71
commit 01e80ddb16
2 changed files with 32 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr5380sbc.c,v 1.9 1996/03/18 23:09:02 gwr Exp $ */
/* $NetBSD: ncr5380sbc.c,v 1.10 1996/05/10 18:04:01 gwr Exp $ */
/*
* Copyright (c) 1995 David Jones, Gordon W. Ross
@ -916,7 +916,7 @@ next_job:
case XS_BUSY:
/* XXX - Reset and try again. */
printf("%s: SCSI bus busy, resetting...\n",
printf("%s: select found SCSI bus busy, resetting...\n",
sc->sc_dev.dv_xname);
ncr5380_reset_scsibus(sc);
/* fallthrough */
@ -1056,6 +1056,7 @@ ncr5380_reselect(sc)
{
struct sci_req *sr;
int target, lun, phase, timo;
int target_mask;
u_char bus, data, icmd, msg;
#ifdef DIAGNOSTIC
@ -1124,6 +1125,7 @@ ncr5380_reselect(sc)
printf("%s: selected as target, data=0x%x\n",
sc->sc_dev.dv_xname, data);
/* Not much we can do. Reset the bus. */
/* XXX: send some sort of message? */
ncr5380_reset_scsibus(sc);
return;
}
@ -1131,11 +1133,12 @@ ncr5380_reselect(sc)
/*
* OK, this is a reselection.
*/
for (target = 0; target < 7; target++)
if (data & (1 << target))
for (target = 0; target < 7; target++) {
target_mask = (1 << target);
if (data & target_mask)
break;
if ((data & 0x7F) != (1 << target)) {
}
if ((data & 0x7F) != target_mask) {
/* No selecting ID? or >2 IDs on bus? */
printf("%s: bad reselect, data=0x%x\n",
sc->sc_dev.dv_xname, data);
@ -1217,6 +1220,13 @@ ncr5380_reselect(sc)
sc->sc_msgoutq = 0;
sc->sc_msgout = 0;
/* XXX: Restore the normal mode register. */
/* If this target's bit is set, do NOT check parity. */
if (sc->sc_parity_disable & target_mask)
*sc->sci_mode = (SCI_MODE_MONBSY);
else
*sc->sci_mode = (SCI_MODE_MONBSY | SCI_MODE_PAR_CHK);
/*
* Another hack for the Sun3 "si", which needs
* some setup done to its DMA engine before the
@ -1279,7 +1289,7 @@ ncr5380_select(sc, sr)
struct ncr5380_softc *sc;
struct sci_req *sr;
{
int timo, s;
int timo, s, target_mask;
u_char data, icmd;
/* Check for reselect */
@ -1408,7 +1418,8 @@ ncr5380_select(sc, sr)
* the host and target. Also set ATN now, to
* ask the target for a message out phase.
*/
data = 0x80 | (1 << sr->sr_target);
target_mask = (1 << sr->sr_target);
data = 0x80 | target_mask;
*(sc->sci_odata) = data;
icmd |= (SCI_ICMD_DATA | SCI_ICMD_ATN);
*(sc->sci_icmd) = icmd;
@ -1463,8 +1474,11 @@ success:
icmd &= ~(SCI_ICMD_DATA | SCI_ICMD_SEL);
*sc->sci_icmd = icmd;
/* XXX - Make parity checking optional? */
*sc->sci_mode = (SCI_MODE_MONBSY | SCI_MODE_PAR_CHK);
/* If this target's bit is set, do NOT check parity. */
if (sc->sc_parity_disable & target_mask)
*sc->sci_mode = (SCI_MODE_MONBSY);
else
*sc->sci_mode = (SCI_MODE_MONBSY | SCI_MODE_PAR_CHK);
return XS_NOERROR;
}
@ -2332,7 +2346,7 @@ do_actions:
* We have to wait here for BSY to drop, otherwise
* the next command may decide we need a bus reset.
*/
timo = ncr5380_wait_nrq_timo; /* XXX */
timo = ncr5380_wait_req_timo; /* XXX */
for (;;) {
if (!SCI_BUSY(sc))
goto busfree;
@ -2341,8 +2355,9 @@ do_actions:
delay(2);
}
/* Device is sitting on the bus! */
printf("%s: SCSI job did not finish, resetting...\n",
sc->sc_dev.dv_xname);
printf("%s: Target %d LUN %d stuck busy, resetting...\n",
sr->sr_target, sr->sr_lun,
sc->sc_dev.dv_xname);
ncr5380_reset_scsibus(sc);
busfree:
NCR_TRACE("machine: discon, waited %d\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr5380var.h,v 1.5 1996/03/01 01:42:07 gwr Exp $ */
/* $NetBSD: ncr5380var.h,v 1.6 1996/05/10 18:04:06 gwr Exp $ */
/*
* Copyright (c) 1995 David Jones, Gordon W. Ross
@ -110,6 +110,9 @@ struct ncr5380_softc {
#define NCR5380_PERMIT_RESELECT 1 /* Allow disconnect/reselect */
#define NCR5380_FORCE_POLLING 2 /* Do not use interrupts. */
/* Set bits in this to disable parity for some target. */
int sc_parity_disable;
int sc_min_dma_len; /* Smaller than this is done with PIO */
/* Begin MI shared data */