From 3183166c6c8554ab3b3c4b8ce35ebc01561faf03 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 18 Jun 2012 21:23:56 +0000 Subject: [PATCH] When issuing a non-dma command, make sure to set the "remaining length of command to be transfered via dma" (sc_cmdlen) to zero upfront, otherwise we might get confused on command completition interrupt (no dma active but still data left to transfer). --- sys/dev/ic/ncr53c9x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index e324f3910a73..b9b7dddb4279 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.144 2012/03/10 20:54:20 mrg Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.145 2012/06/18 21:23:56 martin Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.144 2012/03/10 20:54:20 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.145 2012/06/18 21:23:56 martin Exp $"); #include #include @@ -735,6 +735,7 @@ ncr53c9x_select(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) } else { ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, ecb->clen); + sc->sc_cmdlen = 0; NCRCMD(sc, NCRCMD_SELNATN); } return; @@ -804,6 +805,7 @@ ncr53c9x_select(struct ncr53c9x_softc *sc, struct ncr53c9x_ecb *ecb) */ /* Now get the command into the FIFO */ + sc->sc_cmdlen = 0; ncr53c9x_wrfifo(sc, cmd, clen); /* And get the targets attention */ @@ -2054,6 +2056,7 @@ ncr53c9x_msgout(struct ncr53c9x_softc *sc) */ ncr53c9x_flushfifo(sc); ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); + sc->sc_cmdlen = 0; NCRCMD(sc, NCRCMD_TRANS); } else { /* (re)send the message */ @@ -2759,6 +2762,7 @@ msgin: } else { ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, ecb->clen); + sc->sc_cmdlen = 0; NCRCMD(sc, NCRCMD_TRANS); } sc->sc_prevphase = COMMAND_PHASE;