diff --git a/sys/arch/i386/i386/bus_machdep.c b/sys/arch/i386/i386/bus_machdep.c index edca27c76536..38ccd76f1ade 100644 --- a/sys/arch/i386/i386/bus_machdep.c +++ b/sys/arch/i386/i386/bus_machdep.c @@ -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 @@ i386_memio_subregion(t, bsh, offset, size, nbshp) 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 --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index cdecab029cd2..0e58048391b6 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -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. @@ -208,6 +208,19 @@ void i386_memio_free __P((bus_space_tag_t t, bus_space_handle_t bsh, #define bus_space_vaddr(t, h) \ ((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));