summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/dev/bus_dma.c7
-rw-r--r--sys/arch/arm/arm/bus_dma.c7
-rw-r--r--sys/arch/arm64/arm64/bus_dma.c8
-rw-r--r--sys/arch/landisk/landisk/bus_dma.c7
-rw-r--r--sys/arch/loongson/loongson/bus_dma.c8
-rw-r--r--sys/arch/octeon/octeon/bus_dma.c8
-rw-r--r--sys/arch/powerpc/powerpc/bus_dma.c7
-rw-r--r--sys/arch/sgi/sgi/bus_dma.c8
8 files changed, 44 insertions, 16 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c
index b9dd135c75c..6b2355e6730 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.35 2014/11/16 12:30:56 deraadt Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.36 2018/01/11 15:49:34 visa Exp $ */
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
/*-
@@ -111,8 +111,11 @@ _bus_dmamap_destroy(t, map)
bus_dma_tag_t t;
bus_dmamap_t map;
{
+ size_t mapsize;
- free(map, M_DEVBUF, 0);
+ mapsize = sizeof(struct alpha_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c
index 87a4047651f..231951c7262 100644
--- a/sys/arch/arm/arm/bus_dma.c
+++ b/sys/arch/arm/arm/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.37 2017/12/30 20:46:59 guenther Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.38 2018/01/11 15:49:34 visa Exp $ */
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
/*-
@@ -158,12 +158,15 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
+ size_t mapsize;
#ifdef DEBUG_DMA
printf("dmamap_destroy: t=%p map=%p\n", t, map);
#endif /* DEBUG_DMA */
- free(map, M_DEVBUF, 0);
+ mapsize = sizeof(struct arm32_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/arm64/arm64/bus_dma.c b/sys/arch/arm64/arm64/bus_dma.c
index 74876fe04e6..fe1671adf97 100644
--- a/sys/arch/arm64/arm64/bus_dma.c
+++ b/sys/arch/arm64/arm64/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.9 2017/08/11 22:01:09 kettenis Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.10 2018/01/11 15:49:34 visa Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -115,7 +115,11 @@ _dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct machine_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/landisk/landisk/bus_dma.c b/sys/arch/landisk/landisk/bus_dma.c
index 2385133c0f2..68d23f1a615 100644
--- a/sys/arch/landisk/landisk/bus_dma.c
+++ b/sys/arch/landisk/landisk/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.13 2015/01/25 11:36:41 dlg Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.14 2018/01/11 15:49:34 visa Exp $ */
/* $NetBSD: bus_dma.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*
@@ -132,10 +132,13 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
+ size_t mapsize;
DPRINTF(("bus_dmamap_destroy: t = %p, map = %p\n", t, map));
- free(map, M_DEVBUF, 0);
+ mapsize = sizeof(struct _bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
int
diff --git a/sys/arch/loongson/loongson/bus_dma.c b/sys/arch/loongson/loongson/bus_dma.c
index b60d72c1175..fbd52133cdb 100644
--- a/sys/arch/loongson/loongson/bus_dma.c
+++ b/sys/arch/loongson/loongson/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.19 2015/08/15 22:31:38 miod Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.20 2018/01/11 15:49:34 visa Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -117,7 +117,11 @@ _dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct machine_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/octeon/octeon/bus_dma.c b/sys/arch/octeon/octeon/bus_dma.c
index 5c14b454350..7d8943f15d0 100644
--- a/sys/arch/octeon/octeon/bus_dma.c
+++ b/sys/arch/octeon/octeon/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.15 2017/04/15 04:38:27 visa Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.16 2018/01/11 15:49:34 visa Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -117,7 +117,11 @@ _dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct machine_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/powerpc/powerpc/bus_dma.c b/sys/arch/powerpc/powerpc/bus_dma.c
index 791bd484688..e5fe71437dd 100644
--- a/sys/arch/powerpc/powerpc/bus_dma.c
+++ b/sys/arch/powerpc/powerpc/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.4 2017/12/30 20:46:59 guenther Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.5 2018/01/11 15:49:34 visa Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -98,8 +98,11 @@ _dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
+ size_t mapsize;
- free(map, M_DEVBUF, 0);
+ mapsize = sizeof(struct powerpc_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
diff --git a/sys/arch/sgi/sgi/bus_dma.c b/sys/arch/sgi/sgi/bus_dma.c
index 62ee440901a..9bc5037ccce 100644
--- a/sys/arch/sgi/sgi/bus_dma.c
+++ b/sys/arch/sgi/sgi/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.41 2017/05/11 15:47:45 visa Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.42 2018/01/11 15:49:34 visa Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -120,7 +120,11 @@ _dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct machine_bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*