Home | History | Annotate | Line # | Download | only in include
bus_funcs.h revision 1.3
      1  1.3  thorpej /*	$NetBSD: bus_funcs.h,v 1.3 2023/12/07 03:46:10 thorpej Exp $	*/
      2  1.1   dyoung /*	NetBSD: bus.h,v 1.27 2000/03/15 16:44:50 drochner Exp 	*/
      3  1.1   dyoung /*	$OpenBSD: bus.h,v 1.15 1999/08/11 23:15:21 niklas Exp $	*/
      4  1.1   dyoung 
      5  1.1   dyoung /*-
      6  1.1   dyoung  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
      7  1.1   dyoung  * All rights reserved.
      8  1.1   dyoung  *
      9  1.1   dyoung  * This code is derived from software contributed to The NetBSD Foundation
     10  1.1   dyoung  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
     11  1.1   dyoung  * NASA Ames Research Center.
     12  1.1   dyoung  *
     13  1.1   dyoung  * Redistribution and use in source and binary forms, with or without
     14  1.1   dyoung  * modification, are permitted provided that the following conditions
     15  1.1   dyoung  * are met:
     16  1.1   dyoung  * 1. Redistributions of source code must retain the above copyright
     17  1.1   dyoung  *    notice, this list of conditions and the following disclaimer.
     18  1.1   dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     19  1.1   dyoung  *    notice, this list of conditions and the following disclaimer in the
     20  1.1   dyoung  *    documentation and/or other materials provided with the distribution.
     21  1.1   dyoung  *
     22  1.1   dyoung  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     23  1.1   dyoung  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     24  1.1   dyoung  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     25  1.1   dyoung  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     26  1.1   dyoung  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27  1.1   dyoung  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28  1.1   dyoung  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29  1.1   dyoung  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30  1.1   dyoung  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31  1.1   dyoung  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     32  1.1   dyoung  * POSSIBILITY OF SUCH DAMAGE.
     33  1.1   dyoung  */
     34  1.1   dyoung 
     35  1.1   dyoung /*
     36  1.1   dyoung  * Copyright (c) 1997 Per Fogelstrom.  All rights reserved.
     37  1.1   dyoung  * Copyright (c) 1996 Niklas Hallqvist.  All rights reserved.
     38  1.1   dyoung  *
     39  1.1   dyoung  * Redistribution and use in source and binary forms, with or without
     40  1.1   dyoung  * modification, are permitted provided that the following conditions
     41  1.1   dyoung  * are met:
     42  1.1   dyoung  * 1. Redistributions of source code must retain the above copyright
     43  1.1   dyoung  *    notice, this list of conditions and the following disclaimer.
     44  1.1   dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     45  1.1   dyoung  *    notice, this list of conditions and the following disclaimer in the
     46  1.1   dyoung  *    documentation and/or other materials provided with the distribution.
     47  1.1   dyoung  * 3. All advertising materials mentioning features or use of this software
     48  1.1   dyoung  *    must display the following acknowledgement:
     49  1.1   dyoung  *      This product includes software developed by Christopher G. Demetriou
     50  1.1   dyoung  *	for the NetBSD Project.
     51  1.1   dyoung  * 4. The name of the author may not be used to endorse or promote products
     52  1.1   dyoung  *    derived from this software without specific prior written permission
     53  1.1   dyoung  *
     54  1.1   dyoung  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     55  1.1   dyoung  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     56  1.1   dyoung  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     57  1.1   dyoung  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     58  1.1   dyoung  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     59  1.1   dyoung  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     60  1.1   dyoung  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     61  1.1   dyoung  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     62  1.1   dyoung  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     63  1.1   dyoung  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     64  1.1   dyoung  */
     65  1.1   dyoung 
     66  1.1   dyoung #ifndef _ARC_BUS_FUNCS_H_
     67  1.1   dyoung #define _ARC_BUS_FUNCS_H_
     68  1.1   dyoung #ifdef _KERNEL
     69  1.1   dyoung 
     70  1.3  thorpej struct vmem;
     71  1.3  thorpej struct vmem_btag;
     72  1.3  thorpej 
     73  1.1   dyoung /* machine dependent utility function for bus_space users */
     74  1.1   dyoung void	arc_bus_space_init(bus_space_tag_t, const char *,
     75  1.1   dyoung 	    paddr_t, vaddr_t, bus_addr_t, bus_size_t);
     76  1.3  thorpej void	arc_bus_space_init_arena(bus_space_tag_t, struct vmem *,
     77  1.3  thorpej 	    struct vmem_btag *, unsigned int);
     78  1.1   dyoung void	arc_bus_space_set_aligned_stride(bus_space_tag_t, unsigned int);
     79  1.1   dyoung void	arc_sparse_bus_space_init(bus_space_tag_t, const char *,
     80  1.1   dyoung 	    paddr_t, bus_addr_t, bus_size_t);
     81  1.1   dyoung void	arc_large_bus_space_init(bus_space_tag_t, const char *,
     82  1.1   dyoung 	    paddr_t, bus_addr_t, bus_size_t);
     83  1.1   dyoung 
     84  1.1   dyoung /* these are provided for subclasses which override base bus_space. */
     85  1.1   dyoung 
     86  1.1   dyoung int	arc_bus_space_compose_handle(bus_space_tag_t,
     87  1.1   dyoung 	    bus_addr_t, bus_size_t, int, bus_space_handle_t *);
     88  1.1   dyoung int	arc_bus_space_dispose_handle(bus_space_tag_t,
     89  1.1   dyoung 	    bus_space_handle_t, bus_size_t);
     90  1.1   dyoung int	arc_bus_space_paddr(bus_space_tag_t,
     91  1.1   dyoung 	    bus_space_handle_t, paddr_t *);
     92  1.1   dyoung 
     93  1.1   dyoung int	arc_sparse_bus_space_compose_handle(bus_space_tag_t,
     94  1.1   dyoung 	    bus_addr_t, bus_size_t, int, bus_space_handle_t *);
     95  1.1   dyoung int	arc_sparse_bus_space_dispose_handle(bus_space_tag_t,
     96  1.1   dyoung 	    bus_space_handle_t, bus_size_t);
     97  1.1   dyoung int	arc_sparse_bus_space_paddr(bus_space_tag_t,
     98  1.1   dyoung 	    bus_space_handle_t, paddr_t *);
     99  1.1   dyoung 
    100  1.1   dyoung int	arc_bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
    101  1.1   dyoung 	    bus_space_handle_t *);
    102  1.1   dyoung void	arc_bus_space_unmap(bus_space_tag_t, bus_space_handle_t,
    103  1.1   dyoung 	    bus_size_t);
    104  1.1   dyoung int	arc_bus_space_subregion(bus_space_tag_t, bus_space_handle_t,
    105  1.1   dyoung 	    bus_size_t, bus_size_t, bus_space_handle_t *);
    106  1.1   dyoung paddr_t	arc_bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
    107  1.1   dyoung int	arc_bus_space_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t,
    108  1.1   dyoung 	    bus_size_t, bus_size_t, bus_size_t, int, bus_addr_t *,
    109  1.1   dyoung 	    bus_space_handle_t *);
    110  1.1   dyoung #define arc_bus_space_free	arc_bus_space_unmap
    111  1.1   dyoung 
    112  1.1   dyoung /*
    113  1.1   dyoung  *	int bus_space_compose_handle(bus_space_tag_t t, bus_addr_t addr,
    114  1.1   dyoung  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
    115  1.1   dyoung  *
    116  1.1   dyoung  * MACHINE DEPENDENT, NOT PORTABLE INTERFACE:
    117  1.1   dyoung  * Compose a bus_space handle from tag/handle/addr/size/flags.
    118  1.1   dyoung  * A helper function for bus_space_map()/bus_space_alloc() implementation.
    119  1.1   dyoung  */
    120  1.1   dyoung #define bus_space_compose_handle(bst, addr, size, flags, bshp)		\
    121  1.1   dyoung 	(*(bst)->bs_compose_handle)(bst, addr, size, flags, bshp)
    122  1.1   dyoung 
    123  1.1   dyoung /*
    124  1.1   dyoung  *	int bus_space_dispose_handle(bus_space_tag_t t, bus_addr_t addr,
    125  1.1   dyoung  *	    bus_space_handle_t bsh, bus_size_t size);
    126  1.1   dyoung  *
    127  1.1   dyoung  * MACHINE DEPENDENT, NOT PORTABLE INTERFACE:
    128  1.1   dyoung  * Dispose a bus_space handle.
    129  1.1   dyoung  * A helper function for bus_space_unmap()/bus_space_free() implementation.
    130  1.1   dyoung  */
    131  1.1   dyoung #define bus_space_dispose_handle(bst, bsh, size)			\
    132  1.1   dyoung 	(*(bst)->bs_dispose_handle)(bst, bsh, size)
    133  1.1   dyoung 
    134  1.1   dyoung /*
    135  1.1   dyoung  *	int bus_space_paddr(bus_space_tag_t tag,
    136  1.1   dyoung  *	    bus_space_handle_t bsh, paddr_t *pap);
    137  1.1   dyoung  *
    138  1.1   dyoung  * MACHINE DEPENDENT, NOT PORTABLE INTERFACE:
    139  1.1   dyoung  * (cannot be implemented on e.g. I/O space on i386, non-linear space on alpha)
    140  1.1   dyoung  * Return physical address of a region.
    141  1.1   dyoung  * A helper function for machine-dependent device mmap entry.
    142  1.1   dyoung  */
    143  1.1   dyoung #define bus_space_paddr(bst, bsh, pap)					\
    144  1.1   dyoung 	(*(bst)->bs_paddr)(bst, bsh, pap)
    145  1.1   dyoung 
    146  1.1   dyoung /*
    147  1.1   dyoung  *	void *bus_space_vaddr(bus_space_tag_t, bus_space_handle_t);
    148  1.1   dyoung  *
    149  1.1   dyoung  * Get the kernel virtual address for the mapped bus space.
    150  1.1   dyoung  * Only allowed for regions mapped with BUS_SPACE_MAP_LINEAR.
    151  1.1   dyoung  *  (XXX not enforced)
    152  1.1   dyoung  */
    153  1.1   dyoung #define bus_space_vaddr(bst, bsh)					\
    154  1.1   dyoung 	((void *)(bsh))
    155  1.1   dyoung 
    156  1.1   dyoung /*
    157  1.1   dyoung  *	paddr_t bus_space_mmap(bus_space_tag_t, bus_addr_t, off_t,
    158  1.1   dyoung  *	    int, int);
    159  1.1   dyoung  *
    160  1.1   dyoung  * Mmap bus space on behalf of the user.
    161  1.1   dyoung  */
    162  1.1   dyoung #define	bus_space_mmap(bst, addr, off, prot, flags)			\
    163  1.1   dyoung 	(*(bst)->bs_mmap)((bst), (addr), (off), (prot), (flags))
    164  1.1   dyoung 
    165  1.1   dyoung /*
    166  1.1   dyoung  *	int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
    167  1.1   dyoung  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
    168  1.1   dyoung  *
    169  1.1   dyoung  * Map a region of bus space.
    170  1.1   dyoung  */
    171  1.1   dyoung 
    172  1.1   dyoung #define bus_space_map(t, a, s, f, hp)					\
    173  1.1   dyoung 	(*(t)->bs_map)((t), (a), (s), (f), (hp))
    174  1.1   dyoung 
    175  1.1   dyoung /*
    176  1.1   dyoung  *	void bus_space_unmap(bus_space_tag_t t,
    177  1.1   dyoung  *	    bus_space_handle_t bsh, bus_size_t size);
    178  1.1   dyoung  *
    179  1.1   dyoung  * Unmap a region of bus space.
    180  1.1   dyoung  */
    181  1.1   dyoung 
    182  1.1   dyoung #define bus_space_unmap(t, h, s)					\
    183  1.1   dyoung 	(*(t)->bs_unmap)((t), (h), (s))
    184  1.1   dyoung 
    185  1.1   dyoung /*
    186  1.1   dyoung  *	int bus_space_subregion(bus_space_tag_t t,
    187  1.1   dyoung  *	    bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
    188  1.1   dyoung  *	    bus_space_handle_t *nbshp);
    189  1.1   dyoung  *
    190  1.1   dyoung  * Get a new handle for a subregion of an already-mapped area of bus space.
    191  1.1   dyoung  */
    192  1.1   dyoung 
    193  1.1   dyoung #define bus_space_subregion(t, h, o, s, hp)				\
    194  1.1   dyoung 	(*(t)->bs_subregion)((t), (h), (o), (s), (hp))
    195  1.1   dyoung 
    196  1.1   dyoung /*
    197  1.1   dyoung  *	int bus_space_alloc(bus_space_tag_t t, bus_addr_t, rstart,
    198  1.1   dyoung  *	    bus_addr_t rend, bus_size_t size, bus_size_t align,
    199  1.1   dyoung  *	    bus_size_t boundary, int flags, bus_addr_t *addrp,
    200  1.1   dyoung  *	    bus_space_handle_t *bshp);
    201  1.1   dyoung  *
    202  1.1   dyoung  * Allocate a region of bus space.
    203  1.1   dyoung  */
    204  1.1   dyoung 
    205  1.1   dyoung #define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp)			\
    206  1.1   dyoung 	(*(t)->bs_alloc)((t), (rs), (re), (s), (a), (b), (f), (ap), (hp))
    207  1.1   dyoung 
    208  1.1   dyoung /*
    209  1.1   dyoung  *	int bus_space_free(bus_space_tag_t t,
    210  1.1   dyoung  *	    bus_space_handle_t bsh, bus_size_t size);
    211  1.1   dyoung  *
    212  1.1   dyoung  * Free a region of bus space.
    213  1.1   dyoung  */
    214  1.1   dyoung 
    215  1.1   dyoung #define bus_space_free(t, h, s)						\
    216  1.1   dyoung 	(*(t)->bs_free)((t), (h), (s))
    217  1.1   dyoung 
    218  1.1   dyoung /*
    219  1.1   dyoung  * Operations which handle byte stream data on word access.
    220  1.1   dyoung  *
    221  1.1   dyoung  * These functions are defined to resolve endian mismatch, by either
    222  1.1   dyoung  * - When normal (i.e. stream-less) operations perform byte swap
    223  1.1   dyoung  *   to resolve endian mismatch, these functions bypass the byte swap.
    224  1.1   dyoung  * or
    225  1.1   dyoung  * - When bus bridge performs automatic byte swap, these functions
    226  1.1   dyoung  *   perform byte swap once more, to cancel the bridge's behavior.
    227  1.1   dyoung  *
    228  1.1   dyoung  * Currently these are just same as normal operations, since all
    229  1.1   dyoung  * supported buses are same endian with CPU (i.e. little-endian).
    230  1.1   dyoung  *
    231  1.1   dyoung  */
    232  1.1   dyoung #define __BUS_SPACE_HAS_STREAM_METHODS
    233  1.1   dyoung #define bus_space_read_stream_2(tag, bsh, offset)			\
    234  1.1   dyoung 	bus_space_read_2(tag, bsh, offset)
    235  1.1   dyoung #define bus_space_read_stream_4(tag, bsh, offset)			\
    236  1.1   dyoung 	bus_space_read_4(tag, bsh, offset)
    237  1.1   dyoung #define bus_space_read_stream_8(tag, bsh, offset)			\
    238  1.1   dyoung 	bus_space_read_8(tag, bsh, offset)
    239  1.1   dyoung #define bus_space_read_multi_stream_2(tag, bsh, offset, datap, count)	\
    240  1.1   dyoung 	bus_space_read_multi_2(tag, bsh, offset, datap, count)
    241  1.1   dyoung #define bus_space_read_multi_stream_4(tag, bsh, offset, datap, count)	\
    242  1.1   dyoung 	bus_space_read_multi_4(tag, bsh, offset, datap, count)
    243  1.1   dyoung #define bus_space_read_multi_stream_8(tag, bsh, offset, datap, count)	\
    244  1.1   dyoung 	bus_space_read_multi_8(tag, bsh, offset, datap, count)
    245  1.1   dyoung #define bus_space_read_region_stream_2(tag, bsh, offset, datap, count)	\
    246  1.1   dyoung 	bus_space_read_region_2(tag, bsh, offset, datap, count)
    247  1.1   dyoung #define bus_space_read_region_stream_4(tag, bsh, offset, datap, count)	\
    248  1.1   dyoung 	bus_space_read_region_4(tag, bsh, offset, datap, count)
    249  1.1   dyoung #define bus_space_read_region_stream_8(tag, bsh, offset, datap, count)	\
    250  1.1   dyoung 	bus_space_read_region_8(tag, bsh, offset, datap, count)
    251  1.1   dyoung #define bus_space_write_stream_2(tag, bsh, offset, data)		\
    252  1.1   dyoung 	bus_space_write_2(tag, bsh, offset, data)
    253  1.1   dyoung #define bus_space_write_stream_4(tag, bsh, offset, data)		\
    254  1.1   dyoung 	bus_space_write_4(tag, bsh, offset, data)
    255  1.1   dyoung #define bus_space_write_stream_8(tag, bsh, offset, data)		\
    256  1.1   dyoung 	bus_space_write_8(tag, bsh, offset, data)
    257  1.1   dyoung #define bus_space_write_multi_stream_2(tag, bsh, offset, datap, count)	\
    258  1.1   dyoung 	bus_space_write_multi_2(tag, bsh, offset, datap, count)
    259  1.1   dyoung #define bus_space_write_multi_stream_4(tag, bsh, offset, datap, count)	\
    260  1.1   dyoung 	bus_space_write_multi_4(tag, bsh, offset, datap, count)
    261  1.1   dyoung #define bus_space_write_multi_stream_8(tag, bsh, offset, datap, count)	\
    262  1.1   dyoung 	bus_space_write_multi_8(tag, bsh, offset, datap, count)
    263  1.1   dyoung #define bus_space_write_region_stream_2(tag, bsh, offset, datap, count)	\
    264  1.1   dyoung 	bus_space_write_region_2(tag, bsh, offset, datap, count)
    265  1.1   dyoung #define bus_space_write_region_stream_4(tag, bsh, offset, datap, count)	\
    266  1.1   dyoung 	bus_space_write_region_4(tag, bsh, offset, datap, count)
    267  1.1   dyoung #define bus_space_write_region_stream_8(tag, bsh, offset, datap, count)	\
    268  1.1   dyoung 	bus_space_write_region_8(tag, bsh, offset, datap, count)
    269  1.1   dyoung #define bus_space_write_region_stream_2(tag, bsh, offset, datap, count)	\
    270  1.1   dyoung 	bus_space_write_region_2(tag, bsh, offset, datap, count)
    271  1.1   dyoung #define bus_space_write_region_stream_4(tag, bsh, offset, datap, count)	\
    272  1.1   dyoung 	bus_space_write_region_4(tag, bsh, offset, datap, count)
    273  1.1   dyoung #define bus_space_write_region_stream_8(tag, bsh, offset, datap, count)	\
    274  1.1   dyoung 	bus_space_write_region_8(tag, bsh, offset, datap, count)
    275  1.1   dyoung #define bus_space_set_multi_stream_2(tag, bsh, offset, data, count)	\
    276  1.1   dyoung 	bus_space_set_multi_2(tag, bsh, offset, data, count)
    277  1.1   dyoung #define bus_space_set_multi_stream_4(tag, bsh, offset, data, count)	\
    278  1.1   dyoung 	bus_space_set_multi_4(tag, bsh, offset, data, count)
    279  1.1   dyoung #define bus_space_set_multi_stream_8(tag, bsh, offset, data, count)	\
    280  1.1   dyoung 	bus_space_set_multi_8(tag, bsh, offset, data, count)
    281  1.1   dyoung #define bus_space_set_region_stream_2(tag, bsh, offset, data, count)	\
    282  1.1   dyoung 	bus_space_set_region_2(tag, bsh, offset, data, count)
    283  1.1   dyoung #define bus_space_set_region_stream_4(tag, bsh, offset, data, count)	\
    284  1.1   dyoung 	bus_space_set_region_4(tag, bsh, offset, data, count)
    285  1.1   dyoung #define bus_space_set_region_stream_8(tag, bsh, offset, data, count)	\
    286  1.1   dyoung 	bus_space_set_region_8(tag, bsh, offset, data, count)
    287  1.1   dyoung 
    288  1.1   dyoung /*
    289  1.1   dyoung  * Bus read/write barrier methods.
    290  1.1   dyoung  *
    291  1.1   dyoung  *	void bus_space_barrier(bus_space_tag_t tag,
    292  1.1   dyoung  *	    bus_space_handle_t bsh, bus_size_t offset,
    293  1.1   dyoung  *	    bus_size_t len, int flags);
    294  1.1   dyoung  *
    295  1.1   dyoung  * On the MIPS, we just flush the write buffer.
    296  1.1   dyoung  */
    297  1.1   dyoung #define bus_space_barrier(t, h, o, l, f)				\
    298  1.1   dyoung 	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f),	\
    299  1.1   dyoung 	 wbflush()))
    300  1.1   dyoung 
    301  1.1   dyoung /* Forwards needed by prototypes below. */
    302  1.1   dyoung struct mbuf;
    303  1.1   dyoung struct uio;
    304  1.1   dyoung 
    305  1.1   dyoung #define bus_dmamap_create(t, s, n, m, b, f, p)			\
    306  1.1   dyoung 	(*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
    307  1.1   dyoung #define bus_dmamap_destroy(t, p)				\
    308  1.1   dyoung 	(*(t)->_dmamap_destroy)((t), (p))
    309  1.1   dyoung #define bus_dmamap_load(t, m, b, s, p, f)			\
    310  1.1   dyoung 	(*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
    311  1.1   dyoung #define bus_dmamap_load_mbuf(t, m, b, f)			\
    312  1.1   dyoung 	(*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
    313  1.1   dyoung #define bus_dmamap_load_uio(t, m, u, f)				\
    314  1.1   dyoung 	(*(t)->_dmamap_load_uio)((t), (m), (u), (f))
    315  1.1   dyoung #define bus_dmamap_load_raw(t, m, sg, n, s, f)			\
    316  1.1   dyoung 	(*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
    317  1.1   dyoung #define bus_dmamap_unload(t, p)					\
    318  1.1   dyoung 	(*(t)->_dmamap_unload)((t), (p))
    319  1.1   dyoung #define bus_dmamap_sync(t, p, o, l, ops)			\
    320  1.1   dyoung 	(*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
    321  1.1   dyoung #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f)		\
    322  1.1   dyoung 	(*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
    323  1.1   dyoung #define bus_dmamem_free(t, sg, n)				\
    324  1.1   dyoung 	(*(t)->_dmamem_free)((t), (sg), (n))
    325  1.1   dyoung #define bus_dmamem_map(t, sg, n, s, k, f)			\
    326  1.1   dyoung 	(*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
    327  1.1   dyoung #define bus_dmamem_unmap(t, k, s)				\
    328  1.1   dyoung 	(*(t)->_dmamem_unmap)((t), (k), (s))
    329  1.1   dyoung #define bus_dmamem_mmap(t, sg, n, o, p, f)			\
    330  1.1   dyoung 	(*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
    331  1.1   dyoung 
    332  1.1   dyoung #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
    333  1.1   dyoung #define bus_dmatag_destroy(t)
    334  1.1   dyoung 
    335  1.1   dyoung #ifdef _ARC_BUS_DMA_PRIVATE
    336  1.1   dyoung int	_bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
    337  1.1   dyoung 	    bus_size_t, int, bus_dmamap_t *);
    338  1.1   dyoung void	_bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
    339  1.1   dyoung int	_bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
    340  1.1   dyoung 	    bus_size_t, struct proc *, int);
    341  1.1   dyoung int	_bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
    342  1.1   dyoung 	    struct mbuf *, int);
    343  1.1   dyoung int	_bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
    344  1.1   dyoung 	    struct uio *, int);
    345  1.1   dyoung int	_bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
    346  1.1   dyoung 	    bus_dma_segment_t *, int, bus_size_t, int);
    347  1.1   dyoung void	_bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
    348  1.1   dyoung void	_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
    349  1.1   dyoung 	    bus_size_t, int);
    350  1.1   dyoung 
    351  1.1   dyoung int	_bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
    352  1.1   dyoung 	    bus_size_t alignment, bus_size_t boundary,
    353  1.1   dyoung 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
    354  1.1   dyoung int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
    355  1.1   dyoung 	    bus_size_t alignment, bus_size_t boundary,
    356  1.1   dyoung 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
    357  1.1   dyoung 	    paddr_t low, paddr_t high);
    358  1.1   dyoung void	_bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    359  1.1   dyoung 	    int nsegs);
    360  1.1   dyoung int	_bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    361  1.1   dyoung 	    int nsegs, size_t size, void **kvap, int flags);
    362  1.1   dyoung void	_bus_dmamem_unmap(bus_dma_tag_t tag, void *kva,
    363  1.1   dyoung 	    size_t size);
    364  1.1   dyoung paddr_t	_bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
    365  1.1   dyoung 	    int nsegs, off_t off, int prot, int flags);
    366  1.1   dyoung 
    367  1.1   dyoung int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
    368  1.1   dyoung 	    bus_size_t alignment, bus_size_t boundary,
    369  1.1   dyoung 	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
    370  1.1   dyoung 	    paddr_t low, paddr_t high);
    371  1.1   dyoung #endif /* _ARC_BUS_DMA_PRIVATE */
    372  1.1   dyoung 
    373  1.1   dyoung void	_bus_dma_tag_init(bus_dma_tag_t tag);
    374  1.1   dyoung void	jazz_bus_dma_tag_init(bus_dma_tag_t tag);
    375  1.1   dyoung void	isadma_bounce_tag_init(bus_dma_tag_t tag);
    376  1.1   dyoung 
    377  1.1   dyoung #endif /* _KERNEL */
    378  1.1   dyoung #endif /* _ARC_BUS_FUNCS_H_ */
    379