Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/next68k/dev applied patch from "Christian Limpach" ...



details:   https://anonhg.NetBSD.org/src/rev/288d3ae281c6
branches:  trunk
changeset: 480436:288d3ae281c6
user:      dbj <dbj%NetBSD.org@localhost>
date:      Wed Jan 12 19:18:00 2000 +0000

description:
applied patch from "Christian Limpach" <chris%Nice.CH@localhost>:
   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.)

diffstat:

 sys/arch/next68k/dev/nextdma.c |  39 ++++++++++++---------------------------
 1 files changed, 12 insertions(+), 27 deletions(-)

diffs (55 lines):

diff -r a7dde9db7b62 -r 288d3ae281c6 sys/arch/next68k/dev/nextdma.c
--- a/sys/arch/next68k/dev/nextdma.c    Wed Jan 12 17:19:11 2000 +0000
+++ b/sys/arch/next68k/dev/nextdma.c    Wed Jan 12 19:18:00 2000 +0000
@@ -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,34 +505,19 @@
                                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);
-                               }
-
+                               /* 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);
                        } else {
+                               bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
+                                                 DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE | DMACSR_SETENABLE);
+                       }
 
-#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
-
-                               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);
-                               } else {
-                                       bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,
-                                                       DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE | DMACSR_SETENABLE);
-                               }
-                       }
                }
 
        }



Home | Main Index | Thread Index | Old Index