Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386 Implement bus_space_mmap().
details: https://anonhg.NetBSD.org/src/rev/6d68075047d5
branches: trunk
changeset: 514488:6d68075047d5
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Sep 04 02:37:08 2001 +0000
description:
Implement bus_space_mmap().
diffstat:
sys/arch/i386/i386/bus_machdep.c | 25 ++++++++++++++++++++++++-
sys/arch/i386/include/bus.h | 15 ++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diffs (68 lines):
diff -r 7617b15b3f3e -r 6d68075047d5 sys/arch/i386/i386/bus_machdep.c
--- a/sys/arch/i386/i386/bus_machdep.c Tue Sep 04 02:10:52 2001 +0000
+++ b/sys/arch/i386/i386/bus_machdep.c Tue Sep 04 02:37:08 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_machdep.c,v 1.9 2001/05/26 21:27:07 chs Exp $ */
+/* $NetBSD: bus_machdep.c,v 1.10 2001/09/04 02:37:08 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -457,6 +457,29 @@
return (0);
}
+paddr_t
+i386_memio_mmap(t, addr, off, prot, flags)
+ bus_space_tag_t t;
+ bus_addr_t addr;
+ off_t off;
+ int prot;
+ int flags;
+{
+
+ /* Can't mmap I/O space. */
+ if (t == I386_BUS_SPACE_IO)
+ return (EOPNOTSUPP);
+
+ /*
+ * "addr" is the base address of the device we're mapping.
+ * "off" is the offset into that device.
+ *
+ * Note we are called for each "page" in the device that
+ * the upper layers want to map.
+ */
+ return (i386_btop(addr + off));
+}
+
/*
* Common function for DMA map creation. May be called by bus-specific
* DMA map creation functions.
diff -r 7617b15b3f3e -r 6d68075047d5 sys/arch/i386/include/bus.h
--- a/sys/arch/i386/include/bus.h Tue Sep 04 02:10:52 2001 +0000
+++ b/sys/arch/i386/include/bus.h Tue Sep 04 02:37:08 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.35 2001/07/19 15:32:14 thorpej Exp $ */
+/* $NetBSD: bus.h,v 1.36 2001/09/04 02:37:09 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -209,6 +209,19 @@
((t) == I386_BUS_SPACE_MEM ? (void *)(h) : (void *)0)
/*
+ * paddr_t bus_space_mmap __P((bus_space_tag_t t, bus_addr_t base,
+ * off_t offset, int prot, int flags));
+ *
+ * Mmap an area of bus space.
+ */
+
+paddr_t i386_memio_mmap __P((bus_space_tag_t, bus_addr_t, off_t,
+ int, int));
+
+#define bus_space_mmap(t, b, o, p, f) \
+ i386_memio_mmap((t), (b), (o), (p), (f))
+
+/*
* u_intN_t bus_space_read_N __P((bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset));
*
Home |
Main Index |
Thread Index |
Old Index