diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-15 03:35:27 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-15 03:35:27 +0000 |
commit | e7e1c3d228b039a425bf9b2aa3758d011c2d8955 (patch) | |
tree | 8ddd6c1f241728d8a05277733fa97db809d37063 /sys/arch/amd64 | |
parent | 421366b506e706607ea0a9cfa7de3fe39f1d9c96 (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/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/bus_dma.c | 7 |
1 files changed, 4 insertions, 3 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); } |