Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/pci If we have a Pyxis with the DMA page cros...



details:   https://anonhg.NetBSD.org/src/rev/4664fae8e321
branches:  trunk
changeset: 481787:4664fae8e321
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Feb 06 01:26:50 2000 +0000

description:
If we have a Pyxis with the DMA page crossing bug, don't allow coalescing
of adjacent DMA segments.

XXX This is still not perfect... but making it perfect will probably
require additions to the bus_dma interface and the ISA autoconfiguration
interface.

diffstat:

 sys/arch/alpha/pci/cia.c     |  12 +++++----
 sys/arch/alpha/pci/cia_dma.c |  53 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 8 deletions(-)

diffs (121 lines):

diff -r 937e6c45fdd8 -r 4664fae8e321 sys/arch/alpha/pci/cia.c
--- a/sys/arch/alpha/pci/cia.c  Sun Feb 06 01:23:30 2000 +0000
+++ b/sys/arch/alpha/pci/cia.c  Sun Feb 06 01:26:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cia.c,v 1.50 2000/02/01 19:29:28 thorpej Exp $ */
+/* $NetBSD: cia.c,v 1.51 2000/02/06 01:26:50 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.50 2000/02/01 19:29:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.51 2000/02/06 01:26:50 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -330,9 +330,11 @@
                 * PCI-ISA bridge (i.e. Miata 1.5 and Miata 2) do not
                 * have the bug, so we use this check.
                 *
-                * XXX We also need to deal with this boundary constraint
-                * XXX in the PCI bus 0 (and ISA) DMA tags, but some
-                * XXX drivers are going to need to be changed first.
+                * NOTE: This bug is actually worked around in cia_dma.c,
+                * when direct-mapped DMA maps are created.
+                *
+                * XXX WE NEED TO THINK ABOUT HOW TO HANDLE THIS FOR
+                * XXX SGMAP DMA MAPPINGS!
                 */
                u_int32_t ctrl;
 
diff -r 937e6c45fdd8 -r 4664fae8e321 sys/arch/alpha/pci/cia_dma.c
--- a/sys/arch/alpha/pci/cia_dma.c      Sun Feb 06 01:23:30 2000 +0000
+++ b/sys/arch/alpha/pci/cia_dma.c      Sun Feb 06 01:26:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cia_dma.c,v 1.14 2000/01/25 03:32:36 thorpej Exp $ */
+/* $NetBSD: cia_dma.c,v 1.15 2000/02/06 01:26:50 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.14 2000/01/25 03:32:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.15 2000/02/06 01:26:50 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,6 +58,9 @@
 
 bus_dma_tag_t cia_dma_get_tag __P((bus_dma_tag_t, alpha_bus_t));
 
+int    cia_bus_dmamap_create_direct __P((bus_dma_tag_t, bus_size_t, int,
+           bus_size_t, bus_size_t, int, bus_dmamap_t *));
+
 int    cia_bus_dmamap_create_sgmap __P((bus_dma_tag_t, bus_size_t, int,
            bus_size_t, bus_size_t, int, bus_dmamap_t *));
 
@@ -118,7 +121,7 @@
        t->_boundary = 0;
        t->_sgmap = NULL;
        t->_get_tag = cia_dma_get_tag;
-       t->_dmamap_create = _bus_dmamap_create;
+       t->_dmamap_create = cia_bus_dmamap_create_direct;
        t->_dmamap_destroy = _bus_dmamap_destroy;
        t->_dmamap_load = _bus_dmamap_load_direct;
        t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct;
@@ -285,6 +288,50 @@
 }
 
 /*
+ * Create a CIA direct-mapped DMA map.
+ */
+int
+cia_bus_dmamap_create_direct(t, size, nsegments, maxsegsz, boundary,
+    flags, dmamp)
+       bus_dma_tag_t t;
+       bus_size_t size;
+       int nsegments;
+       bus_size_t maxsegsz;
+       bus_size_t boundary;
+       int flags;
+       bus_dmamap_t *dmamp;
+{
+       struct cia_config *ccp = t->_cookie;
+       bus_dmamap_t map;
+       int error;
+
+       error = _bus_dmamap_create(t, size, nsegments, maxsegsz,
+           boundary, flags, dmamp);
+       if (error)
+               return (error);
+
+       map = *dmamp;
+
+       if ((ccp->cc_flags & CCF_PYXISBUG) != 0 &&
+           map->_dm_segcnt > 1) {
+               /*
+                * We have a Pyxis with the DMA page crossing bug, make
+                * sure we don't coalesce adjacent DMA segments.
+                *
+                * NOTE: We can only do this if the max segment count
+                * is greater than 1.  This is because many network
+                * drivers allocate large contiguous blocks of memory
+                * for control data structures, even though they won't
+                * do any single DMA that crosses a page coundary.
+                *      -- thorpej%netbsd.org@localhost, 2/5/2000
+                */
+               map->_dm_flags |= DMAMAP_NO_COALESCE;
+       }
+
+       return (0);
+}
+
+/*
  * Create a CIA SGMAP-mapped DMA map.
  */
 int



Home | Main Index | Thread Index | Old Index