Implement bus_space_mmap().

This commit is contained in:
thorpej 2001-09-04 02:37:08 +00:00
parent c6fda2584d
commit 47920741b0
2 changed files with 38 additions and 2 deletions

View File

@ -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.

View File

@ -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));