summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-01-22 10:52:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-01-22 10:52:36 +0000
commit004bb414bb707f708928160ba81ea72920793cfe (patch)
tree97144e715ca34552232004df0de24f00b1e6782b /sys/arch/sparc64/dev
parent2ebabe7da9667c978921ac581267d1e5f0ad6aeb (diff)
Use extent_alloc_subregion_with_descr(9). This should make bus_dmamap_load(9)
and bus_dmamap_unload(9) "mpsafe".
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r--sys/arch/sparc64/dev/iommu.c12
-rw-r--r--sys/arch/sparc64/dev/iommuvar.h4
-rw-r--r--sys/arch/sparc64/dev/viommu.c12
3 files changed, 15 insertions, 13 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index b4d7faa1525..902c1d1ea3b 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.66 2013/01/15 03:14:01 kettenis Exp $ */
+/* $OpenBSD: iommu.c,v 1.67 2014/01/22 10:52:35 kettenis Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -226,7 +226,7 @@ iommu_init(char *name, struct iommu_state *is, int tsbsize, u_int32_t iovabase)
#endif
is->is_dvmamap = extent_create(name,
is->is_dvmabase, (u_long)is->is_dvmaend + 1,
- M_DEVBUF, 0, 0, EX_NOWAIT);
+ M_DEVBUF, NULL, 0, EX_NOCOALESCE);
mtx_init(&is->is_mtx, IPL_HIGH);
/*
@@ -749,9 +749,9 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
*/
- err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ err = extent_alloc_subregion_with_descr(is->is_dvmamap, sgstart, sgend,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
- EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
+ EX_NOWAIT | EX_BOUNDZERO, &ims->ims_er, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
#ifdef DEBUG
@@ -956,9 +956,9 @@ iommu_dvmamap_load_raw(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
*/
- err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ err = extent_alloc_subregion_with_descr(is->is_dvmamap, sgstart, sgend,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
- EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
+ EX_NOWAIT | EX_BOUNDZERO, &ims->ims_er, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
if (err != 0) {
diff --git a/sys/arch/sparc64/dev/iommuvar.h b/sys/arch/sparc64/dev/iommuvar.h
index d1f1bbf9453..cc0dab203c9 100644
--- a/sys/arch/sparc64/dev/iommuvar.h
+++ b/sys/arch/sparc64/dev/iommuvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommuvar.h,v 1.15 2009/05/04 16:48:37 oga Exp $ */
+/* $OpenBSD: iommuvar.h,v 1.16 2014/01/22 10:52:35 kettenis Exp $ */
/* $NetBSD: iommuvar.h,v 1.9 2001/10/07 20:30:41 eeh Exp $ */
/*
@@ -37,6 +37,7 @@
#include <sys/tree.h>
#endif
+#include <sys/extent.h>
#include <sys/mutex.h>
/*
@@ -94,6 +95,7 @@ struct iommu_map_state {
struct strbuf_ctl *ims_sb; /* Link to parent */
struct iommu_state *ims_iommu;
int ims_flags;
+ struct extent_region ims_er;
struct iommu_page_map ims_map; /* map must be last (array at end) */
};
#define IOMMU_MAP_STREAM 1
diff --git a/sys/arch/sparc64/dev/viommu.c b/sys/arch/sparc64/dev/viommu.c
index 3a84e3f0ff8..d9117185d70 100644
--- a/sys/arch/sparc64/dev/viommu.c
+++ b/sys/arch/sparc64/dev/viommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viommu.c,v 1.13 2013/01/15 03:14:01 kettenis Exp $ */
+/* $OpenBSD: viommu.c,v 1.14 2014/01/22 10:52:35 kettenis Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -127,7 +127,7 @@ viommu_init(char *name, struct iommu_state *is, int tsbsize,
printf("dvma map %x-%x", is->is_dvmabase, is->is_dvmaend);
is->is_dvmamap = extent_create(name,
is->is_dvmabase, (u_long)is->is_dvmaend + 1,
- M_DEVBUF, 0, 0, EX_NOWAIT);
+ M_DEVBUF, NULL, 0, EX_NOCOALESCE);
mtx_init(&is->is_mtx, IPL_HIGH);
printf("\n");
@@ -356,9 +356,9 @@ viommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
*/
- err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ err = extent_alloc_subregion_with_descr(is->is_dvmamap, sgstart, sgend,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
- EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
+ EX_NOWAIT | EX_BOUNDZERO, &ims->ims_er, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
#ifdef DEBUG
@@ -539,9 +539,9 @@ viommu_dvmamap_load_raw(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
*/
- err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ err = extent_alloc_subregion_with_descr(is->is_dvmamap, sgstart, sgend,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
- EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
+ EX_NOWAIT | EX_BOUNDZERO, &ims->ims_er, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
if (err != 0) {