summaryrefslogtreecommitdiff
path: root/sys/arch/vax
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-01-18 02:10:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-01-18 02:10:01 +0000
commita3d90b21625c1c3814871997a4e8f46a1e1b77c7 (patch)
tree274c1d8637a84481c60174205180cdd6ed205b0a /sys/arch/vax
parentdc2d2a10480efcbb2c641732f8b951b1db0624fc (diff)
Replace resource maps with extents.
This one was tricky but the light came at 3am.
Diffstat (limited to 'sys/arch/vax')
-rw-r--r--sys/arch/vax/vax/machdep.c35
1 files changed, 23 insertions, 12 deletions
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 <sys/signal.h>
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/map.h>
+#include <sys/extent.h>
+#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/user.h>
@@ -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);
}
/*