From a3d90b21625c1c3814871997a4e8f46a1e1b77c7 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Fri, 18 Jan 2002 02:10:01 +0000 Subject: Replace resource maps with extents. This one was tricky but the light came at 3am. --- sys/arch/vax/vax/machdep.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'sys/arch/vax') diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index ecc8254ae37..516b15cab8c 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.49 2001/12/18 11:17:26 hugh Exp $ */ +/* $OpenBSD: machdep.c,v 1.50 2002/01/18 02:10:00 miod Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -49,7 +49,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -151,8 +152,15 @@ int physmem; int dumpsize = 0; int cold = 1; /* coldstart */ +/* + * XXX some storage space must be allocated statically because of + * early console init + */ #define IOMAPSZ 100 -static struct map iomap[IOMAPSZ]; +char extiospace[EXTENT_FIXED_STORAGE_SIZE(IOMAPSZ)]; + +struct extent *extio; +extern vaddr_t iospace; struct vm_map *exec_map = NULL; struct vm_map *mb_map = NULL; @@ -345,8 +353,13 @@ consinit() /* * Init I/O memory resource map. Must be done before cninit() * is called; we may want to use iospace in the console routines. + * + * XXX console code uses the first page at iospace, so do not make + * the extent start at iospace. */ - rminit(iomap, IOSPSZ, (long)1, "iomap", IOMAPSZ); + extio = extent_create("extio", + (u_long)iospace + VAX_NBPG, (u_long)iospace + IOSPSZ * VAX_NBPG, + M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT); #ifdef DEBUG iospace_inited = 1; #endif @@ -709,9 +722,8 @@ vax_map_physmem(phys, size) paddr_t phys; int size; { - extern vaddr_t iospace; vaddr_t addr; - int pageno; + int error; static int warned = 0; #ifdef DEBUG @@ -723,13 +735,13 @@ vax_map_physmem(phys, size) if (addr == 0) panic("vax_map_physmem: kernel map full"); } else { - pageno = rmalloc(iomap, size); - if (pageno == 0) { + error = extent_alloc(extio, size * VAX_NBPG, VAX_NBPG, 0, + EX_NOBOUNDARY, EX_NOWAIT | EX_MALLOCOK, (u_long *)&addr); + if (error != 0) { if (warned++ == 0) /* Warn only once */ printf("vax_map_physmem: iomap too small"); return 0; } - addr = iospace + (pageno * VAX_NBPG); } ioaccess(addr, phys, size); #ifdef PHYSMEMDEBUG @@ -747,8 +759,6 @@ vax_unmap_physmem(addr, size) vaddr_t addr; int size; { - extern vaddr_t iospace; - int pageno = (addr - iospace) / VAX_NBPG; #ifdef PHYSMEMDEBUG printf("vax_unmap_physmem: unmapping %d pages at addr %lx\n", size, addr); @@ -757,7 +767,8 @@ vax_unmap_physmem(addr, size) if (size >= LTOHPN) uvm_km_free(kernel_map, addr, size * VAX_NBPG); else - rmfree(iomap, size, pageno); + extent_free(extio, (u_long)addr & ~VAX_PGOFSET, + size * VAX_NBPG, EX_NOWAIT); } /* -- cgit v1.2.3