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.
This commit is contained in:
thorpej 2000-02-06 01:26:50 +00:00
parent 0c4f8a876b
commit 97eba73a40
2 changed files with 57 additions and 8 deletions

View File

@ -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 @@ ciaattach(parent, self, aux)
* 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;

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: cia_dma.c,v 1.14 2000/01/25 03:32:36 thorpej Exp $")
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 @@ cia_dma_init(ccp)
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;
@ -284,6 +287,50 @@ cia_dma_get_tag(t, bustype)
}
}
/*
* 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, 2/5/2000
*/
map->_dm_flags |= DMAMAP_NO_COALESCE;
}
return (0);
}
/*
* Create a CIA SGMAP-mapped DMA map.
*/