summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-15 03:35:27 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-15 03:35:27 +0000
commite7e1c3d228b039a425bf9b2aa3758d011c2d8955 (patch)
tree8ddd6c1f241728d8a05277733fa97db809d37063 /sys/arch
parent421366b506e706607ea0a9cfa7de3fe39f1d9c96 (diff)
fix properly; size gets decremented while we check the segments, so save it so
when we setmapsize it's not zero. *sigh*
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c7
-rw-r--r--sys/arch/i386/i386/bus_dma.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index 6f2eb97d7a5..fb6a96474b1 100644
--- a/sys/arch/amd64/amd64/bus_dma.c
+++ b/sys/arch/amd64/amd64/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.24 2009/04/15 02:03:33 oga Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.25 2009/04/15 03:35:26 oga Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -309,7 +309,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
int nsegs, bus_size_t size, int flags)
{
bus_addr_t paddr, baddr, bmask, lastaddr = 0;
- bus_size_t plen, sgsize;
+ bus_size_t plen, sgsize, mapsize;
int first = 1;
int i, seg = 0;
@@ -322,6 +322,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
if (nsegs > map->_dm_segcnt || size > map->_dm_size)
return (EINVAL);
+ mapsize = size;
bmask = ~(map->_dm_boundary - 1);
for (i = 0; i < nsegs && size > 0; i++) {
@@ -377,7 +378,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
}
}
- map->dm_mapsize = size;
+ map->dm_mapsize = mapsize;
map->dm_nsegs = seg + 1;
return (0);
}
diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c
index 59cf6082ef7..89dc6cb6278 100644
--- a/sys/arch/i386/i386/bus_dma.c
+++ b/sys/arch/i386/i386/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.14 2009/04/15 02:03:33 oga Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.15 2009/04/15 03:35:26 oga Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -276,7 +276,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
int nsegs, bus_size_t size, int flags)
{
bus_addr_t paddr, baddr, bmask, lastaddr = 0;
- bus_size_t plen, sgsize;
+ bus_size_t plen, sgsize, mapsize;
int first = 1;
int i, seg = 0;
@@ -289,6 +289,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
if (nsegs > map->_dm_segcnt || size > map->_dm_size)
return (EINVAL);
+ mapsize = size;
bmask = ~(map->_dm_boundary - 1);
for (i = 0; i < nsegs && size > 0; i++) {
@@ -344,7 +345,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
}
}
- map->dm_mapsize = size;
+ map->dm_mapsize = mapsize;
map->dm_nsegs = seg + 1;
return (0);
}