summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-09-17 17:29:07 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-09-17 17:29:07 +0000
commitdf676be3eb50d3aa4ba1e0cc5d661724bc99973d (patch)
treef0a662eb4f03c924cde9633563f61fca040776ae /sys/powerpc
parent16db26f84b320f4a55b81fa60b13e10750569380 (diff)
downloadFreeBSD-src-df676be3eb50d3aa4ba1e0cc5d661724bc99973d.zip
FreeBSD-src-df676be3eb50d3aa4ba1e0cc5d661724bc99973d.tar.gz
Make sure to copy segments back to the segs array if non-NULL. This is
relied upon by bus_dmamap_load_mbuf_sg() (i.e. all network drivers). Approved by: re (kib) MFC after: 2 weeks
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/busdma_machdep.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
index 951a76a..144b7f9 100644
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -847,13 +847,16 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map,
map->nsegs = nsegs;
if (segs != NULL)
memcpy(map->segments, segs, map->nsegs*sizeof(segs[0]));
- else
- segs = map->segments;
if (dmat->iommu != NULL)
IOMMU_MAP(dmat->iommu, map->segments, &map->nsegs,
dmat->lowaddr, dmat->highaddr, dmat->alignment,
dmat->boundary, dmat->iommu_cookie);
+ if (segs != NULL)
+ memcpy(segs, map->segments, map->nsegs*sizeof(segs[0]));
+ else
+ segs = map->segments;
+
return (segs);
}
OpenPOWER on IntegriCloud