summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-11-09 15:02:24 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-11-09 15:02:24 +0000
commit43fd4d987ed052b13dc10e242705c0d862e4b6dd (patch)
tree2cc5adfda27b83e34bba477426734fbdc4042cef /sys/arch
parent405c338487d27d8c59db583a49ca17e37aaba898 (diff)
Luna88k does not have an iomap, so kill all iomap related defines, and
move the mapiodev()/unmapiodev() code back to mvme88k.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c14
-rw-r--r--sys/arch/m88k/m88k/vm_machdep.c106
-rw-r--r--sys/arch/mvme88k/dev/mainbus.c91
3 files changed, 88 insertions, 123 deletions
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index 104dc41c60c..cc881c98e91 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.16 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.17 2004/11/09 15:02:19 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -216,18 +216,6 @@ struct vm_map *exec_map = NULL;
struct vm_map *phys_map = NULL;
/*
- * iomap stuff is for managing chunks of virtual address space that
- * can be allocated to IO devices.
- * VMEbus drivers use this at this now. Only on-board IO devices' addresses
- * are mapped so that pa == va. XXX smurph.
- */
-
-vaddr_t iomapbase;
-
-struct extent *iomap_extent;
-struct vm_map *iomap_map;
-
-/*
* Declare these as initialized data so we can patch them.
*/
#ifdef NBUF
diff --git a/sys/arch/m88k/m88k/vm_machdep.c b/sys/arch/m88k/m88k/vm_machdep.c
index 324b6ff8b20..45439bb17c6 100644
--- a/sys/arch/m88k/m88k/vm_machdep.c
+++ b/sys/arch/m88k/m88k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.3 2004/10/01 19:00:48 miod Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.4 2004/11/09 15:02:22 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -49,7 +49,6 @@
#include <sys/buf.h>
#include <sys/user.h>
#include <sys/vnode.h>
-#include <sys/extent.h>
#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
@@ -63,18 +62,10 @@
#include <machine/locore.h>
#include <machine/trap.h>
-extern struct extent *iomap_extent;
-extern struct vm_map *iomap_map;
-
extern void proc_do_uret(struct proc *);
extern void savectx(struct pcb *);
extern void switch_exit(struct proc *);
-vaddr_t iomap_mapin(paddr_t, psize_t, boolean_t);
-void iomap_mapout(vaddr_t, vsize_t);
-void *mapiodev(void *, int);
-void unmapiodev(void *, int);
-
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the kernel stack and pcb, making the child
@@ -329,101 +320,6 @@ vunmapbuf(bp, len)
bp->b_saveaddr = 0;
}
-
-/*
- * Map a range [pa, pa+len] in the given map to a kernel address
- * in iomap space.
- *
- * Note: To be flexible, I did not put a restriction on the alignment
- * of pa. However, it is advisable to have pa page aligned since otherwise,
- * we might have several mappings for a given chunk of the IO page.
- */
-vaddr_t
-iomap_mapin(paddr_t pa, psize_t len, boolean_t canwait)
-{
- vaddr_t iova, tva, off;
- paddr_t ppa;
- int s, error;
-
- if (len == 0)
- return NULL;
-
- ppa = trunc_page(pa);
- off = pa & PGOFSET;
- len = round_page(off + len);
-
- s = splhigh();
- error = extent_alloc(iomap_extent, len, PAGE_SIZE, 0, EX_NOBOUNDARY,
- canwait ? EX_WAITSPACE : EX_NOWAIT, &iova);
- splx(s);
-
- if (error != 0)
- return NULL;
-
- cmmu_flush_tlb(cpu_number(), 1, iova, len); /* necessary? */
-
- tva = iova;
- while (len != 0) {
- pmap_enter(vm_map_pmap(iomap_map), tva, ppa,
- VM_PROT_WRITE | VM_PROT_READ,
- VM_PROT_WRITE | VM_PROT_READ | PMAP_WIRED);
- len -= PAGE_SIZE;
- tva += PAGE_SIZE;
- ppa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (iova + off);
-}
-
-/*
- * Free up the mapping in iomap.
- */
-void
-iomap_mapout(vaddr_t kva, vsize_t len)
-{
- vaddr_t off;
- int s, error;
-
- off = kva & PGOFSET;
- kva = trunc_page(kva);
- len = round_page(off + len);
-
- pmap_remove(vm_map_pmap(iomap_map), kva, kva + len);
- pmap_update(vm_map_pmap(iomap_map));
-
- s = splhigh();
- error = extent_free(iomap_extent, kva, len, EX_NOWAIT);
- splx(s);
-
- if (error != 0)
- printf("iomap_mapout: extent_free failed\n");
-}
-
-/*
- * Allocate/deallocate a cache-inhibited range of kernel virtual address
- * space mapping the indicated physical address range [pa - pa+size)
- */
-void *
-mapiodev(pa, size)
- void *pa;
- int size;
-{
- paddr_t ppa;
- ppa = (paddr_t)pa;
- return ((void *)iomap_mapin(ppa, size, 0));
-}
-
-void
-unmapiodev(kva, size)
- void *kva;
- int size;
-{
- vaddr_t va;
- va = (vaddr_t)kva;
- iomap_mapout(va, size);
-}
-
int
badvaddr(vaddr_t va, int size)
{
diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c
index a394254f76d..bc82805a4ce 100644
--- a/sys/arch/mvme88k/dev/mainbus.c
+++ b/sys/arch/mvme88k/dev/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.13 2004/08/02 08:35:00 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.14 2004/11/09 15:02:23 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 2004, Miodrag Vallat.
@@ -31,11 +31,15 @@
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/disklabel.h>
+#include <sys/extent.h>
+
+#include <uvm/uvm_extern.h>
#include <machine/bus.h>
#include <machine/autoconf.h>
#include <machine/cmmu.h>
#include <machine/cpu.h>
+#include <machine/cpu_number.h>
#ifdef MVME188
#include <machine/mvme188.h>
@@ -66,6 +70,12 @@ const struct mvme88k_bus_space_tag mainbus_bustag = {
mainbus_vaddr
};
+extern struct extent *iomap_extent;
+extern struct vm_map *iomap_map;
+
+void *mapiodev(void *, int);
+void unmapiodev(void *, int);
+
/*
* Obio (internal IO) space is mapped 1:1 (see pmap_bootstrap() for details).
*
@@ -103,11 +113,7 @@ mainbus_map(bus_addr_t addr, bus_size_t size, int flags,
if (addr >= threshold)
map = (vaddr_t)addr;
else {
-#if 0
- map = iomap_mapin(addr, size, 0);
-#else
map = (vaddr_t)mapiodev((void *)addr, size);
-#endif
}
if (map == NULL)
@@ -138,6 +144,81 @@ mainbus_vaddr(bus_space_handle_t handle)
}
/*
+ * Map a range [pa, pa+size] in the given map to a kernel address
+ * in iomap space.
+ *
+ * Note: To be flexible, I did not put a restriction on the alignment
+ * of pa. However, it is advisable to have pa page aligned since otherwise,
+ * we might have several mappings for a given chunk of the IO page.
+ */
+void *
+mapiodev(pa, size)
+ void *pa;
+ int size;
+{
+ vaddr_t iova, tva, off;
+ paddr_t ppa;
+ int s, error;
+
+ if (size <= 0)
+ return NULL;
+
+ ppa = trunc_page((paddr_t)pa);
+ off = (paddr_t)pa & PGOFSET;
+ size = round_page(off + size);
+
+ s = splhigh();
+ error = extent_alloc(iomap_extent, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
+ EX_WAITSPACE, &iova);
+ splx(s);
+
+ if (error != 0)
+ return NULL;
+
+ cmmu_flush_tlb(cpu_number(), 1, iova, size); /* necessary? */
+
+ tva = iova;
+ while (size != 0) {
+ pmap_enter(vm_map_pmap(iomap_map), tva, ppa,
+ VM_PROT_WRITE | VM_PROT_READ,
+ VM_PROT_WRITE | VM_PROT_READ | PMAP_WIRED);
+ size -= PAGE_SIZE;
+ tva += PAGE_SIZE;
+ ppa += PAGE_SIZE;
+ }
+ pmap_update(vm_map_pmap(iomap_map));
+
+ return (void *)(iova + off);
+}
+
+/*
+ * Free up the mapping in iomap.
+ */
+void
+unmapiodev(va, size)
+ void *va;
+ int size;
+{
+ vaddr_t kva, off;
+ int s, error;
+
+ off = (vaddr_t)va & PGOFSET;
+ kva = trunc_page((vaddr_t)va);
+ size = round_page(off + size);
+
+ pmap_remove(vm_map_pmap(iomap_map), kva, kva + size);
+ pmap_update(vm_map_pmap(iomap_map));
+
+ s = splhigh();
+ error = extent_free(iomap_extent, kva, size, EX_NOWAIT);
+#ifdef DIAGNOSTIC
+ if (error != 0)
+ printf("unmapiodev: extent_free failed\n");
+#endif
+ splx(s);
+}
+
+/*
* Configuration glue
*/