summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-01-17 01:10:12 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-01-17 01:10:12 +0000
commit2fc3d593b7d2544b8dc927834ce25c3d034786fb (patch)
treec5aac1e8cdacbea8d16db09749bec17204db0a47
parent3439793f70cbeda90601e554ce5e16075f12cb40 (diff)
Replace resource maps with extents.
-rw-r--r--sys/arch/sun3/sun3/dvma.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/sys/arch/sun3/sun3/dvma.c b/sys/arch/sun3/sun3/dvma.c
index 811727aa3af..4d1d5528ccc 100644
--- a/sys/arch/sun3/sun3/dvma.c
+++ b/sys/arch/sun3/sun3/dvma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvma.c,v 1.14 2001/11/06 19:53:16 miod Exp $ */
+/* $OpenBSD: dvma.c,v 1.15 2002/01/17 01:10:11 miod Exp $ */
/* $NetBSD: dvma.c,v 1.5 1996/11/20 18:57:29 gwr Exp $ */
/*-
@@ -42,7 +42,7 @@
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/malloc.h>
-#include <sys/map.h>
+#include <sys/extent.h>
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/user.h>
@@ -63,7 +63,7 @@
/* Resource map used by dvma_mapin/dvma_mapout */
#define NUM_DVMA_SEGS 10
-struct map dvma_segmap[NUM_DVMA_SEGS];
+struct extent *dvma_segmap;
/* XXX: Might need to tune this... */
vm_size_t dvma_segmap_size = 6 * NBSG;
@@ -99,8 +99,9 @@ dvma_init()
* Create the VM pool used for mapping whole segments
* into DVMA space for the purpose of data transfer.
*/
- rminit(dvma_segmap, dvma_segmap_size, segmap_addr,
- "dvma_segmap", NUM_DVMA_SEGS);
+ dvma_segmap = extent_create("dvma_segmap",
+ (u_long)segmap_addr, (u_long)segmap_addr + NUM_DVMA_SEGS * NBSG,
+ M_DEVBUF, NULL, 0, EX_NOWAIT);
}
/*
@@ -181,7 +182,7 @@ dvma_mapin(kva, len)
vm_offset_t seg_kva, seg_dma, seg_len, seg_off;
register vm_offset_t v, x;
register int sme;
- int s;
+ int s, error;
/* Get seg-aligned address and length. */
seg_kva = (vm_offset_t)kva;
@@ -196,14 +197,17 @@ dvma_mapin(kva, len)
s = splimp();
/* Allocate the DVMA segment(s) */
- seg_dma = rmalloc(dvma_segmap, seg_len);
+ error = extent_alloc(dvma_segmap, seg_len, NBSG,
+ 0, EX_NOBOUNDARY, EX_NOWAIT, (u_long *)&seg_dma);
+ if (error != 0)
+ seg_dma = NULL;
#ifdef DIAGNOSTIC
if (seg_dma & SEGOFSET)
panic("dvma_mapin: seg not aligned");
#endif
- if (seg_dma != 0) {
+ if (seg_dma != NULL) {
/* Duplicate the mappings into DMA space. */
v = seg_kva;
x = seg_dma;
@@ -243,7 +247,7 @@ dvma_mapout(dma, len)
vm_offset_t seg_dma, seg_len, seg_off;
register vm_offset_t v, x;
register int sme;
- int s;
+ int s, error;
/* Get seg-aligned address and length. */
seg_dma = (vm_offset_t)dma;
@@ -275,6 +279,10 @@ dvma_mapout(dma, len)
v += NBSG;
}
- rmfree(dvma_segmap, seg_len, seg_dma);
+ error = extent_free(dvma_segmap, (u_long)seg_dma, seg_len, EX_NOWAIT);
+
+ if (error != 0)
+ printf("dvma_mapout: extent_free failed\n");
+
splx(s);
}