summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2012-12-06 12:35:23 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2012-12-06 12:35:23 +0000
commitfbda61ad58e8dcb050be13e593b038adf3d78c3d (patch)
tree265765896e74a7c10e309a70ebf85e6304944748 /sys/arch
parent9c9f4fc0c31f65df26fadcfa2f2f853c34d46fab (diff)
Implement bus_space_mmap(9).
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/include/bus.h3
-rw-r--r--sys/arch/macppc/macppc/machdep.c19
2 files changed, 20 insertions, 2 deletions
diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h
index eb00af8b577..4eeec12c5f6 100644
--- a/sys/arch/macppc/include/bus.h
+++ b/sys/arch/macppc/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.21 2012/08/30 18:14:26 mpi Exp $ */
+/* $OpenBSD: bus.h,v 1.22 2012/12/06 12:35:22 mpi Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom. All rights reserved.
@@ -76,6 +76,7 @@ int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart,
bus_space_handle_t *handlep);
void bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle,
bus_size_t size);
+paddr_t bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
#define BUS_SPACE_MAP_CACHEABLE 0x01
#define BUS_SPACE_MAP_LINEAR 0x02
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 0d29fc391ff..2d571cb8454 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.134 2012/12/02 07:03:31 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.135 2012/12/06 12:35:22 mpi Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -1109,6 +1109,23 @@ bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
}
}
+paddr_t
+bus_space_mmap(bus_space_tag_t t, bus_addr_t bpa, off_t off, int prot,
+ int flags)
+{
+ int pmapflags = PMAP_NOCACHE;
+
+ if (POWERPC_BUS_TAG_BASE(t) == 0)
+ return (-1);
+
+ bpa |= POWERPC_BUS_TAG_BASE(t);
+
+ if (flags & BUS_SPACE_MAP_CACHEABLE)
+ pmapflags &= ~PMAP_NOCACHE;
+
+ return ((bpa + off) | pmapflags);
+}
+
vaddr_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE;
int