Implement bus_space_mmap().
This commit is contained in:
parent
4ce0b90ae3
commit
81bcece4d4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.h,v 1.3 2001/07/19 15:32:10 thorpej Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.4 2001/09/04 16:32:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -147,6 +147,9 @@ struct algor_bus_space {
|
|||
/* get kernel virtual address */
|
||||
void * (*bs_vaddr)(void *, bus_space_handle_t);
|
||||
|
||||
/* mmap for user */
|
||||
paddr_t (*bs_mmap)(void *, bus_addr_t, off_t, int, int);
|
||||
|
||||
/* barrier */
|
||||
void (*bs_barrier)(void *, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, int);
|
||||
|
@ -332,6 +335,12 @@ do { \
|
|||
#define bus_space_vaddr(t, h) \
|
||||
(*(t)->bs_vaddr)((t)->bs_cookie, (h))
|
||||
|
||||
/*
|
||||
* Mmap for user.
|
||||
*/
|
||||
#define bus_space_mmap(t, a, o, p, f) \
|
||||
(*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f))
|
||||
|
||||
/*
|
||||
* Bus barrier operations.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_alignstride_bus_io_chipdep.c,v 1.3 2001/06/14 18:52:27 thorpej Exp $ */
|
||||
/* $NetBSD: pci_alignstride_bus_io_chipdep.c,v 1.4 2001/09/04 16:32:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -110,6 +110,9 @@ void __C(CHIP,_io_free) __P((void *, bus_space_handle_t,
|
|||
/* get kernel virtual address */
|
||||
void * __C(CHIP,_io_vaddr) __P((void *, bus_space_handle_t));
|
||||
|
||||
/* mmap for user */
|
||||
paddr_t __C(CHIP,_io_mmap) __P((void *, bus_addr_t, off_t, int, int));
|
||||
|
||||
/* barrier */
|
||||
inline void __C(CHIP,_io_barrier) __P((void *, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, int));
|
||||
|
@ -248,6 +251,9 @@ __C(CHIP,_bus_io_init)(t, v)
|
|||
/* get kernel virtual address */
|
||||
t->bs_vaddr = __C(CHIP,_io_vaddr);
|
||||
|
||||
/* mmap for user */
|
||||
t->bs_mmap = __C(CHIP,_io_mmap);
|
||||
|
||||
/* barrier */
|
||||
t->bs_barrier = __C(CHIP,_io_barrier);
|
||||
|
||||
|
@ -646,6 +652,19 @@ __C(CHIP,_io_vaddr)(v, bsh)
|
|||
panic("_io_vaddr");
|
||||
}
|
||||
|
||||
paddr_t
|
||||
__C(CHIP,_io_mmap)(v, addr, off, prot, flags)
|
||||
void *v;
|
||||
bus_addr_t addr;
|
||||
off_t off;
|
||||
int prot;
|
||||
int flags;
|
||||
{
|
||||
|
||||
/* Not supported for I/O space. */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
inline void
|
||||
__C(CHIP,_io_barrier)(v, h, o, l, f)
|
||||
void *v;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_alignstride_bus_mem_chipdep.c,v 1.1 2001/05/28 16:22:21 thorpej Exp $ */
|
||||
/* $NetBSD: pci_alignstride_bus_mem_chipdep.c,v 1.2 2001/09/04 16:32:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -109,6 +109,9 @@ void __C(CHIP,_mem_free) __P((void *, bus_space_handle_t,
|
|||
/* get kernel virtual address */
|
||||
void * __C(CHIP,_mem_vaddr) __P((void *, bus_space_handle_t));
|
||||
|
||||
/* mmap for user */
|
||||
paddr_t __C(CHIP,_mem_mmap) __P((void *, bus_addr_t, off_t, int, int));
|
||||
|
||||
/* barrier */
|
||||
inline void __C(CHIP,_mem_barrier) __P((void *, bus_space_handle_t,
|
||||
bus_size_t, bus_size_t, int));
|
||||
|
@ -243,6 +246,9 @@ __C(CHIP,_bus_mem_init)(t, v)
|
|||
/* get kernel virtual address */
|
||||
t->bs_vaddr = __C(CHIP,_mem_vaddr);
|
||||
|
||||
/* mmap for user */
|
||||
t->bs_mmap = __C(CHIP,_mem_mmap);
|
||||
|
||||
/* barrier */
|
||||
t->bs_barrier = __C(CHIP,_mem_barrier);
|
||||
|
||||
|
@ -689,6 +695,29 @@ __C(CHIP,_mem_vaddr)(v, bsh)
|
|||
#endif
|
||||
}
|
||||
|
||||
paddr_t
|
||||
__C(CHIP,_mem_mmap)(v, addr, off, prot, flags)
|
||||
void *v;
|
||||
bus_addr_t addr;
|
||||
off_t off;
|
||||
int prot;
|
||||
int flags;
|
||||
{
|
||||
struct mips_bus_space_translation mbst;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Get the translation for this address.
|
||||
*/
|
||||
error = __C(CHIP,_mem_translate)(v, addr, off + PAGE_SIZE, flags,
|
||||
&mbst);
|
||||
if (error)
|
||||
return (-1);
|
||||
|
||||
return (mips_btop(mbst.mbst_sys_start +
|
||||
(memaddr - mbst.mbst_bus_start) + off));
|
||||
}
|
||||
|
||||
inline void
|
||||
__C(CHIP,_mem_barrier)(v, h, o, l, f)
|
||||
void *v;
|
||||
|
|
Loading…
Reference in New Issue