applied patch from "Christian Limpach" <chris@Nice.CH>:

I've fixed the problem that's been keeping me from using anything newer than
   1.4.1 now.  I tracked down the problem checkin, it's the big reorg of
   nextdma.c between 1.19 and 1.20.  It didn't introduce a new bug but it
   activated a check which wasn't activated before.  It's the
   is-the-limit-in-the-right-window-check which was ifdeffed before because
   some DMA-regs would sometimes have strange values.  I think I've fixed the
   DMA-reg stuff for now:   at the end of nextdma_intr, when the csr is poked
   to make DMA do something, I think the check for the ENABLE bit introduces a
   race condition.  I fixed this by unconditionally setting DMACSR_SETENABLE,
   this seems to work and also makes the code more readable.  I've also tried
   setting DMACSR_SETSUPDATE unconditionally and this also works well, but I
   don't know what it implies.  Unless you have reasons to not set SUPDATE all
   the time, I'd suggest making this change as well, it makes the code cleaner
   and faster...
I've tested this patch and it does stop the panics, although I don't think setting
SUPDATE all the tima as he suggests is a good idea.  The "SUPDATE" bit implies
a single update (i.e. the end of a dma chain.)
This commit is contained in:
dbj 2000-01-12 19:18:00 +00:00
parent 600be45ffc
commit b2236223c9
1 changed files with 12 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nextdma.c,v 1.20 1999/08/29 05:56:26 dbj Exp $ */
/* $NetBSD: nextdma.c,v 1.21 2000/01/12 19:18:00 dbj Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -505,26 +505,11 @@ nextdma_intr(arg)
dmadir = DMACSR_SETWRITE;
}
if (state & DMACSR_ENABLE) {
if ((nd->_nd_map_cont == NULL) && (nd->_nd_idx+1 == nd->_nd_map->dm_nsegs)) {
bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
DMACSR_CLRCOMPLETE | dmadir);
} else {
bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE);
}
} else {
#if (defined(ND_DEBUG))
if (nextdma_debug) next_dma_print(nd);
#endif
#if 0 && defined(DIAGNOSTIC)
printf("DMA: Unexpected shutdown, restarting intr(0x%b)\n",
NEXT_I_BIT(nd->nd_intr),NEXT_INTR_BITS);
#endif
/* we used to SETENABLE here only
conditionally, but we got burned
because DMA sometimes would shut
down between when we checked and
when we acted upon it. CL19991211 */
if ((nd->_nd_map_cont == NULL) && (nd->_nd_idx+1 == nd->_nd_map->dm_nsegs)) {
bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETENABLE);
@ -532,7 +517,7 @@ nextdma_intr(arg)
bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE | DMACSR_SETENABLE);
}
}
}
}