Subject: Re: kern/22100
To: None <jmcneill@netbsd.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: netbsd-bugs
Date: 08/13/2005 12:14:39
Hi Brian, can you try the following patch to cs4281.c?

Index: cs4281.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/cs4281.c,v
retrieving revision 1.26
diff -u -r1.26 cs4281.c
--- cs4281.c    28 Jun 2005 00:28:41 -0000      1.26
+++ cs4281.c    13 Aug 2005 15:13:34 -0000
@@ -338,24 +338,24 @@
         /* Playback Interrupt */
         if (intr & HISR_DMA0) {
-               handled = 1;
                 DPRINTF((" PB DMA 0x%x(%d)", (int)BA0READ4(sc,  
CS4281_DCA0),
                          (int)BA0READ4(sc, CS4281_DCC0)));
                 if (sc->sc_prun) {
+                       handled = 1;
                         if ((sc->sc_pi%sc->sc_pcount) == 0)
                                 sc->sc_pintr(sc->sc_parg);
+                       /* copy buffer */
+                       ++sc->sc_pi;
+                       empty_dma = sc->sc_pdma->addr;
+                       if (sc->sc_pi&1)
+                               empty_dma += sc->hw_blocksize;
+                       memcpy(empty_dma, sc->sc_pn, sc->hw_blocksize);
+                       sc->sc_pn += sc->hw_blocksize;
+                       if (sc->sc_pn >= sc->sc_pe)
+                               sc->sc_pn = sc->sc_ps;
                 } else {
                         printf("unexpected play intr\n");
                 }
-               /* copy buffer */
-               ++sc->sc_pi;
-               empty_dma = sc->sc_pdma->addr;
-               if (sc->sc_pi&1)
-                       empty_dma += sc->hw_blocksize;
-               memcpy(empty_dma, sc->sc_pn, sc->hw_blocksize);
-               sc->sc_pn += sc->hw_blocksize;
-               if (sc->sc_pn >= sc->sc_pe)
-                       sc->sc_pn = sc->sc_ps;
         }
         if (intr & HISR_DMA1) {
                 handled = 1;