summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-05-13 19:43:49 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-05-13 19:43:49 +0000
commit6d6ae6090c1b2d79dd928a556940e060ce886438 (patch)
tree8c64d52e8e3f40904dcd5758cf81ad20d3fafd93 /sys/arch/sparc64
parent23384bc8d532820b5cad1d8660f3ee86a97e900f (diff)
Deal with 24bit dvma requests
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/iommu.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index f14276c3ef5..711cc35cec4 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.16 2002/03/26 18:13:11 jason Exp $ */
+/* $OpenBSD: iommu.c,v 1.17 2002/05/13 19:43:48 jason Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -518,14 +518,22 @@ iommu_dvmamap_load(t, is, map, buf, buflen, p, flags)
if ((boundary = (map->dm_segs[0]._ds_boundary)) == 0)
boundary = map->_dm_boundary;
align = max(map->dm_segs[0]._ds_align, NBPG);
+
+ if (flags & BUS_DMA_24BIT) {
+ sgstart = max(is->is_dvmamap->ex_start, 0xff000000);
+ sgend = min(is->is_dvmamap->ex_end, 0xffffffff);
+ } else {
+ sgstart = is->is_dvmamap->ex_start;
+ sgend = is->is_dvmamap->ex_end;
+ }
s = splhigh();
/*
* If our segment size is larger than the boundary we need to
* split the transfer up int little pieces ourselves.
*/
- err = extent_alloc(is->is_dvmamap, sgsize, align, 0,
- (sgsize > boundary) ? 0 : boundary,
- EX_NOWAIT|EX_BOUNDZERO, (u_long *)&dvmaddr);
+ err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
+ EX_NOWAIT|EX_BOUNDZERO, (u_long *)&dvmaddr);
splx(s);
#ifdef DEBUG
@@ -735,15 +743,21 @@ iommu_dvmamap_load_raw(t, is, map, segs, nsegs, flags, size)
}
sgsize = round_page(sgsize);
+ if (flags & BUS_DMA_24BIT) {
+ sgstart = max(is->is_dvmamap->ex_start, 0xff000000);
+ sgend = min(is->is_dvmamap->ex_end, 0xffffffff);
+ } else {
+ sgstart = is->is_dvmamap->ex_start;
+ sgend = is->is_dvmamap->ex_end;
+ }
s = splhigh();
/*
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
*/
- err = extent_alloc(is->is_dvmamap, sgsize, align, 0,
- (sgsize > boundary) ? 0 : boundary,
- ((flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT) |
- EX_BOUNDZERO, (u_long *)&dvmaddr);
+ err = extent_alloc_subregion(is->is_dvmamap, sgstart, sgend,
+ sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
+ EX_NOWAIT|EX_BOUNDZERO, (u_long *)&dvmaddr);
splx(s);
if (err != 0)