summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-01-16 20:51:46 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-01-16 20:51:46 +0000
commit004b046d11856ea1fb91720856612fd4e1765a29 (patch)
tree5524b187ea997a89c7d4f04902ef9a121e8d3117 /sys/arch
parent2104b5cfc2dcb54ff2570b8eb33764d36a9cfac0 (diff)
Replace resource maps with extents.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hp300/hp300/autoconf.c33
-rw-r--r--sys/arch/hp300/hp300/machdep.c19
2 files changed, 34 insertions, 18 deletions
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
index a4964a23c84..cdb61c427df 100644
--- a/sys/arch/hp300/hp300/autoconf.c
+++ b/sys/arch/hp300/hp300/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.20 2001/12/10 00:58:02 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.21 2002/01/16 20:51:45 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
/*
@@ -71,7 +71,7 @@
#include <sys/device.h>
#include <sys/disklabel.h>
#include <sys/malloc.h>
-#include <sys/map.h>
+#include <sys/extent.h>
#include <sys/mount.h>
#include <sys/queue.h>
#include <sys/reboot.h>
@@ -106,8 +106,7 @@
*/
int cold; /* if 1, still working on cold-start */
-/* XXX must be allocated statically because of early console init */
-struct map extiomap[EIOMAPSIZE/16];
+struct extent *extio;
extern caddr_t internalhpib;
extern char *extiobase;
@@ -1245,18 +1244,22 @@ iomap(pa, size)
caddr_t pa;
int size;
{
- int ix, npf;
+ int error;
caddr_t kva;
+ if (size == 0)
+ return NULL;
+
#ifdef DEBUG
if (((int)pa & PGOFSET) || (size & PGOFSET))
panic("iomap: unaligned");
#endif
- npf = btoc(size);
- ix = rmalloc(extiomap, npf);
- if (ix == 0)
- return(0);
- kva = extiobase + ctob(ix-1);
+ error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
+ EX_NOWAIT | EX_MALLOCOK, (u_long *)&kva);
+
+ if (error != 0)
+ return NULL;
+
physaccess(kva, pa, size, PG_RW|PG_CI);
return(kva);
}
@@ -1269,7 +1272,7 @@ iounmap(kva, size)
caddr_t kva;
int size;
{
- int ix;
+ int error;
#ifdef DEBUG
if (((int)kva & PGOFSET) || (size & PGOFSET))
@@ -1277,7 +1280,11 @@ iounmap(kva, size)
if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE))
panic("iounmap: bad address");
#endif
+
physunaccess(kva, size);
- ix = btoc(kva - extiobase) + 1;
- rmfree(extiomap, btoc(size), ix);
+
+ error = extent_free(extio, (u_long)kva, size, EX_NOWAIT);
+
+ if (error != 0)
+ printf("iounmap: extent_free failed\n");
}
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index 7b689f7caf0..c353daddf45 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.74 2001/12/06 18:53:01 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.75 2002/01/16 20:51:45 miod Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -55,7 +55,7 @@
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
-#include <sys/map.h>
+#include <sys/extent.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
#include <sys/msgbuf.h>
@@ -147,6 +147,12 @@ extern struct emul emul_hpux;
extern struct emul emul_sunos;
#endif
+/*
+ * XXX some storage space must be allocated statically because of
+ * early console init
+ */
+char extiospace[EXTENT_FIXED_STORAGE_SIZE(EIOMAPSIZE / 16)];
+
/* prototypes for local functions */
caddr_t allocsys __P((caddr_t));
void parityenable __P((void));
@@ -210,7 +216,8 @@ hp300_init()
void
consinit()
{
- extern struct map extiomap[];
+ extern struct extent *extio;
+ extern char *extiobase;
/*
* Initialize some variables for sanity.
@@ -223,8 +230,10 @@ consinit()
/*
* Initialize the DIO resource map.
*/
- rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);
-
+ extio = extent_create("extio",
+ (u_long)extiobase, (u_long)extiobase + ctob(EIOMAPSIZE),
+ M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT);
+
/*
* Initialize the console before we print anything out.
*/