The last patch improved, but did not completely eliminate the warnings.
This one appears to do the job perfectly. The question is, does calling
DELAY() like this cause any concerns for anyone?


Index: solo.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pci/solo.c,v
retrieving revision 1.8
diff -u -r1.8 solo.c
--- solo.c      2000/08/09 07:14:56     1.8
+++ solo.c      2000/08/11 17:01:22
@@ -756,7 +756,7 @@
 static int
 ess_dmapos(struct ess_info *sc, int ch)
 {
-       int p = 0;
+       int p = 0, i = 0, j = 0;
        u_long flags;
 
        KASSERT(ch == 1 || ch == 2, ("bad ch"));
@@ -766,11 +766,20 @@
 /*
  * During recording, this register is known to give back
  * garbage if it's not quiescent while being read. That's
- * why we spl, stop the DMA, wait, and be vewy, vewy quiet
+ * why we spl, stop the DMA, and try over and over until
+ * adjacent reads are "close", in the right order and not
+ * bigger than is otherwise possible.
  */
                ess_dmatrigger(sc, ch, 0);
-               DELAY(20);
-               p = port_rd(sc->vc, 0x4, 2) + 1;
+               DELAY(20);
+               do {
+                       DELAY(10);
+                       if (j > 1)
+                               printf("DMA count reg bogus: %04x & %04x\n",
+                                       i, p);
+                       i = port_rd(sc->vc, 0x4, 2) + 1;
+                       p = port_rd(sc->vc, 0x4, 2) + 1;
+               } while ((p > sc->dmasz[ch -1 ] || i < p || (p - i) > 0x8) && j++ < 
+1000);
                ess_dmatrigger(sc, ch, 1);
        }
        else if (ch == 2)

Reply via email to