summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}