summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/dev
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-05-12 20:48:20 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-05-12 20:48:20 +0000
commit14386d7e3174d157ac5bf93f4ae751d8c0517992 (patch)
treee6cd66e29b287d3c4eb1f58f05058fb87fa50668 /sys/arch/alpha/dev
parent3a1a208b741df59910fb9e108226cba78f3ee915 (diff)
Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map and then fall back to sgmap-mapped). Use the actual window when performing dmamap_sync and dmamap_unload operations. From NetBSD ok martin@
Diffstat (limited to 'sys/arch/alpha/dev')
-rw-r--r--sys/arch/alpha/dev/bus_dma.c7
-rw-r--r--sys/arch/alpha/dev/sgmap_typedep.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c
index 6a2bf65b4f3..906d9169769 100644
--- a/sys/arch/alpha/dev/bus_dma.c
+++ b/sys/arch/alpha/dev/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.17 2006/04/13 14:41:08 brad Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.18 2006/05/12 20:48:19 brad Exp $ */
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
/*-
@@ -106,6 +106,7 @@ _bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
map->dm_mapsize = 0; /* no valid mappings */
map->dm_nsegs = 0;
+ map->_dm_window = NULL;
*dmamp = map;
return (0);
@@ -268,6 +269,7 @@ _bus_dmamap_load_direct(t, map, buf, buflen, p, flags)
if (error == 0) {
map->dm_mapsize = buflen;
map->dm_nsegs = seg + 1;
+ map->_dm_window = t;
} else if (t->_next_window != NULL) {
/*
* Give the next window a chance.
@@ -319,6 +321,7 @@ _bus_dmamap_load_mbuf_direct(t, map, m0, flags)
if (error == 0) {
map->dm_mapsize = m0->m_pkthdr.len;
map->dm_nsegs = seg + 1;
+ map->_dm_window = t;
} else if (t->_next_window != NULL) {
/*
* Give the next window a chance.
@@ -382,6 +385,7 @@ _bus_dmamap_load_uio_direct(t, map, uio, flags)
if (error == 0) {
map->dm_mapsize = uio->uio_resid;
map->dm_nsegs = seg + 1;
+ map->_dm_window = t;
} else if (t->_next_window != NULL) {
/*
* Give the next window a chance.
@@ -423,6 +427,7 @@ _bus_dmamap_unload(t, map)
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
+ map->_dm_window = NULL;
}
/*
diff --git a/sys/arch/alpha/dev/sgmap_typedep.c b/sys/arch/alpha/dev/sgmap_typedep.c
index e5164260582..af24d7340a0 100644
--- a/sys/arch/alpha/dev/sgmap_typedep.c
+++ b/sys/arch/alpha/dev/sgmap_typedep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgmap_typedep.c,v 1.7 2006/04/13 14:41:08 brad Exp $ */
+/* $OpenBSD: sgmap_typedep.c,v 1.8 2006/05/12 20:48:19 brad Exp $ */
/* $NetBSD: sgmap_typedep.c,v 1.17 2001/07/19 04:27:37 thorpej Exp $ */
/*-
@@ -216,6 +216,7 @@ __C(SGMAP_TYPE,_load)(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
if (error == 0) {
map->dm_mapsize = buflen;
map->dm_nsegs = 1;
+ map->_dm_window = t;
} else if (t->_next_window != NULL) {
/* Give the next window a chance. */
error = bus_dmamap_load(t->_next_window, map, buf, buflen,
@@ -265,6 +266,7 @@ __C(SGMAP_TYPE,_load_mbuf)(bus_dma_tag_t t, bus_dmamap_t map,
if (error == 0) {
map->dm_mapsize = m0->m_pkthdr.len;
map->dm_nsegs = seg;
+ map->_dm_window = t;
} else {
/* Need to back out what we've done so far. */
map->dm_nsegs = seg - 1;
@@ -342,4 +344,5 @@ __C(SGMAP_TYPE,_unload)(bus_dma_tag_t t, bus_dmamap_t map,
/* Mark the mapping invalid. */
map->dm_mapsize = 0;
map->dm_nsegs = 0;
+ map->_dm_window = NULL;
}