diff options
Diffstat (limited to 'sys/arch/alpha/pci')
-rw-r--r-- | sys/arch/alpha/pci/cia_dma.c | 25 | ||||
-rw-r--r-- | sys/arch/alpha/pci/mcpcia_dma.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsp_dma.c | 10 |
3 files changed, 37 insertions, 8 deletions
diff --git a/sys/arch/alpha/pci/cia_dma.c b/sys/arch/alpha/pci/cia_dma.c index 29b3ddae8f2..54b0d74be67 100644 --- a/sys/arch/alpha/pci/cia_dma.c +++ b/sys/arch/alpha/pci/cia_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia_dma.c,v 1.10 2009/02/01 14:34:00 miod Exp $ */ +/* $OpenBSD: cia_dma.c,v 1.11 2014/06/14 23:11:20 jmatthew Exp $ */ /* $NetBSD: cia_dma.c,v 1.16 2000/06/29 08:58:46 mrg Exp $ */ /*- @@ -56,6 +56,7 @@ bus_dma_tag_t cia_dma_get_tag(bus_dma_tag_t, alpha_bus_t); int cia_bus_dmamap_create_direct(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_dmamap_t *); +void cia_bus_dmamap_destroy_direct(bus_dma_tag_t, bus_dmamap_t); int cia_bus_dmamap_load_sgmap(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int); @@ -113,7 +114,7 @@ cia_dma_init(ccp) t->_sgmap = NULL; t->_get_tag = cia_dma_get_tag; t->_dmamap_create = cia_bus_dmamap_create_direct; - t->_dmamap_destroy = _bus_dmamap_destroy; + t->_dmamap_destroy = cia_bus_dmamap_destroy_direct; t->_dmamap_load = _bus_dmamap_load_direct; t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct; t->_dmamap_load_uio = _bus_dmamap_load_uio_direct; @@ -307,7 +308,15 @@ cia_bus_dmamap_create_direct(t, size, nsegments, maxsegsz, boundary, if (error) return (error); + /* + * Since we fall back to sgmap if the direct mapping fails, + * we need to set up for sgmap in any case. + */ map = *dmamp; + if (alpha_sgmap_dmamap_setup(map, nsegments, flags)) { + _bus_dmamap_destroy(t, map); + return (ENOMEM); + } if ((ccp->cc_flags & CCF_PYXISBUG) != 0 && map->_dm_segcnt > 1) { @@ -329,6 +338,18 @@ cia_bus_dmamap_create_direct(t, size, nsegments, maxsegsz, boundary, } /* + * Destroy a CIA direct-mapped DMA map. + */ +void +cia_bus_dmamap_destroy_direct(t, map) + bus_dma_tag_t t; + bus_dmamap_t map; +{ + alpha_sgmap_dmamap_teardown(map); + _bus_dmamap_destroy(t, map); +} + +/* * Load a CIA SGMAP-mapped DMA map with a linear buffer. */ int diff --git a/sys/arch/alpha/pci/mcpcia_dma.c b/sys/arch/alpha/pci/mcpcia_dma.c index 7dba6aa8823..4d019dbb2cf 100644 --- a/sys/arch/alpha/pci/mcpcia_dma.c +++ b/sys/arch/alpha/pci/mcpcia_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcpcia_dma.c,v 1.4 2012/12/05 23:20:10 deraadt Exp $ */ +/* $OpenBSD: mcpcia_dma.c,v 1.5 2014/06/14 23:11:20 jmatthew Exp $ */ /* $NetBSD: mcpcia_dma.c,v 1.15 2001/07/19 18:55:40 thorpej Exp $ */ /*- @@ -108,8 +108,12 @@ mcpcia_dma_init(ccp) t->_boundary = 0; t->_sgmap = NULL; t->_get_tag = mcpcia_dma_get_tag; - t->_dmamap_create = _bus_dmamap_create; - t->_dmamap_destroy = _bus_dmamap_destroy; + /* + * Since we fall back to sgmap if the direct mapping fails, + * we need to set up for sgmap in any case. + */ + t->_dmamap_create = alpha_sgmap_dmamap_create; + t->_dmamap_destroy = alpha_sgmap_dmamap_destroy; t->_dmamap_load = _bus_dmamap_load_direct; t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct; t->_dmamap_load_uio = _bus_dmamap_load_uio_direct; diff --git a/sys/arch/alpha/pci/tsp_dma.c b/sys/arch/alpha/pci/tsp_dma.c index 32f5d3fb695..819a3c710ee 100644 --- a/sys/arch/alpha/pci/tsp_dma.c +++ b/sys/arch/alpha/pci/tsp_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsp_dma.c,v 1.10 2014/05/08 20:46:49 miod Exp $ */ +/* $OpenBSD: tsp_dma.c,v 1.11 2014/06/14 23:11:20 jmatthew Exp $ */ /* $NetBSD: tsp_dma.c,v 1.1 1999/06/29 06:46:47 ross Exp $ */ /*- @@ -153,8 +153,12 @@ tsp_dma_init(struct device *tsp, struct tsp_config *pcp) t->_boundary = 0; t->_sgmap = NULL; t->_get_tag = tsp_dma_get_tag; - t->_dmamap_create = _bus_dmamap_create; - t->_dmamap_destroy = _bus_dmamap_destroy; + /* + * Since we fall back to sgmap if the direct mapping fails, + * we need to set up for sgmap in any case. + */ + t->_dmamap_create = alpha_sgmap_dmamap_create; + t->_dmamap_destroy = alpha_sgmap_dmamap_destroy; t->_dmamap_load = _bus_dmamap_load_direct; t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct; t->_dmamap_load_uio = _bus_dmamap_load_uio_direct; |