summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/include/param.h10
-rw-r--r--sys/arch/sparc/sparc/machdep.c17
-rw-r--r--sys/arch/sparc/sparc/vm_machdep.c44
3 files changed, 29 insertions, 42 deletions
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 84812a39f86..d0480956b16 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.12 1999/11/25 08:46:44 art Exp $ */
+/* $OpenBSD: param.h,v 1.13 2000/02/15 16:32:41 art Exp $ */
/* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */
/*
@@ -171,13 +171,7 @@ extern int nbpg, pgofset, pgshift;
#ifndef _LOCORE
extern vaddr_t dvma_base;
extern vaddr_t dvma_end;
-extern struct map *dvmamap;
-/*
- * The dvma resource map is defined in page units, which are numbered 1 to N.
- * Use these macros to convert to/from virtual addresses.
- */
-#define rctov(n) (ctob(((n)-1))+dvma_base)
-#define vtorc(v) ((btoc((v)-dvma_base))+1)
+extern struct extent *dvmamap_extent;
extern caddr_t kdvma_mapin __P((caddr_t, int, int));
extern caddr_t dvma_malloc __P((size_t, void *, int));
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 152a2331e2b..28fc8453842 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.43 1999/11/26 16:21:01 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.44 2000/02/15 16:32:41 art Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -75,6 +75,7 @@
#endif
#include <sys/exec.h>
#include <sys/sysctl.h>
+#include <sys/extent.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@@ -155,8 +156,7 @@ int safepri = 0;
* the memory range in `phys_map' (which is mostly a place-holder).
*/
vaddr_t dvma_base, dvma_end;
-struct map *dvmamap;
-static int ndvmamap; /* # of entries in dvmamap */
+struct extent *dvmamap_extent;
caddr_t allocsys __P((caddr_t));
void dumpsys __P((void));
@@ -329,8 +329,10 @@ cpu_startup()
if (kmem_alloc_wait(phys_map, (dvma_end-dvma_base)) != dvma_base)
panic("unable to allocate from DVMA map");
#endif
- rminit(dvmamap, btoc((dvma_end-dvma_base)),
- vtorc(dvma_base), "dvmamap", ndvmamap);
+ dvmamap_extent = extent_create("dvmamap", dvma_base, dvma_end,
+ M_DEVBUF, NULL, 0, EX_NOWAIT);
+ if (dvmamap_extent == 0)
+ panic("unable to allocate extent for dvma");
/*
* Finally, allocate mbuf pool. Since mclrefcnt is an off-size
@@ -465,11 +467,6 @@ allocsys(v)
valloc(swbuf, struct buf, nswbuf);
#endif
valloc(buf, struct buf, nbuf);
- /*
- * Allocate DVMA slots for 1/4 of the number of i/o buffers
- * and one for each process too (PHYSIO).
- */
- valloc(dvmamap, struct map, ndvmamap = maxproc + ((nbuf / 4) &~ 1));
return (v);
}
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c
index f652a915546..06a983781f2 100644
--- a/sys/arch/sparc/sparc/vm_machdep.c
+++ b/sys/arch/sparc/sparc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.12 1999/12/09 16:19:50 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.13 2000/02/15 16:32:41 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
@@ -59,6 +59,7 @@
#include <sys/exec.h>
#include <sys/vnode.h>
#include <sys/map.h>
+#include <sys/extent.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@@ -174,11 +175,12 @@ dvma_mapin(map, va, len, canwait)
int len, canwait;
{
vaddr_t kva, tva;
- register int npf, s;
- register paddr_t pa;
- long off, pn;
+ int npf, s;
+ paddr_t pa;
+ long off;
vaddr_t ova;
int olen;
+ int error;
ova = va;
olen = len;
@@ -188,23 +190,13 @@ dvma_mapin(map, va, len, canwait)
len = round_page(len + off);
npf = btoc(len);
- s = splimp();
- for (;;) {
-
- pn = rmalloc(dvmamap, npf);
-
- if (pn != 0)
- break;
- if (canwait) {
- (void)tsleep(dvmamap, PRIBIO+1, "physio", 0);
- continue;
- }
- splx(s);
- return NULL;
- }
+ s = splhigh();
+ error = extent_alloc(dvmamap_extent, len, PAGE_SIZE, 0,
+ canwait ? EX_WAITSPACE : 0, &tva);
splx(s);
-
- kva = tva = rctov(pn);
+ if (error)
+ return NULL;
+ kva = tva;
while (npf--) {
pa = pmap_extract(vm_map_pmap(map), va);
@@ -254,7 +246,8 @@ dvma_mapout(kva, va, len)
vaddr_t kva, va;
int len;
{
- register int s, off;
+ int s, off;
+ int error;
off = (int)kva & PGOFSET;
kva -= off;
@@ -267,9 +260,10 @@ dvma_mapout(kva, va, len)
#endif
pmap_remove(pmap_kernel(), kva, kva + len);
- s = splimp();
- rmfree(dvmamap, btoc(len), vtorc(kva));
- wakeup(dvmamap);
+ s = splhigh();
+ error = extent_free(dvmamap_extent, kva, len, EX_NOWAIT);
+ if (error)
+ printf("dvma_mapout: extent_free failed\n");
splx(s);
if (CACHEINFO.c_vactype != VAC_NONE)
@@ -345,6 +339,8 @@ vunmapbuf(bp, sz)
kva = (vaddr_t)bp->b_data;
off = kva & PGOFSET;
size = round_page(bp->b_bcount + off);
+
+ kva = trunc_page(kva);
#if defined(UVM)
uvm_km_free_wakeup(kernel_map, trunc_page(kva), size);
#else