Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Off-by-one error in limiting the DMAC buffer siz...



details:   https://anonhg.NetBSD.org/src/rev/723ff9de3429
branches:  trunk
changeset: 479980:723ff9de3429
user:      kleink <kleink%NetBSD.org@localhost>
date:      Tue Dec 28 19:26:26 1999 +0000

description:
Off-by-one error in limiting the DMAC buffer size for Audio 2 to 64K (actually
64K - 1); from Dave Sainty in PR kern/9064.

diffstat:

 sys/dev/pci/eso.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 98f43f78e94d -r 723ff9de3429 sys/dev/pci/eso.c
--- a/sys/dev/pci/eso.c Tue Dec 28 18:05:24 1999 +0000
+++ b/sys/dev/pci/eso.c Tue Dec 28 19:26:26 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eso.c,v 1.15 1999/12/28 01:39:38 kleink Exp $  */
+/*     $NetBSD: eso.c,v 1.16 1999/12/28 19:26:26 kleink Exp $  */
 
 /*
  * Copyright (c) 1999 Klaus J. Klein
@@ -1577,10 +1577,21 @@
        int direction;
        size_t bufsize;
 {
+       size_t maxsize;
 
-       /* 64K restriction: ISA at eleven? */
-       if (bufsize > 65536)
-               bufsize = 65536;
+       /*
+        * The playback DMA buffer size on the Solo-1 is limited to 2^16 -
+        * 1 bytes.  This is because A2DMAC is a two byte value indicating
+        * the literal byte count, and zero does not appear to be used as
+        * a special case for 2^16.
+        *
+        * For recording, DMAC_DMAC is the byte count - 1, so 2^16 can be
+        * represented.
+        */
+       maxsize = (direction == AUMODE_PLAY) ? 65535 : 65536;
+
+       if (bufsize > maxsize)
+               bufsize = maxsize;
 
        return (bufsize);
 }



Home | Main Index | Thread Index | Old Index