Home | History | Annotate | Line # | Download | only in include
bus.h revision 1.2.2.3
      1  1.2.2.3  bouyer /*	$NetBSD: bus.h,v 1.2.2.3 2001/03/12 13:29:10 bouyer Exp $	*/
      2  1.2.2.2  bouyer 
      3  1.2.2.2  bouyer /*
      4  1.2.2.3  bouyer  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
      5  1.2.2.2  bouyer  * All rights reserved.
      6  1.2.2.2  bouyer  *
      7  1.2.2.2  bouyer  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2.2.2  bouyer  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.2.2.2  bouyer  * NASA Ames Research Center.
     10  1.2.2.2  bouyer  *
     11  1.2.2.2  bouyer  * Redistribution and use in source and binary forms, with or without
     12  1.2.2.2  bouyer  * modification, are permitted provided that the following conditions
     13  1.2.2.2  bouyer  * are met:
     14  1.2.2.2  bouyer  * 1. Redistributions of source code must retain the above copyright
     15  1.2.2.2  bouyer  *    notice, this list of conditions and the following disclaimer.
     16  1.2.2.2  bouyer  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.2.2.2  bouyer  *    notice, this list of conditions and the following disclaimer in the
     18  1.2.2.2  bouyer  *    documentation and/or other materials provided with the distribution.
     19  1.2.2.2  bouyer  * 3. All advertising materials mentioning features or use of this software
     20  1.2.2.2  bouyer  *    must display the following acknowledgement:
     21  1.2.2.2  bouyer  *	This product includes software developed by the NetBSD
     22  1.2.2.2  bouyer  *	Foundation, Inc. and its contributors.
     23  1.2.2.2  bouyer  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.2.2.2  bouyer  *    contributors may be used to endorse or promote products derived
     25  1.2.2.2  bouyer  *    from this software without specific prior written permission.
     26  1.2.2.2  bouyer  *
     27  1.2.2.2  bouyer  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.2.2.2  bouyer  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.2.2.2  bouyer  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.2.2.2  bouyer  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.2.2.2  bouyer  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.2.2.2  bouyer  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.2.2.2  bouyer  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.2.2.2  bouyer  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.2.2.2  bouyer  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.2.2.2  bouyer  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.2.2.2  bouyer  * POSSIBILITY OF SUCH DAMAGE.
     38  1.2.2.2  bouyer  */
     39  1.2.2.2  bouyer 
     40  1.2.2.2  bouyer #ifndef _NEWSMIPS_BUS_H_
     41  1.2.2.2  bouyer #define _NEWSMIPS_BUS_H_
     42  1.2.2.2  bouyer 
     43  1.2.2.2  bouyer #include <mips/locore.h>
     44  1.2.2.2  bouyer 
     45  1.2.2.2  bouyer /*
     46  1.2.2.2  bouyer  * Utility macros; do not use outside this file.
     47  1.2.2.2  bouyer  */
     48  1.2.2.2  bouyer #define	__PB_TYPENAME_PREFIX(BITS)	___CONCAT(u_int,BITS)
     49  1.2.2.2  bouyer #define	__PB_TYPENAME(BITS)		___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
     50  1.2.2.2  bouyer 
     51  1.2.2.2  bouyer /*
     52  1.2.2.2  bouyer  * Bus address and size types
     53  1.2.2.2  bouyer  */
     54  1.2.2.2  bouyer typedef u_long bus_addr_t;
     55  1.2.2.2  bouyer typedef u_long bus_size_t;
     56  1.2.2.2  bouyer 
     57  1.2.2.2  bouyer /*
     58  1.2.2.2  bouyer  * Access methods for bus resources and address space.
     59  1.2.2.2  bouyer  */
     60  1.2.2.2  bouyer typedef int	bus_space_tag_t;
     61  1.2.2.2  bouyer typedef u_long	bus_space_handle_t;
     62  1.2.2.2  bouyer 
     63  1.2.2.2  bouyer /*
     64  1.2.2.2  bouyer  *	int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
     65  1.2.2.2  bouyer  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
     66  1.2.2.2  bouyer  *
     67  1.2.2.2  bouyer  * Map a region of bus space.
     68  1.2.2.2  bouyer  */
     69  1.2.2.2  bouyer 
     70  1.2.2.2  bouyer #define	BUS_SPACE_MAP_CACHEABLE		0x01
     71  1.2.2.2  bouyer #define	BUS_SPACE_MAP_LINEAR		0x02
     72  1.2.2.2  bouyer #define BUS_SPACE_MAP_PREFETCHABLE	0x04
     73  1.2.2.2  bouyer 
     74  1.2.2.2  bouyer int	bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t,
     75  1.2.2.2  bouyer 	    int, bus_space_handle_t *);
     76  1.2.2.2  bouyer 
     77  1.2.2.2  bouyer /*
     78  1.2.2.2  bouyer  *	void bus_space_unmap(bus_space_tag_t t,
     79  1.2.2.2  bouyer  *	     bus_space_handle_t bsh, bus_size_t size);
     80  1.2.2.2  bouyer  *
     81  1.2.2.2  bouyer  * Unmap a region of bus space.
     82  1.2.2.2  bouyer  */
     83  1.2.2.2  bouyer 
     84  1.2.2.2  bouyer void	bus_space_unmap (bus_space_tag_t, bus_space_handle_t, bus_size_t);
     85  1.2.2.2  bouyer 
     86  1.2.2.2  bouyer /*
     87  1.2.2.2  bouyer  *	int bus_space_subregion(bus_space_tag_t t,
     88  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
     89  1.2.2.2  bouyer  *	    bus_space_handle_t *nbshp);
     90  1.2.2.2  bouyer  *
     91  1.2.2.2  bouyer  * Get a new handle for a subregion of an already-mapped area of bus space.
     92  1.2.2.2  bouyer  */
     93  1.2.2.2  bouyer 
     94  1.2.2.2  bouyer int	bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
     95  1.2.2.2  bouyer 	    bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp);
     96  1.2.2.2  bouyer 
     97  1.2.2.2  bouyer /*
     98  1.2.2.2  bouyer  *	int bus_space_alloc(bus_space_tag_t t, bus_addr_t, rstart,
     99  1.2.2.2  bouyer  *	    bus_addr_t rend, bus_size_t size, bus_size_t align,
    100  1.2.2.2  bouyer  *	    bus_size_t boundary, int flags, bus_addr_t *addrp,
    101  1.2.2.2  bouyer  *	    bus_space_handle_t *bshp);
    102  1.2.2.2  bouyer  *
    103  1.2.2.2  bouyer  * Allocate a region of bus space.
    104  1.2.2.2  bouyer  */
    105  1.2.2.2  bouyer 
    106  1.2.2.2  bouyer int	bus_space_alloc (bus_space_tag_t t, bus_addr_t rstart,
    107  1.2.2.2  bouyer 	    bus_addr_t rend, bus_size_t size, bus_size_t align,
    108  1.2.2.2  bouyer 	    bus_size_t boundary, int cacheable, bus_addr_t *addrp,
    109  1.2.2.2  bouyer 	    bus_space_handle_t *bshp);
    110  1.2.2.2  bouyer 
    111  1.2.2.2  bouyer /*
    112  1.2.2.2  bouyer  *	int bus_space_free (bus_space_tag_t t,
    113  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t size);
    114  1.2.2.2  bouyer  *
    115  1.2.2.2  bouyer  * Free a region of bus space.
    116  1.2.2.2  bouyer  */
    117  1.2.2.2  bouyer 
    118  1.2.2.2  bouyer void	bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
    119  1.2.2.2  bouyer 	    bus_size_t size);
    120  1.2.2.2  bouyer 
    121  1.2.2.2  bouyer /*
    122  1.2.2.2  bouyer  *	u_intN_t bus_space_read_N(bus_space_tag_t tag,
    123  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset);
    124  1.2.2.2  bouyer  *
    125  1.2.2.2  bouyer  * Read a 1, 2, 4, or 8 byte quantity from bus space
    126  1.2.2.2  bouyer  * described by tag/handle/offset.
    127  1.2.2.2  bouyer  */
    128  1.2.2.2  bouyer 
    129  1.2.2.2  bouyer #define	bus_space_read_1(t, h, o)					\
    130  1.2.2.2  bouyer      ((void) t, (*(volatile u_int8_t *)((h) + (o))))
    131  1.2.2.2  bouyer 
    132  1.2.2.2  bouyer #define	bus_space_read_2(t, h, o)					\
    133  1.2.2.2  bouyer      ((void) t, (*(volatile u_int16_t *)((h) + (o))))
    134  1.2.2.2  bouyer 
    135  1.2.2.2  bouyer #define	bus_space_read_4(t, h, o)					\
    136  1.2.2.2  bouyer      ((void) t, (*(volatile u_int32_t *)((h) + (o))))
    137  1.2.2.2  bouyer 
    138  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_read_8 */
    139  1.2.2.2  bouyer #define	bus_space_read_8(t, h, o)	!!! bus_space_read_8 unimplemented !!!
    140  1.2.2.2  bouyer #endif
    141  1.2.2.2  bouyer 
    142  1.2.2.2  bouyer /*
    143  1.2.2.2  bouyer  *	void bus_space_read_multi_N(bus_space_tag_t tag,
    144  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    145  1.2.2.2  bouyer  *	    u_intN_t *addr, size_t count);
    146  1.2.2.2  bouyer  *
    147  1.2.2.2  bouyer  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
    148  1.2.2.2  bouyer  * described by tag/handle/offset and copy into buffer provided.
    149  1.2.2.2  bouyer  */
    150  1.2.2.2  bouyer 
    151  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_read_multi(BYTES,BITS)			\
    152  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_read_multi_,BYTES)		\
    153  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    154  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) *, size_t);					\
    155  1.2.2.2  bouyer 									\
    156  1.2.2.2  bouyer static __inline void							\
    157  1.2.2.2  bouyer __CONCAT(bus_space_read_multi_,BYTES)(t, h, o, a, c)			\
    158  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    159  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    160  1.2.2.2  bouyer 	bus_size_t o;							\
    161  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) *a;						\
    162  1.2.2.2  bouyer 	size_t c;							\
    163  1.2.2.2  bouyer {									\
    164  1.2.2.2  bouyer 									\
    165  1.2.2.2  bouyer 	while (c--)							\
    166  1.2.2.2  bouyer 		*a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);	\
    167  1.2.2.2  bouyer }
    168  1.2.2.2  bouyer 
    169  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_multi(1,8)
    170  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_multi(2,16)
    171  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_multi(4,32)
    172  1.2.2.2  bouyer 
    173  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_read_multi_8 */
    174  1.2.2.2  bouyer #define	bus_space_read_multi_8	!!! bus_space_read_multi_8 unimplemented !!!
    175  1.2.2.2  bouyer #endif
    176  1.2.2.2  bouyer 
    177  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_read_multi
    178  1.2.2.2  bouyer 
    179  1.2.2.2  bouyer /*
    180  1.2.2.2  bouyer  *	void bus_space_read_region_N(bus_space_tag_t tag,
    181  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    182  1.2.2.2  bouyer  *	    u_intN_t *addr, size_t count);
    183  1.2.2.2  bouyer  *
    184  1.2.2.2  bouyer  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
    185  1.2.2.2  bouyer  * described by tag/handle and starting at `offset' and copy into
    186  1.2.2.2  bouyer  * buffer provided.
    187  1.2.2.2  bouyer  */
    188  1.2.2.2  bouyer 
    189  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_read_region(BYTES,BITS)			\
    190  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_read_region_,BYTES)		\
    191  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    192  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) *, size_t);					\
    193  1.2.2.2  bouyer 									\
    194  1.2.2.2  bouyer static __inline void							\
    195  1.2.2.2  bouyer __CONCAT(bus_space_read_region_,BYTES)(t, h, o, a, c)			\
    196  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    197  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    198  1.2.2.2  bouyer 	bus_size_t o;							\
    199  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) *a;						\
    200  1.2.2.2  bouyer 	size_t c;							\
    201  1.2.2.2  bouyer {									\
    202  1.2.2.2  bouyer 									\
    203  1.2.2.2  bouyer 	while (c--) {							\
    204  1.2.2.2  bouyer 		*a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);	\
    205  1.2.2.2  bouyer 		o += BYTES;						\
    206  1.2.2.2  bouyer 	}								\
    207  1.2.2.2  bouyer }
    208  1.2.2.2  bouyer 
    209  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_region(1,8)
    210  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_region(2,16)
    211  1.2.2.2  bouyer __NEWSMIPS_bus_space_read_region(4,32)
    212  1.2.2.2  bouyer 
    213  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_read_region_8 */
    214  1.2.2.2  bouyer #define	bus_space_read_region_8	!!! bus_space_read_region_8 unimplemented !!!
    215  1.2.2.2  bouyer #endif
    216  1.2.2.2  bouyer 
    217  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_read_region
    218  1.2.2.2  bouyer 
    219  1.2.2.2  bouyer /*
    220  1.2.2.2  bouyer  *	void bus_space_write_N(bus_space_tag_t tag,
    221  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    222  1.2.2.2  bouyer  *	    u_intN_t value);
    223  1.2.2.2  bouyer  *
    224  1.2.2.2  bouyer  * Write the 1, 2, 4, or 8 byte value `value' to bus space
    225  1.2.2.2  bouyer  * described by tag/handle/offset.
    226  1.2.2.2  bouyer  */
    227  1.2.2.2  bouyer 
    228  1.2.2.2  bouyer #define	bus_space_write_1(t, h, o, v)					\
    229  1.2.2.2  bouyer do {									\
    230  1.2.2.2  bouyer 	(void) t;							\
    231  1.2.2.2  bouyer 	*(volatile u_int8_t *)((h) + (o)) = (v);			\
    232  1.2.2.2  bouyer } while (0)
    233  1.2.2.2  bouyer 
    234  1.2.2.2  bouyer #define	bus_space_write_2(t, h, o, v)					\
    235  1.2.2.2  bouyer do {									\
    236  1.2.2.2  bouyer 	(void) t;							\
    237  1.2.2.2  bouyer 	*(volatile u_int16_t *)((h) + (o)) = (v);			\
    238  1.2.2.2  bouyer } while (0)
    239  1.2.2.2  bouyer 
    240  1.2.2.2  bouyer #define	bus_space_write_4(t, h, o, v)					\
    241  1.2.2.2  bouyer do {									\
    242  1.2.2.2  bouyer 	(void) t;							\
    243  1.2.2.2  bouyer 	*(volatile u_int32_t *)((h) + (o)) = (v);			\
    244  1.2.2.2  bouyer } while (0)
    245  1.2.2.2  bouyer 
    246  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_write_8 */
    247  1.2.2.2  bouyer #define	bus_space_write_8	!!! bus_space_write_8 not implemented !!!
    248  1.2.2.2  bouyer #endif
    249  1.2.2.2  bouyer 
    250  1.2.2.2  bouyer /*
    251  1.2.2.2  bouyer  *	void bus_space_write_multi_N(bus_space_tag_t tag,
    252  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    253  1.2.2.2  bouyer  *	    const u_intN_t *addr, size_t count);
    254  1.2.2.2  bouyer  *
    255  1.2.2.2  bouyer  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
    256  1.2.2.2  bouyer  * provided to bus space described by tag/handle/offset.
    257  1.2.2.2  bouyer  */
    258  1.2.2.2  bouyer 
    259  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_write_multi(BYTES,BITS)			\
    260  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_write_multi_,BYTES)		\
    261  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    262  1.2.2.2  bouyer 	const __PB_TYPENAME(BITS) *, size_t);				\
    263  1.2.2.2  bouyer 									\
    264  1.2.2.2  bouyer static __inline void							\
    265  1.2.2.2  bouyer __CONCAT(bus_space_write_multi_,BYTES)(t, h, o, a, c)			\
    266  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    267  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    268  1.2.2.2  bouyer 	bus_size_t o;							\
    269  1.2.2.2  bouyer 	const __PB_TYPENAME(BITS) *a;					\
    270  1.2.2.2  bouyer 	size_t c;							\
    271  1.2.2.2  bouyer {									\
    272  1.2.2.2  bouyer 									\
    273  1.2.2.2  bouyer 	while (c--)							\
    274  1.2.2.2  bouyer 		__CONCAT(bus_space_write_,BYTES)(t, h, o, *a++);	\
    275  1.2.2.2  bouyer }
    276  1.2.2.2  bouyer 
    277  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_multi(1,8)
    278  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_multi(2,16)
    279  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_multi(4,32)
    280  1.2.2.2  bouyer 
    281  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_write_8 */
    282  1.2.2.2  bouyer #define	bus_space_write_multi_8(t, h, o, a, c)				\
    283  1.2.2.2  bouyer 			!!! bus_space_write_multi_8 unimplimented !!!
    284  1.2.2.2  bouyer #endif
    285  1.2.2.2  bouyer 
    286  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_write_multi
    287  1.2.2.2  bouyer 
    288  1.2.2.2  bouyer /*
    289  1.2.2.2  bouyer  *	void bus_space_write_region_N(bus_space_tag_t tag,
    290  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    291  1.2.2.2  bouyer  *	    const u_intN_t *addr, size_t count);
    292  1.2.2.2  bouyer  *
    293  1.2.2.2  bouyer  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
    294  1.2.2.2  bouyer  * to bus space described by tag/handle starting at `offset'.
    295  1.2.2.2  bouyer  */
    296  1.2.2.2  bouyer 
    297  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_write_region(BYTES,BITS)			\
    298  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_write_region_,BYTES)		\
    299  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    300  1.2.2.2  bouyer 	const __PB_TYPENAME(BITS) *, size_t);				\
    301  1.2.2.2  bouyer 									\
    302  1.2.2.2  bouyer static __inline void							\
    303  1.2.2.2  bouyer __CONCAT(bus_space_write_region_,BYTES)(t, h, o, a, c)			\
    304  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    305  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    306  1.2.2.2  bouyer 	bus_size_t o;							\
    307  1.2.2.2  bouyer 	const __PB_TYPENAME(BITS) *a;					\
    308  1.2.2.2  bouyer 	size_t c;							\
    309  1.2.2.2  bouyer {									\
    310  1.2.2.2  bouyer 									\
    311  1.2.2.2  bouyer 	while (c--) {							\
    312  1.2.2.2  bouyer 		__CONCAT(bus_space_write_,BYTES)(t, h, o, *a++);	\
    313  1.2.2.2  bouyer 		o += BYTES;						\
    314  1.2.2.2  bouyer 	}								\
    315  1.2.2.2  bouyer }
    316  1.2.2.2  bouyer 
    317  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_region(1,8)
    318  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_region(2,16)
    319  1.2.2.2  bouyer __NEWSMIPS_bus_space_write_region(4,32)
    320  1.2.2.2  bouyer 
    321  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_write_region_8 */
    322  1.2.2.2  bouyer #define	bus_space_write_region_8					\
    323  1.2.2.2  bouyer 			!!! bus_space_write_region_8 unimplemented !!!
    324  1.2.2.2  bouyer #endif
    325  1.2.2.2  bouyer 
    326  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_write_region
    327  1.2.2.2  bouyer 
    328  1.2.2.2  bouyer /*
    329  1.2.2.2  bouyer  *	void bus_space_set_multi_N(bus_space_tag_t tag,
    330  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
    331  1.2.2.2  bouyer  *	    size_t count);
    332  1.2.2.2  bouyer  *
    333  1.2.2.2  bouyer  * Write the 1, 2, 4, or 8 byte value `val' to bus space described
    334  1.2.2.2  bouyer  * by tag/handle/offset `count' times.
    335  1.2.2.2  bouyer  */
    336  1.2.2.2  bouyer 
    337  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_set_multi(BYTES,BITS)			\
    338  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_set_multi_,BYTES)		\
    339  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    340  1.2.2.2  bouyer 	__PB_TYPENAME(BITS), size_t);					\
    341  1.2.2.2  bouyer 									\
    342  1.2.2.2  bouyer static __inline void							\
    343  1.2.2.2  bouyer __CONCAT(bus_space_set_multi_,BYTES)(t, h, o, v, c)			\
    344  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    345  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    346  1.2.2.2  bouyer 	bus_size_t o;							\
    347  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) v;						\
    348  1.2.2.2  bouyer 	size_t c;							\
    349  1.2.2.2  bouyer {									\
    350  1.2.2.2  bouyer 									\
    351  1.2.2.2  bouyer 	while (c--)							\
    352  1.2.2.2  bouyer 		__CONCAT(bus_space_write_,BYTES)(t, h, o, v);		\
    353  1.2.2.2  bouyer }
    354  1.2.2.2  bouyer 
    355  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_multi(1,8)
    356  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_multi(2,16)
    357  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_multi(4,32)
    358  1.2.2.2  bouyer 
    359  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_set_multi_8 */
    360  1.2.2.2  bouyer #define	bus_space_set_multi_8						\
    361  1.2.2.2  bouyer 			!!! bus_space_set_multi_8 unimplemented !!!
    362  1.2.2.2  bouyer #endif
    363  1.2.2.2  bouyer 
    364  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_set_multi
    365  1.2.2.2  bouyer 
    366  1.2.2.2  bouyer /*
    367  1.2.2.2  bouyer  *	void bus_space_set_region_N(bus_space_tag_t tag,
    368  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
    369  1.2.2.2  bouyer  *	    size_t count);
    370  1.2.2.2  bouyer  *
    371  1.2.2.2  bouyer  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
    372  1.2.2.2  bouyer  * by tag/handle starting at `offset'.
    373  1.2.2.2  bouyer  */
    374  1.2.2.2  bouyer 
    375  1.2.2.2  bouyer #define __NEWSMIPS_bus_space_set_region(BYTES,BITS)			\
    376  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_set_region_,BYTES)		\
    377  1.2.2.2  bouyer 	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
    378  1.2.2.2  bouyer 	__PB_TYPENAME(BITS), size_t);					\
    379  1.2.2.2  bouyer 									\
    380  1.2.2.2  bouyer static __inline void							\
    381  1.2.2.2  bouyer __CONCAT(bus_space_set_region_,BYTES)(t, h, o, v, c)			\
    382  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    383  1.2.2.2  bouyer 	bus_space_handle_t h;						\
    384  1.2.2.2  bouyer 	bus_size_t o;							\
    385  1.2.2.2  bouyer 	__PB_TYPENAME(BITS) v;						\
    386  1.2.2.2  bouyer 	size_t c;							\
    387  1.2.2.2  bouyer {									\
    388  1.2.2.2  bouyer 									\
    389  1.2.2.2  bouyer 	while (c--) {							\
    390  1.2.2.2  bouyer 		__CONCAT(bus_space_write_,BYTES)(t, h, o, v);		\
    391  1.2.2.2  bouyer 		o += BYTES;						\
    392  1.2.2.2  bouyer 	}								\
    393  1.2.2.2  bouyer }
    394  1.2.2.2  bouyer 
    395  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_region(1,8)
    396  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_region(2,16)
    397  1.2.2.2  bouyer __NEWSMIPS_bus_space_set_region(4,32)
    398  1.2.2.2  bouyer 
    399  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_set_region_8 */
    400  1.2.2.2  bouyer #define	bus_space_set_region_8						\
    401  1.2.2.2  bouyer 			!!! bus_space_set_region_8 unimplemented !!!
    402  1.2.2.2  bouyer #endif
    403  1.2.2.2  bouyer 
    404  1.2.2.2  bouyer #undef __NEWSMIPS_bus_space_set_region
    405  1.2.2.2  bouyer 
    406  1.2.2.2  bouyer /*
    407  1.2.2.2  bouyer  *	void bus_space_copy_region_N(bus_space_tag_t tag,
    408  1.2.2.2  bouyer  *	    bus_space_handle_t bsh1, bus_size_t off1,
    409  1.2.2.2  bouyer  *	    bus_space_handle_t bsh2, bus_size_t off2,
    410  1.2.2.2  bouyer  *	    bus_size_t count);
    411  1.2.2.2  bouyer  *
    412  1.2.2.2  bouyer  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
    413  1.2.2.2  bouyer  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
    414  1.2.2.2  bouyer  */
    415  1.2.2.2  bouyer 
    416  1.2.2.2  bouyer #define	__NEWSMIPS_copy_region(BYTES)					\
    417  1.2.2.2  bouyer static __inline void __CONCAT(bus_space_copy_region_,BYTES)		\
    418  1.2.2.2  bouyer 	(bus_space_tag_t,						\
    419  1.2.2.2  bouyer 	    bus_space_handle_t bsh1, bus_size_t off1,			\
    420  1.2.2.2  bouyer 	    bus_space_handle_t bsh2, bus_size_t off2,			\
    421  1.2.2.2  bouyer 	    bus_size_t count);						\
    422  1.2.2.2  bouyer 									\
    423  1.2.2.2  bouyer static __inline void							\
    424  1.2.2.2  bouyer __CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c)		\
    425  1.2.2.2  bouyer 	bus_space_tag_t t;						\
    426  1.2.2.2  bouyer 	bus_space_handle_t h1, h2;					\
    427  1.2.2.2  bouyer 	bus_size_t o1, o2, c;						\
    428  1.2.2.2  bouyer {									\
    429  1.2.2.2  bouyer 	bus_size_t o;							\
    430  1.2.2.2  bouyer 									\
    431  1.2.2.2  bouyer 	if ((h1 + o1) >= (h2 + o2)) {					\
    432  1.2.2.2  bouyer 		/* src after dest: copy forward */			\
    433  1.2.2.2  bouyer 		for (o = 0; c != 0; c--, o += BYTES)			\
    434  1.2.2.2  bouyer 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
    435  1.2.2.2  bouyer 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
    436  1.2.2.2  bouyer 	} else {							\
    437  1.2.2.2  bouyer 		/* dest after src: copy backwards */			\
    438  1.2.2.2  bouyer 		for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES)	\
    439  1.2.2.2  bouyer 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
    440  1.2.2.2  bouyer 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
    441  1.2.2.2  bouyer 	}								\
    442  1.2.2.2  bouyer }
    443  1.2.2.2  bouyer 
    444  1.2.2.2  bouyer __NEWSMIPS_copy_region(1)
    445  1.2.2.2  bouyer __NEWSMIPS_copy_region(2)
    446  1.2.2.2  bouyer __NEWSMIPS_copy_region(4)
    447  1.2.2.2  bouyer 
    448  1.2.2.2  bouyer #if 0	/* Cause a link error for bus_space_copy_region_8 */
    449  1.2.2.2  bouyer #define	bus_space_copy_region_8						\
    450  1.2.2.2  bouyer 			!!! bus_space_copy_region_8 unimplemented !!!
    451  1.2.2.2  bouyer #endif
    452  1.2.2.2  bouyer 
    453  1.2.2.2  bouyer #undef __NEWSMIPS_copy_region
    454  1.2.2.2  bouyer 
    455  1.2.2.2  bouyer /*
    456  1.2.2.2  bouyer  * Bus read/write barrier methods.
    457  1.2.2.2  bouyer  *
    458  1.2.2.2  bouyer  *	void bus_space_barrier(bus_space_tag_t tag,
    459  1.2.2.2  bouyer  *	    bus_space_handle_t bsh, bus_size_t offset,
    460  1.2.2.2  bouyer  *	    bus_size_t len, int flags);
    461  1.2.2.2  bouyer  *
    462  1.2.2.2  bouyer  * On the MIPS, we just flush the write buffer.
    463  1.2.2.2  bouyer  */
    464  1.2.2.2  bouyer #define	bus_space_barrier(t, h, o, l, f)	\
    465  1.2.2.2  bouyer 	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)),	\
    466  1.2.2.2  bouyer 	 wbflush())
    467  1.2.2.2  bouyer #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */
    468  1.2.2.2  bouyer #define	BUS_SPACE_BARRIER_WRITE	0x02		/* force write barrier */
    469  1.2.2.2  bouyer 
    470  1.2.2.2  bouyer #undef __PB_TYPENAME_PREFIX
    471  1.2.2.2  bouyer #undef __PB_TYPENAME
    472  1.2.2.2  bouyer 
    473  1.2.2.2  bouyer #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
    474  1.2.2.2  bouyer 
    475  1.2.2.2  bouyer /*
    476  1.2.2.2  bouyer  * Flags used in various bus DMA methods.
    477  1.2.2.2  bouyer  */
    478  1.2.2.2  bouyer #define	BUS_DMA_WAITOK		0x00	/* safe to sleep (pseudo-flag) */
    479  1.2.2.2  bouyer #define	BUS_DMA_NOWAIT		0x01	/* not safe to sleep */
    480  1.2.2.2  bouyer #define	BUS_DMA_ALLOCNOW	0x02	/* perform resource allocation now */
    481  1.2.2.2  bouyer #define	BUS_DMA_COHERENT	0x04	/* hint: map memory DMA coherent */
    482  1.2.2.3  bouyer #define	BUS_DMA_STREAMING	0x08	/* hint: sequential, unidirectional */
    483  1.2.2.2  bouyer #define	BUS_DMA_BUS1		0x10	/* placeholders for bus functions... */
    484  1.2.2.2  bouyer #define	BUS_DMA_BUS2		0x20
    485  1.2.2.2  bouyer #define	BUS_DMA_BUS3		0x40
    486  1.2.2.2  bouyer #define	BUS_DMA_BUS4		0x80
    487  1.2.2.2  bouyer 
    488  1.2.2.2  bouyer #define	NEWSMIPS_DMAMAP_COHERENT 0x100	/* no cache flush necessary on sync */
    489  1.2.2.2  bouyer #define	NEWSMIPS_DMAMAP_MAPTBL	0x200	/* use DMA maping table */
    490  1.2.2.2  bouyer 
    491  1.2.2.2  bouyer /* Forwards needed by prototypes below. */
    492  1.2.2.2  bouyer struct mbuf;
    493  1.2.2.2  bouyer struct uio;
    494  1.2.2.2  bouyer 
    495  1.2.2.2  bouyer /*
    496  1.2.2.2  bouyer  * Operations performed by bus_dmamap_sync().
    497  1.2.2.2  bouyer  */
    498  1.2.2.2  bouyer #define	BUS_DMASYNC_PREREAD	0x01	/* pre-read synchronization */
    499  1.2.2.2  bouyer #define	BUS_DMASYNC_POSTREAD	0x02	/* post-read synchronization */
    500  1.2.2.2  bouyer #define	BUS_DMASYNC_PREWRITE	0x04	/* pre-write synchronization */
    501  1.2.2.2  bouyer #define	BUS_DMASYNC_POSTWRITE	0x08	/* post-write synchronization */
    502  1.2.2.2  bouyer 
    503  1.2.2.2  bouyer typedef struct newsmips_bus_dma_tag		*bus_dma_tag_t;
    504  1.2.2.2  bouyer typedef struct newsmips_bus_dmamap		*bus_dmamap_t;
    505  1.2.2.2  bouyer 
    506  1.2.2.2  bouyer /*
    507  1.2.2.2  bouyer  *	bus_dma_segment_t
    508  1.2.2.2  bouyer  *
    509  1.2.2.2  bouyer  *	Describes a single contiguous DMA transaction.  Values
    510  1.2.2.2  bouyer  *	are suitable for programming into DMA registers.
    511  1.2.2.2  bouyer  */
    512  1.2.2.2  bouyer struct newsmips_bus_dma_segment {
    513  1.2.2.2  bouyer 	bus_addr_t	ds_addr;	/* DMA address */
    514  1.2.2.2  bouyer 	bus_size_t	ds_len;		/* length of transfer */
    515  1.2.2.2  bouyer 	bus_addr_t	_ds_vaddr;	/* virtual address, 0 if invalid */
    516  1.2.2.2  bouyer };
    517  1.2.2.2  bouyer typedef struct newsmips_bus_dma_segment	bus_dma_segment_t;
    518  1.2.2.2  bouyer 
    519  1.2.2.2  bouyer /*
    520  1.2.2.2  bouyer  *	bus_dma_tag_t
    521  1.2.2.2  bouyer  *
    522  1.2.2.2  bouyer  *	A machine-dependent opaque type describing the implementation of
    523  1.2.2.2  bouyer  *	DMA for a given bus.
    524  1.2.2.2  bouyer  */
    525  1.2.2.2  bouyer 
    526  1.2.2.2  bouyer struct newsmips_bus_dma_tag {
    527  1.2.2.2  bouyer 	/*
    528  1.2.2.2  bouyer 	 * DMA mapping methods.
    529  1.2.2.2  bouyer 	 */
    530  1.2.2.2  bouyer 	int	(*_dmamap_create)(bus_dma_tag_t, bus_size_t, int,
    531  1.2.2.2  bouyer 		    bus_size_t, bus_size_t, int, bus_dmamap_t *);
    532  1.2.2.2  bouyer 	void	(*_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
    533  1.2.2.2  bouyer 	int	(*_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
    534  1.2.2.2  bouyer 		    bus_size_t, struct proc *, int);
    535  1.2.2.2  bouyer 	int	(*_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
    536  1.2.2.2  bouyer 		    struct mbuf *, int);
    537  1.2.2.2  bouyer 	int	(*_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t,
    538  1.2.2.2  bouyer 		    struct uio *, int);
    539  1.2.2.2  bouyer 	int	(*_dmamap_load_raw)(bus_dma_tag_t, bus_dmamap_t,
    540  1.2.2.2  bouyer 		    bus_dma_segment_t *, int, bus_size_t, int);
    541  1.2.2.2  bouyer 	void	(*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
    542  1.2.2.2  bouyer 	void	(*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
    543  1.2.2.2  bouyer 		    bus_addr_t, bus_size_t, int);
    544  1.2.2.2  bouyer 
    545  1.2.2.2  bouyer 	/*
    546  1.2.2.2  bouyer 	 * DMA memory utility functions.
    547  1.2.2.2  bouyer 	 */
    548  1.2.2.2  bouyer 	int	(*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
    549  1.2.2.2  bouyer 		    bus_size_t, bus_dma_segment_t *, int, int *, int);
    550  1.2.2.2  bouyer 	void	(*_dmamem_free)(bus_dma_tag_t,
    551  1.2.2.2  bouyer 		    bus_dma_segment_t *, int);
    552  1.2.2.2  bouyer 	int	(*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
    553  1.2.2.2  bouyer 		    int, size_t, caddr_t *, int);
    554  1.2.2.2  bouyer 	void	(*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
    555  1.2.2.2  bouyer 	paddr_t	(*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
    556  1.2.2.2  bouyer 		    int, off_t, int, int);
    557  1.2.2.2  bouyer 
    558  1.2.2.2  bouyer 	/*
    559  1.2.2.2  bouyer 	 * NEWSMIPS quirks.
    560  1.2.2.2  bouyer 	 * This is NOT a constant.  Slot dependent information is
    561  1.2.2.2  bouyer 	 * required to flush DMA cache correctly.
    562  1.2.2.2  bouyer 	 */
    563  1.2.2.2  bouyer 	int	_slotno;
    564  1.2.2.2  bouyer 	bus_space_tag_t	_slotbaset;
    565  1.2.2.2  bouyer 	bus_space_handle_t _slotbaseh;
    566  1.2.2.2  bouyer };
    567  1.2.2.2  bouyer 
    568  1.2.2.2  bouyer #define	bus_dmamap_create(t, s, n, m, b, f, p)			\
    569  1.2.2.2  bouyer 	(*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
    570  1.2.2.2  bouyer #define	bus_dmamap_destroy(t, p)				\
    571  1.2.2.2  bouyer 	(*(t)->_dmamap_destroy)((t), (p))
    572  1.2.2.2  bouyer #define	bus_dmamap_load(t, m, b, s, p, f)			\
    573  1.2.2.2  bouyer 	(*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
    574  1.2.2.2  bouyer #define	bus_dmamap_load_mbuf(t, m, b, f)			\
    575  1.2.2.2  bouyer 	(*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
    576  1.2.2.2  bouyer #define	bus_dmamap_load_uio(t, m, u, f)				\
    577  1.2.2.2  bouyer 	(*(t)->_dmamap_load_uio)((t), (m), (u), (f))
    578  1.2.2.2  bouyer #define	bus_dmamap_load_raw(t, m, sg, n, s, f)			\
    579  1.2.2.2  bouyer 	(*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
    580  1.2.2.2  bouyer #define	bus_dmamap_unload(t, p)					\
    581  1.2.2.2  bouyer 	(*(t)->_dmamap_unload)((t), (p))
    582  1.2.2.2  bouyer #define	bus_dmamap_sync(t, p, o, l, ops)			\
    583  1.2.2.2  bouyer 	(*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
    584  1.2.2.2  bouyer 
    585  1.2.2.2  bouyer #define	bus_dmamem_alloc(t, s, a, b, sg, n, r, f)		\
    586  1.2.2.2  bouyer 	(*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
    587  1.2.2.2  bouyer #define	bus_dmamem_free(t, sg, n)				\
    588  1.2.2.2  bouyer 	(*(t)->_dmamem_free)((t), (sg), (n))
    589  1.2.2.2  bouyer #define	bus_dmamem_map(t, sg, n, s, k, f)			\
    590  1.2.2.2  bouyer 	(*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
    591  1.2.2.2  bouyer #define	bus_dmamem_unmap(t, k, s)				\
    592  1.2.2.2  bouyer 	(*(t)->_dmamem_unmap)((t), (k), (s))
    593  1.2.2.2  bouyer #define	bus_dmamem_mmap(t, sg, n, o, p, f)			\
    594  1.2.2.2  bouyer 	(*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
    595  1.2.2.2  bouyer 
    596  1.2.2.2  bouyer /*
    597  1.2.2.2  bouyer  *	bus_dmamap_t
    598  1.2.2.2  bouyer  *
    599  1.2.2.2  bouyer  *	Describes a DMA mapping.
    600  1.2.2.2  bouyer  */
    601  1.2.2.2  bouyer struct newsmips_bus_dmamap {
    602  1.2.2.2  bouyer 	/*
    603  1.2.2.2  bouyer 	 * PRIVATE MEMBERS: not for use my machine-independent code.
    604  1.2.2.2  bouyer 	 */
    605  1.2.2.2  bouyer 	bus_size_t	_dm_size;	/* largest DMA transfer mappable */
    606  1.2.2.2  bouyer 	int		_dm_segcnt;	/* number of segs this map can map */
    607  1.2.2.2  bouyer 	bus_size_t	_dm_maxsegsz;	/* largest possible segment */
    608  1.2.2.2  bouyer 	bus_size_t	_dm_boundary;	/* don't cross this */
    609  1.2.2.2  bouyer 	int		_dm_flags;	/* misc. flags */
    610  1.2.2.2  bouyer 	int		_dm_maptbl;	/* DMA mapping table index */
    611  1.2.2.2  bouyer 	int		_dm_maptblcnt;	/* number of DMA mapping table */
    612  1.2.2.2  bouyer 
    613  1.2.2.2  bouyer 	/*
    614  1.2.2.2  bouyer 	 * PUBLIC MEMBERS: these are used by machine-independent code.
    615  1.2.2.2  bouyer 	 */
    616  1.2.2.2  bouyer 	bus_size_t	dm_mapsize;	/* size of the mapping */
    617  1.2.2.2  bouyer 	int		dm_nsegs;	/* # valid segments in mapping */
    618  1.2.2.2  bouyer 	bus_dma_segment_t dm_segs[1];	/* segments; variable length */
    619  1.2.2.2  bouyer };
    620  1.2.2.2  bouyer 
    621  1.2.2.2  bouyer #ifdef _NEWSMIPS_BUS_DMA_PRIVATE
    622  1.2.2.2  bouyer int	_bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
    623  1.2.2.2  bouyer 	    bus_size_t, int, bus_dmamap_t *);
    624  1.2.2.2  bouyer void	_bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
    625  1.2.2.2  bouyer int	_bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
    626  1.2.2.2  bouyer 	    bus_size_t, struct proc *, int);
    627  1.2.2.2  bouyer int	_bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
    628  1.2.2.2  bouyer 	    struct mbuf *, int);
    629  1.2.2.2  bouyer int	_bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
    630  1.2.2.2  bouyer 	    struct uio *, int);
    631  1.2.2.2  bouyer int	_bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
    632  1.2.2.2  bouyer 	    bus_dma_segment_t *, int, bus_size_t, int);
    633  1.2.2.2  bouyer void	_bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
    634  1.2.2.2  bouyer void	_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
    635  1.2.2.2  bouyer 	    bus_size_t, int);
    636  1.2.2.2  bouyer 
    637  1.2.2.2  bouyer int	_bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
    638  1.2.2.2  bouyer 	    bus_size_t alignment, bus_size_t boundary,
    639  1.2.2.2  bouyer 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
    640  1.2.2.2  bouyer void	_bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    641  1.2.2.2  bouyer 	    int nsegs);
    642  1.2.2.2  bouyer int	_bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    643  1.2.2.2  bouyer 	    int nsegs, size_t size, caddr_t *kvap, int flags);
    644  1.2.2.2  bouyer void	_bus_dmamem_unmap(bus_dma_tag_t tag, caddr_t kva,
    645  1.2.2.2  bouyer 	    size_t size);
    646  1.2.2.2  bouyer paddr_t	_bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    647  1.2.2.2  bouyer 	    int nsegs, off_t off, int prot, int flags);
    648  1.2.2.2  bouyer 
    649  1.2.2.2  bouyer int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
    650  1.2.2.2  bouyer 	    bus_size_t alignment, bus_size_t boundary,
    651  1.2.2.2  bouyer 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
    652  1.2.2.2  bouyer 	    vaddr_t low, vaddr_t high);
    653  1.2.2.2  bouyer 
    654  1.2.2.2  bouyer extern struct newsmips_bus_dma_tag newsmips_default_bus_dma_tag;
    655  1.2.2.2  bouyer #endif /* _NEWSMIPS_BUS_DMA_PRIVATE */
    656  1.2.2.2  bouyer 
    657  1.2.2.2  bouyer #endif /* _NEWSMIPS_BUS_H_ */
    658