diff options
| author | Luoqi Chen <luoqi@FreeBSD.org> | 1999-12-16 23:23:56 +0000 |
|---|---|---|
| committer | Luoqi Chen <luoqi@FreeBSD.org> | 1999-12-16 23:23:56 +0000 |
| commit | 6dcdee9d65338cc1c4aa64c455f1bb7af4627b21 (patch) | |
| tree | 3800931fa53aa17f641dabb853520a1760b0b94f | |
| parent | 82ec27c7a3c47ee31abe3127207bf7ba04ccdf18 (diff) | |
Notes
| -rw-r--r-- | sys/dev/aic/aic.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/aic/aic.c b/sys/dev/aic/aic.c index fb06f561b0db..2880e683625f 100644 --- a/sys/dev/aic/aic.c +++ b/sys/dev/aic/aic.c @@ -923,7 +923,7 @@ static void aic_dataout(struct aic_softc *aic) { struct aic_scb *scb = aic->nexus; - u_int8_t dmastat, dmacntrl0; + u_int8_t dmastat, dmacntrl0, sstat2; int n; CAM_DEBUG_PRINT(CAM_DEBUG_TRACE, ("aic_dataout\n")); @@ -973,10 +973,19 @@ aic_dataout(struct aic_softc *aic) for (;;) { /* wait until all bytes in the fifos are transmitted */ dmastat = aic_inb(aic, DMASTAT); - if (dmastat & INTSTAT) + sstat2 = aic_inb(aic, SSTAT2); + if ((dmastat & DFIFOEMP) && (sstat2 & SEMPTY)) break; - if ((dmastat & DFIFOEMP) && (aic_inb(aic, SSTAT2) & SEMPTY)) + if (dmastat & INTSTAT) { + /* adjust for untransmitted bytes */ + n = aic_inb(aic, FIFOSTAT) + (sstat2 & 0xf); + scb->data_ptr -= n; + scb->data_len += n; + /* clear the fifo */ + aic_outb(aic, SXFRCTL0, CHEN|CLRCH); + aic_outb(aic, DMACNTRL0, RSTFIFO); break; + } } aic_outb(aic, SXFRCTL0, CHEN); @@ -1011,8 +1020,7 @@ aic_cmd(struct aic_softc *aic) aic_outb(aic, SIMODE1, ENSCSIRST|ENPHASEMIS|ENBUSFREE); aic_outb(aic, DMACNTRL0, ENDMA|WRITE); aic_outb(aic, SXFRCTL0, SCSIEN|DMAEN|CHEN); - aic_outsw(aic, DMADATA, (u_int16_t *)scb->cmd_ptr, - scb->cmd_len >> 1); + aic_outsw(aic, DMADATA, (u_int16_t *)scb->cmd_ptr, scb->cmd_len >> 1); while ((aic_inb(aic, SSTAT2) & SEMPTY) == 0 && (aic_inb(aic, DMASTAT) & INTSTAT) == 0) ; |
