diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-04-29 19:00:04 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-04-29 19:00:04 +0000 |
commit | 155bfa959b4291add2a7fd1c3c5c10cf40600714 (patch) | |
tree | 9807caa11187d53a4917f67f5161955cad07b7bf /sys | |
parent | 5c7d6fe7cb5c2c957340319dc6d536fb05a9bb45 (diff) |
Replace resource maps with extents, and cleanup associated variables.
Idea from art's todolist, art@ ok.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme88k/mvme88k/autoconf.c | 7 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 21 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/vm_machdep.c | 44 |
4 files changed, 30 insertions, 48 deletions
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c index 8407a899209..0adec0132c1 100644 --- a/sys/arch/mvme88k/mvme88k/autoconf.c +++ b/sys/arch/mvme88k/mvme88k/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.10 2001/03/16 00:03:58 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.11 2001/04/29 19:00:02 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -68,10 +68,6 @@ struct device *getdisk __P((char *, int, int, dev_t *)); int cold; /* 1 if still booting */ -/* XXX must be allocated statically because of early console init */ -struct map extiomap[EIOMAPSIZE/16]; -extern void *extiobase; - /* * called at boot time, configure all devices on the system. */ @@ -79,7 +75,6 @@ void configure() { bootdv = NULL; /* set by device drivers (if found) */ -/* rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);*/ if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index f63c6653155..351d5f37122 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.14 2001/03/12 22:56:17 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.15 2001/04/29 19:00:02 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -483,13 +483,11 @@ _esym: word 0 #endif /* DDB || NKSYMS > 0 */ - global _intiobase, _intiolimit, _extiobase + global _intiobase, _intiolimit _intiobase: word 0 | KVA of base of internal IO space _intiolimit: word 0 | KVA of end of internal IO space -_extiobase: - word 0 | KVA of base of external IO space global _proc0paddr /* move to C code */ _proc0paddr: diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index f35866f44a7..04ef80e3cd8 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2001/04/17 04:30:47 aaron Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2001/04/29 19:00:03 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -74,6 +74,7 @@ #include <sys/exec.h> #include <sys/sysctl.h> #include <sys/errno.h> +#include <sys/extent.h> #include <net/netisr.h> @@ -170,7 +171,6 @@ volatile vm_offset_t kernelva; volatile vm_offset_t utilva; volatile vm_offset_t sramva; volatile vm_offset_t obiova; -volatile vm_offset_t extiova; int physmem; /* available physical memory, in pages */ int cold; /* boot process flag */ @@ -205,9 +205,8 @@ vaddr_t iomapbase; vm_offset_t iomapbase; #endif -struct map *iomap; +struct extent *iomap_extent; vm_map_t iomap_map; -int niomap; /* * Declare these as initialized data so we can patch them. @@ -739,7 +738,7 @@ cpu_startup() } /* - * Allocate map for external I/O XXX new code - smurph + * Allocate map for external I/O */ #if defined(UVM) iomap_map = uvm_km_suballoc(kernel_map, &iomapbase, &maxaddr, @@ -751,7 +750,10 @@ cpu_startup() if (iomap_map == NULL) { panic("cpu_startup: unable to create iomap_map"); } - rminit(iomap, IOMAP_SIZE, (u_long)iomapbase, "iomap", NIOPMAP); + iomap_extent = extent_create("iomap", iomapbase, + iomapbase + IOMAP_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); + if (iomap_extent == 0) + panic("unable to allocate extent for iomap"); /* * Finally, allocate mbuf pool. Since mclrefcnt is an off-size @@ -905,13 +907,6 @@ allocsys(v) #endif valloc(buf, struct buf, nbuf); -#if 1 /*XXX_FUTURE*/ - /* - * Arbitrarily limit the number of devices mapping - * the IO space at a given time to NIOPMAP (= 32, default). - */ - valloc(iomap, struct map, niomap = NIOPMAP); -#endif return v; } diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 8761f80cee1..85d3d9e6128 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.20 2001/03/12 23:03:25 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.21 2001/04/29 19:00:03 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -54,6 +54,7 @@ #include <sys/buf.h> #include <sys/user.h> #include <sys/vnode.h> +#include <sys/extent.h> #include <vm/vm.h> #include <vm/vm_kern.h> @@ -69,7 +70,7 @@ #include <machine/cmmu.h> #include <machine/pte.h> -extern struct map *iomap; +extern struct extent *iomap_extent; extern vm_map_t iomap_map; /* @@ -318,8 +319,7 @@ vunmapbuf(bp, len) } -#if 1 -/* XXX_FUTURE +/* * Map a range [pa, pa+len] in the given map to a kernel address * in iomap space. * @@ -330,8 +330,8 @@ vunmapbuf(bp, len) vm_offset_t iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) { - vm_offset_t iova, tva, off, ppa; - register int s; + vm_offset_t iova, tva, off, ppa; + int s, error; if (len == 0) return NULL; @@ -341,19 +341,13 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) len = round_page(off + len); - s = splimp(); - for (;;) { - iova = rmalloc(iomap, len); - if (iova != 0) - break; - if (canwait) { - (void)tsleep(iomap, PRIBIO+1, "iomapin", 0); - continue; - } - splx(s); - return NULL; - } + s = splhigh(); + error = extent_alloc(iomap_extent, len, PAGE_SIZE, 0, + canwait ? EX_WAITSPACE : 0, &iova); splx(s); + + if (error != 0) + return NULL; cmmu_flush_tlb(1, iova, len); @@ -386,8 +380,8 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) int iomap_mapout(vm_offset_t kva, vm_size_t len) { - register int s; - vm_offset_t off; + vm_offset_t off; + int s, error; off = kva & PGOFSET; kva = trunc_page(kva); @@ -395,15 +389,15 @@ iomap_mapout(vm_offset_t kva, vm_size_t len) pmap_remove(vm_map_pmap(iomap_map), kva, kva + len); - s = splimp(); - rmfree(iomap, len, kva); - wakeup(iomap); + s = splhigh(); + error = extent_free(iomap_extent, kva, len, EX_NOWAIT); splx(s); + if (error != 0) + printf("iomap_mapout: extent_free failed\n"); + return 1; } -#endif /* XXX_FUTURE */ - /* * Allocate/deallocate a cache-inhibited range of kernel virtual address * space mapping the indicated physical address range [pa - pa+size) |