1*e1fcbd89Sskrll /* $NetBSD: bus_funcs.h,v 1.13 2023/04/18 11:06:57 skrll Exp $ */ 259adf08eSdyoung 359adf08eSdyoung /*- 459adf08eSdyoung * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. 559adf08eSdyoung * All rights reserved. 659adf08eSdyoung * 759adf08eSdyoung * This code is derived from software contributed to The NetBSD Foundation 859adf08eSdyoung * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 959adf08eSdyoung * NASA Ames Research Center. 1059adf08eSdyoung * 1159adf08eSdyoung * Redistribution and use in source and binary forms, with or without 1259adf08eSdyoung * modification, are permitted provided that the following conditions 1359adf08eSdyoung * are met: 1459adf08eSdyoung * 1. Redistributions of source code must retain the above copyright 1559adf08eSdyoung * notice, this list of conditions and the following disclaimer. 1659adf08eSdyoung * 2. Redistributions in binary form must reproduce the above copyright 1759adf08eSdyoung * notice, this list of conditions and the following disclaimer in the 1859adf08eSdyoung * documentation and/or other materials provided with the distribution. 1959adf08eSdyoung * 2059adf08eSdyoung * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2159adf08eSdyoung * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2259adf08eSdyoung * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2359adf08eSdyoung * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2459adf08eSdyoung * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2559adf08eSdyoung * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2659adf08eSdyoung * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2759adf08eSdyoung * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2859adf08eSdyoung * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2959adf08eSdyoung * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3059adf08eSdyoung * POSSIBILITY OF SUCH DAMAGE. 3159adf08eSdyoung */ 3259adf08eSdyoung 3359adf08eSdyoung /* 3459adf08eSdyoung * Copyright (c) 1996 Charles M. Hannum. All rights reserved. 3559adf08eSdyoung * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 3659adf08eSdyoung * 3759adf08eSdyoung * Redistribution and use in source and binary forms, with or without 3859adf08eSdyoung * modification, are permitted provided that the following conditions 3959adf08eSdyoung * are met: 4059adf08eSdyoung * 1. Redistributions of source code must retain the above copyright 4159adf08eSdyoung * notice, this list of conditions and the following disclaimer. 4259adf08eSdyoung * 2. Redistributions in binary form must reproduce the above copyright 4359adf08eSdyoung * notice, this list of conditions and the following disclaimer in the 4459adf08eSdyoung * documentation and/or other materials provided with the distribution. 4559adf08eSdyoung * 3. All advertising materials mentioning features or use of this software 4659adf08eSdyoung * must display the following acknowledgement: 4759adf08eSdyoung * This product includes software developed by Christopher G. Demetriou 4859adf08eSdyoung * for the NetBSD Project. 4959adf08eSdyoung * 4. The name of the author may not be used to endorse or promote products 5059adf08eSdyoung * derived from this software without specific prior written permission 5159adf08eSdyoung * 5259adf08eSdyoung * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 5359adf08eSdyoung * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 5459adf08eSdyoung * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 5559adf08eSdyoung * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 5659adf08eSdyoung * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 5759adf08eSdyoung * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5859adf08eSdyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5959adf08eSdyoung * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 6059adf08eSdyoung * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 6159adf08eSdyoung * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6259adf08eSdyoung */ 6359adf08eSdyoung 642e13731dSmatt #ifndef _ARM_BUS_FUNCS_H_ 652e13731dSmatt #define _ARM_BUS_FUNCS_H_ 6659adf08eSdyoung 671610ae54Smatt #ifdef _KERNEL_OPT 681610ae54Smatt #include "opt_cputypes.h" 691610ae54Smatt #endif 701610ae54Smatt 7159adf08eSdyoung /* 7259adf08eSdyoung * Utility macros; INTERNAL USE ONLY. 7359adf08eSdyoung */ 7459adf08eSdyoung #define __bs_c(a,b) __CONCAT(a,b) 7559adf08eSdyoung #define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size) 7659adf08eSdyoung 7759adf08eSdyoung #define __bs_rs(sz, t, h, o) \ 7859adf08eSdyoung (*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o) 7959adf08eSdyoung #define __bs_ws(sz, t, h, o, v) \ 8059adf08eSdyoung (*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v) 8159adf08eSdyoung #define __bs_nonsingle(type, sz, t, h, o, a, c) \ 8259adf08eSdyoung (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c) 8359adf08eSdyoung #define __bs_set(type, sz, t, h, o, v, c) \ 8459adf08eSdyoung (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c) 8559adf08eSdyoung #define __bs_copy(sz, t, h1, o1, h2, o2, cnt) \ 8659adf08eSdyoung (*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt) 8759adf08eSdyoung 8859adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 8959adf08eSdyoung #define __bs_opname_s(op,size) __bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s) 9059adf08eSdyoung #define __bs_rs_s(sz, t, h, o) \ 9159adf08eSdyoung (*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o) 9259adf08eSdyoung #define __bs_ws_s(sz, t, h, o, v) \ 9359adf08eSdyoung (*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v) 9459adf08eSdyoung #define __bs_nonsingle_s(type, sz, t, h, o, a, c) \ 9559adf08eSdyoung (*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c) 9659adf08eSdyoung #define __bs_set_s(type, sz, t, h, o, v, c) \ 9759adf08eSdyoung (*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, v, c) 9859adf08eSdyoung #define __bs_copy_s(sz, t, h1, o1, h2, o2, cnt) \ 9959adf08eSdyoung (*(t)->__bs_opname_s(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt) 10059adf08eSdyoung #endif 10159adf08eSdyoung 102fe33aa27Sryo #ifdef __BUS_SPACE_HAS_PROBING_METHODS 103fe33aa27Sryo #define __bs_pe(sz, t, h, o, v) \ 104fe33aa27Sryo (*(t)->__bs_opname(pe,sz))((t)->bs_cookie, h, o, v) 105fe33aa27Sryo #define __bs_po(sz, t, h, o, v) \ 106fe33aa27Sryo (*(t)->__bs_opname(po,sz))((t)->bs_cookie, h, o, v) 107fe33aa27Sryo #endif 108fe33aa27Sryo 10959adf08eSdyoung /* 11059adf08eSdyoung * Mapping and unmapping operations. 11159adf08eSdyoung */ 11259adf08eSdyoung #define bus_space_map(t, a, s, c, hp) \ 11359adf08eSdyoung (*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp)) 11459adf08eSdyoung #define bus_space_unmap(t, h, s) \ 11559adf08eSdyoung (*(t)->bs_unmap)((t)->bs_cookie, (h), (s)) 11659adf08eSdyoung #define bus_space_subregion(t, h, o, s, hp) \ 11759adf08eSdyoung (*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp)) 11859adf08eSdyoung 11959adf08eSdyoung 12059adf08eSdyoung /* 12159adf08eSdyoung * Allocation and deallocation operations. 12259adf08eSdyoung */ 12359adf08eSdyoung #define bus_space_alloc(t, rs, re, s, a, b, c, ap, hp) \ 12459adf08eSdyoung (*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b), \ 12559adf08eSdyoung (c), (ap), (hp)) 12659adf08eSdyoung #define bus_space_free(t, h, s) \ 12759adf08eSdyoung (*(t)->bs_free)((t)->bs_cookie, (h), (s)) 12859adf08eSdyoung 12959adf08eSdyoung /* 13059adf08eSdyoung * Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR. 13159adf08eSdyoung */ 13259adf08eSdyoung #define bus_space_vaddr(t, h) \ 13359adf08eSdyoung (*(t)->bs_vaddr)((t)->bs_cookie, (h)) 13459adf08eSdyoung 13559adf08eSdyoung /* 13659adf08eSdyoung * MMap bus space for a user application. 13759adf08eSdyoung */ 13859adf08eSdyoung #define bus_space_mmap(t, a, o, p, f) \ 13959adf08eSdyoung (*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f)) 14059adf08eSdyoung 14159adf08eSdyoung /* 14259adf08eSdyoung * Bus barrier operations. 14359adf08eSdyoung */ 14459adf08eSdyoung #define bus_space_barrier(t, h, o, l, f) \ 14559adf08eSdyoung (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f)) 14659adf08eSdyoung 14759adf08eSdyoung /* 14859adf08eSdyoung * Bus read (single) operations. 14959adf08eSdyoung */ 15059adf08eSdyoung #define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o)) 15159adf08eSdyoung #define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o)) 15259adf08eSdyoung #define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o)) 153203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 15459adf08eSdyoung #define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o)) 155203e15b5Smartin #endif 15659adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 15759adf08eSdyoung #define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t),(h),(o)) 15859adf08eSdyoung #define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t),(h),(o)) 15959adf08eSdyoung #define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t),(h),(o)) 160203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 16159adf08eSdyoung #define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t),(h),(o)) 16259adf08eSdyoung #endif 163203e15b5Smartin #endif 16459adf08eSdyoung 16559adf08eSdyoung 16659adf08eSdyoung /* 16759adf08eSdyoung * Bus read multiple operations. 16859adf08eSdyoung */ 16959adf08eSdyoung #define bus_space_read_multi_1(t, h, o, a, c) \ 17059adf08eSdyoung __bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) 17159adf08eSdyoung #define bus_space_read_multi_2(t, h, o, a, c) \ 17259adf08eSdyoung __bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) 17359adf08eSdyoung #define bus_space_read_multi_4(t, h, o, a, c) \ 17459adf08eSdyoung __bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) 175203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 17659adf08eSdyoung #define bus_space_read_multi_8(t, h, o, a, c) \ 17759adf08eSdyoung __bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) 178203e15b5Smartin #endif 17959adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 18059adf08eSdyoung #define bus_space_read_multi_stream_1(t, h, o, a, c) \ 18159adf08eSdyoung __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c)) 18259adf08eSdyoung #define bus_space_read_multi_stream_2(t, h, o, a, c) \ 18359adf08eSdyoung __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c)) 18459adf08eSdyoung #define bus_space_read_multi_stream_4(t, h, o, a, c) \ 18559adf08eSdyoung __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c)) 186203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 18759adf08eSdyoung #define bus_space_read_multi_stream_8(t, h, o, a, c) \ 18859adf08eSdyoung __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c)) 18959adf08eSdyoung #endif 190203e15b5Smartin #endif 19159adf08eSdyoung 19259adf08eSdyoung 19359adf08eSdyoung /* 19459adf08eSdyoung * Bus read region operations. 19559adf08eSdyoung */ 19659adf08eSdyoung #define bus_space_read_region_1(t, h, o, a, c) \ 19759adf08eSdyoung __bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) 19859adf08eSdyoung #define bus_space_read_region_2(t, h, o, a, c) \ 19959adf08eSdyoung __bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) 20059adf08eSdyoung #define bus_space_read_region_4(t, h, o, a, c) \ 20159adf08eSdyoung __bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) 202203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 20359adf08eSdyoung #define bus_space_read_region_8(t, h, o, a, c) \ 20459adf08eSdyoung __bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) 205203e15b5Smartin #endif 20659adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 20759adf08eSdyoung #define bus_space_read_region_stream_1(t, h, o, a, c) \ 20859adf08eSdyoung __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c)) 20959adf08eSdyoung #define bus_space_read_region_stream_2(t, h, o, a, c) \ 21059adf08eSdyoung __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c)) 21159adf08eSdyoung #define bus_space_read_region_stream_4(t, h, o, a, c) \ 21259adf08eSdyoung __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c)) 213203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 21459adf08eSdyoung #define bus_space_read_region_stream_8(t, h, o, a, c) \ 21559adf08eSdyoung __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c)) 21659adf08eSdyoung #endif 217203e15b5Smartin #endif 21859adf08eSdyoung 21959adf08eSdyoung 22059adf08eSdyoung /* 22159adf08eSdyoung * Bus write (single) operations. 22259adf08eSdyoung */ 22359adf08eSdyoung #define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v)) 22459adf08eSdyoung #define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v)) 22559adf08eSdyoung #define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v)) 226203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 22759adf08eSdyoung #define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v)) 228203e15b5Smartin #endif 22959adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 23059adf08eSdyoung #define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v)) 23159adf08eSdyoung #define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v)) 23259adf08eSdyoung #define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v)) 233203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 23459adf08eSdyoung #define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v)) 23559adf08eSdyoung #endif 236203e15b5Smartin #endif 23759adf08eSdyoung 23859adf08eSdyoung 23959adf08eSdyoung /* 24059adf08eSdyoung * Bus write multiple operations. 24159adf08eSdyoung */ 24259adf08eSdyoung #define bus_space_write_multi_1(t, h, o, a, c) \ 24359adf08eSdyoung __bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) 24459adf08eSdyoung #define bus_space_write_multi_2(t, h, o, a, c) \ 24559adf08eSdyoung __bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) 24659adf08eSdyoung #define bus_space_write_multi_4(t, h, o, a, c) \ 24759adf08eSdyoung __bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) 248203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 24959adf08eSdyoung #define bus_space_write_multi_8(t, h, o, a, c) \ 25059adf08eSdyoung __bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) 251203e15b5Smartin #endif 25259adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 25359adf08eSdyoung #define bus_space_write_multi_stream_1(t, h, o, a, c) \ 25459adf08eSdyoung __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c)) 25559adf08eSdyoung #define bus_space_write_multi_stream_2(t, h, o, a, c) \ 25659adf08eSdyoung __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c)) 25759adf08eSdyoung #define bus_space_write_multi_stream_4(t, h, o, a, c) \ 25859adf08eSdyoung __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c)) 259203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 26059adf08eSdyoung #define bus_space_write_multi_stream_8(t, h, o, a, c) \ 26159adf08eSdyoung __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c)) 26259adf08eSdyoung #endif 263203e15b5Smartin #endif 26459adf08eSdyoung 26559adf08eSdyoung 26659adf08eSdyoung /* 26759adf08eSdyoung * Bus write region operations. 26859adf08eSdyoung */ 26959adf08eSdyoung #define bus_space_write_region_1(t, h, o, a, c) \ 27059adf08eSdyoung __bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) 27159adf08eSdyoung #define bus_space_write_region_2(t, h, o, a, c) \ 27259adf08eSdyoung __bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) 27359adf08eSdyoung #define bus_space_write_region_4(t, h, o, a, c) \ 27459adf08eSdyoung __bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) 275203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 27659adf08eSdyoung #define bus_space_write_region_8(t, h, o, a, c) \ 27759adf08eSdyoung __bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) 278203e15b5Smartin #endif 27959adf08eSdyoung #ifdef __BUS_SPACE_HAS_STREAM_METHODS 28059adf08eSdyoung #define bus_space_write_region_stream_1(t, h, o, a, c) \ 28159adf08eSdyoung __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c)) 28259adf08eSdyoung #define bus_space_write_region_stream_2(t, h, o, a, c) \ 28359adf08eSdyoung __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c)) 28459adf08eSdyoung #define bus_space_write_region_stream_4(t, h, o, a, c) \ 28559adf08eSdyoung __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c)) 286203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 28759adf08eSdyoung #define bus_space_write_region_stream_8(t, h, o, a, c) \ 28859adf08eSdyoung __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c)) 28959adf08eSdyoung #endif 290203e15b5Smartin #endif 29159adf08eSdyoung 29259adf08eSdyoung 29359adf08eSdyoung /* 29459adf08eSdyoung * Set multiple operations. 29559adf08eSdyoung */ 29659adf08eSdyoung #define bus_space_set_multi_1(t, h, o, v, c) \ 29759adf08eSdyoung __bs_set(sm,1,(t),(h),(o),(v),(c)) 29859adf08eSdyoung #define bus_space_set_multi_2(t, h, o, v, c) \ 29959adf08eSdyoung __bs_set(sm,2,(t),(h),(o),(v),(c)) 30059adf08eSdyoung #define bus_space_set_multi_4(t, h, o, v, c) \ 30159adf08eSdyoung __bs_set(sm,4,(t),(h),(o),(v),(c)) 302203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 30359adf08eSdyoung #define bus_space_set_multi_8(t, h, o, v, c) \ 30459adf08eSdyoung __bs_set(sm,8,(t),(h),(o),(v),(c)) 305203e15b5Smartin #endif 30659adf08eSdyoung 30759adf08eSdyoung /* 30859adf08eSdyoung * Set region operations. 30959adf08eSdyoung */ 31059adf08eSdyoung #define bus_space_set_region_1(t, h, o, v, c) \ 31159adf08eSdyoung __bs_set(sr,1,(t),(h),(o),(v),(c)) 31259adf08eSdyoung #define bus_space_set_region_2(t, h, o, v, c) \ 31359adf08eSdyoung __bs_set(sr,2,(t),(h),(o),(v),(c)) 31459adf08eSdyoung #define bus_space_set_region_4(t, h, o, v, c) \ 31559adf08eSdyoung __bs_set(sr,4,(t),(h),(o),(v),(c)) 316203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 31759adf08eSdyoung #define bus_space_set_region_8(t, h, o, v, c) \ 31859adf08eSdyoung __bs_set(sr,8,(t),(h),(o),(v),(c)) 319203e15b5Smartin #endif 32059adf08eSdyoung 32159adf08eSdyoung /* 32259adf08eSdyoung * Copy operations. 32359adf08eSdyoung */ 32459adf08eSdyoung #define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ 32559adf08eSdyoung __bs_copy(1, t, h1, o1, h2, o2, c) 32659adf08eSdyoung #define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ 32759adf08eSdyoung __bs_copy(2, t, h1, o1, h2, o2, c) 32859adf08eSdyoung #define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ 32959adf08eSdyoung __bs_copy(4, t, h1, o1, h2, o2, c) 330203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 33159adf08eSdyoung #define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ 33259adf08eSdyoung __bs_copy(8, t, h1, o1, h2, o2, c) 333203e15b5Smartin #endif 33459adf08eSdyoung 33559adf08eSdyoung /* 336fe33aa27Sryo * Probing operations. 337fe33aa27Sryo */ 338fe33aa27Sryo #ifdef __BUS_SPACE_HAS_PROBING_METHODS 339fe33aa27Sryo #define bus_space_peek_1(t, h, o, p) __bs_pe(1,(t),(h),(o),(p)) 340fe33aa27Sryo #define bus_space_peek_2(t, h, o, p) __bs_pe(2,(t),(h),(o),(p)) 341fe33aa27Sryo #define bus_space_peek_4(t, h, o, p) __bs_pe(4,(t),(h),(o),(p)) 342203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 343fe33aa27Sryo #define bus_space_peek_8(t, h, o, p) __bs_pe(8,(t),(h),(o),(p)) 344203e15b5Smartin #endif 345fe33aa27Sryo 346fe33aa27Sryo #define bus_space_poke_1(t, h, o, v) __bs_po(1,(t),(h),(o),(v)) 347fe33aa27Sryo #define bus_space_poke_2(t, h, o, v) __bs_po(2,(t),(h),(o),(v)) 348fe33aa27Sryo #define bus_space_poke_4(t, h, o, v) __bs_po(4,(t),(h),(o),(v)) 349203e15b5Smartin #ifdef __HAVE_BUS_SPACE_8 350fe33aa27Sryo #define bus_space_poke_8(t, h, o, v) __bs_po(8,(t),(h),(o),(v)) 351fe33aa27Sryo #endif 352203e15b5Smartin #endif 353fe33aa27Sryo 354fe33aa27Sryo /* 35559adf08eSdyoung * Macros to provide prototypes for all the functions used in the 35659adf08eSdyoung * bus_space structure 35759adf08eSdyoung */ 35859adf08eSdyoung 35959adf08eSdyoung #define bs_map_proto(f) \ 36059adf08eSdyoung int __bs_c(f,_bs_map)(void *t, bus_addr_t addr, \ 36159adf08eSdyoung bus_size_t size, int cacheable, bus_space_handle_t *bshp); 36259adf08eSdyoung 36359adf08eSdyoung #define bs_unmap_proto(f) \ 36459adf08eSdyoung void __bs_c(f,_bs_unmap)(void *t, bus_space_handle_t bsh, \ 36559adf08eSdyoung bus_size_t size); 36659adf08eSdyoung 36759adf08eSdyoung #define bs_subregion_proto(f) \ 36859adf08eSdyoung int __bs_c(f,_bs_subregion)(void *t, bus_space_handle_t bsh, \ 36959adf08eSdyoung bus_size_t offset, bus_size_t size, \ 37059adf08eSdyoung bus_space_handle_t *nbshp); 37159adf08eSdyoung 37259adf08eSdyoung #define bs_alloc_proto(f) \ 37359adf08eSdyoung int __bs_c(f,_bs_alloc)(void *t, bus_addr_t rstart, \ 37459adf08eSdyoung bus_addr_t rend, bus_size_t size, bus_size_t align, \ 37559adf08eSdyoung bus_size_t boundary, int cacheable, bus_addr_t *addrp, \ 37659adf08eSdyoung bus_space_handle_t *bshp); 37759adf08eSdyoung 37859adf08eSdyoung #define bs_free_proto(f) \ 37959adf08eSdyoung void __bs_c(f,_bs_free)(void *t, bus_space_handle_t bsh, \ 38059adf08eSdyoung bus_size_t size); 38159adf08eSdyoung 38259adf08eSdyoung #define bs_vaddr_proto(f) \ 38359adf08eSdyoung void * __bs_c(f,_bs_vaddr)(void *t, bus_space_handle_t bsh); 38459adf08eSdyoung 38559adf08eSdyoung #define bs_mmap_proto(f) \ 38659adf08eSdyoung paddr_t __bs_c(f,_bs_mmap)(void *, bus_addr_t, off_t, int, int); 38759adf08eSdyoung 38859adf08eSdyoung #define bs_barrier_proto(f) \ 38959adf08eSdyoung void __bs_c(f,_bs_barrier)(void *t, bus_space_handle_t bsh, \ 39059adf08eSdyoung bus_size_t offset, bus_size_t len, int flags); 39159adf08eSdyoung 39259adf08eSdyoung #define bs_r_1_proto(f) \ 3932452897bSmatt uint8_t __bs_c(f,_bs_r_1)(void *t, bus_space_handle_t bsh, \ 39459adf08eSdyoung bus_size_t offset); 39559adf08eSdyoung 39659adf08eSdyoung #define bs_r_2_proto(f) \ 3972452897bSmatt uint16_t __bs_c(f,_bs_r_2)(void *t, bus_space_handle_t bsh, \ 3982452897bSmatt bus_size_t offset); \ 3992452897bSmatt uint16_t __bs_c(f,_bs_r_2_swap)(void *t, bus_space_handle_t bsh, \ 40059adf08eSdyoung bus_size_t offset); 40159adf08eSdyoung 40259adf08eSdyoung #define bs_r_4_proto(f) \ 4032452897bSmatt uint32_t __bs_c(f,_bs_r_4)(void *t, bus_space_handle_t bsh, \ 4042452897bSmatt bus_size_t offset); \ 4052452897bSmatt uint32_t __bs_c(f,_bs_r_4_swap)(void *t, bus_space_handle_t bsh, \ 40659adf08eSdyoung bus_size_t offset); 40759adf08eSdyoung 40859adf08eSdyoung #define bs_r_8_proto(f) \ 4092452897bSmatt uint64_t __bs_c(f,_bs_r_8)(void *t, bus_space_handle_t bsh, \ 4102452897bSmatt bus_size_t offset); \ 4112452897bSmatt uint64_t __bs_c(f,_bs_r_8_swap)(void *t, bus_space_handle_t bsh, \ 41259adf08eSdyoung bus_size_t offset); 41359adf08eSdyoung 41459adf08eSdyoung #define bs_w_1_proto(f) \ 41559adf08eSdyoung void __bs_c(f,_bs_w_1)(void *t, bus_space_handle_t bsh, \ 4162452897bSmatt bus_size_t offset, uint8_t value); 41759adf08eSdyoung 41859adf08eSdyoung #define bs_w_2_proto(f) \ 41959adf08eSdyoung void __bs_c(f,_bs_w_2)(void *t, bus_space_handle_t bsh, \ 4202452897bSmatt bus_size_t offset, uint16_t value); \ 4212452897bSmatt void __bs_c(f,_bs_w_2_swap)(void *t, bus_space_handle_t bsh, \ 4222452897bSmatt bus_size_t offset, uint16_t value); 42359adf08eSdyoung 42459adf08eSdyoung #define bs_w_4_proto(f) \ 42559adf08eSdyoung void __bs_c(f,_bs_w_4)(void *t, bus_space_handle_t bsh, \ 4262452897bSmatt bus_size_t offset, uint32_t value); \ 4272452897bSmatt void __bs_c(f,_bs_w_4_swap)(void *t, bus_space_handle_t bsh, \ 4282452897bSmatt bus_size_t offset, uint32_t value); 42959adf08eSdyoung 43059adf08eSdyoung #define bs_w_8_proto(f) \ 43159adf08eSdyoung void __bs_c(f,_bs_w_8)(void *t, bus_space_handle_t bsh, \ 4322452897bSmatt bus_size_t offset, uint64_t value); \ 4332452897bSmatt void __bs_c(f,_bs_w_8_swap)(void *t, bus_space_handle_t bsh, \ 4342452897bSmatt bus_size_t offset, uint64_t value); 43559adf08eSdyoung 43659adf08eSdyoung #define bs_rm_1_proto(f) \ 43759adf08eSdyoung void __bs_c(f,_bs_rm_1)(void *t, bus_space_handle_t bsh, \ 4382452897bSmatt bus_size_t offset, uint8_t *addr, bus_size_t count); 43959adf08eSdyoung 44059adf08eSdyoung #define bs_rm_2_proto(f) \ 44159adf08eSdyoung void __bs_c(f,_bs_rm_2)(void *t, bus_space_handle_t bsh, \ 4422452897bSmatt bus_size_t offset, uint16_t *addr, bus_size_t count); \ 4432452897bSmatt void __bs_c(f,_bs_rm_2_swap)(void *t, bus_space_handle_t bsh, \ 4442452897bSmatt bus_size_t offset, uint16_t *addr, bus_size_t count); 44559adf08eSdyoung 44659adf08eSdyoung #define bs_rm_4_proto(f) \ 44759adf08eSdyoung void __bs_c(f,_bs_rm_4)(void *t, bus_space_handle_t bsh, \ 4482452897bSmatt bus_size_t offset, uint32_t *addr, bus_size_t count); \ 4492452897bSmatt void __bs_c(f,_bs_rm_4_swap)(void *t, bus_space_handle_t bsh, \ 4502452897bSmatt bus_size_t offset, uint32_t *addr, bus_size_t count); 45159adf08eSdyoung 45259adf08eSdyoung #define bs_rm_8_proto(f) \ 45359adf08eSdyoung void __bs_c(f,_bs_rm_8)(void *t, bus_space_handle_t bsh, \ 4542452897bSmatt bus_size_t offset, uint64_t *addr, bus_size_t count); \ 4552452897bSmatt void __bs_c(f,_bs_rm_8_swap)(void *t, bus_space_handle_t bsh, \ 4562452897bSmatt bus_size_t offset, uint64_t *addr, bus_size_t count); 45759adf08eSdyoung 45859adf08eSdyoung #define bs_wm_1_proto(f) \ 45959adf08eSdyoung void __bs_c(f,_bs_wm_1)(void *t, bus_space_handle_t bsh, \ 4602452897bSmatt bus_size_t offset, const uint8_t *addr, bus_size_t count); \ 46159adf08eSdyoung 46259adf08eSdyoung #define bs_wm_2_proto(f) \ 46359adf08eSdyoung void __bs_c(f,_bs_wm_2)(void *t, bus_space_handle_t bsh, \ 4642452897bSmatt bus_size_t offset, const uint16_t *addr, bus_size_t count); \ 4652452897bSmatt void __bs_c(f,_bs_wm_2_swap)(void *t, bus_space_handle_t bsh, \ 4662452897bSmatt bus_size_t offset, const uint16_t *addr, bus_size_t count); 46759adf08eSdyoung 46859adf08eSdyoung #define bs_wm_4_proto(f) \ 46959adf08eSdyoung void __bs_c(f,_bs_wm_4)(void *t, bus_space_handle_t bsh, \ 4702452897bSmatt bus_size_t offset, const uint32_t *addr, bus_size_t count); \ 4712452897bSmatt void __bs_c(f,_bs_wm_4_swap)(void *t, bus_space_handle_t bsh, \ 4722452897bSmatt bus_size_t offset, const uint32_t *addr, bus_size_t count); 47359adf08eSdyoung 47459adf08eSdyoung #define bs_wm_8_proto(f) \ 47559adf08eSdyoung void __bs_c(f,_bs_wm_8)(void *t, bus_space_handle_t bsh, \ 4762452897bSmatt bus_size_t offset, const uint64_t *addr, bus_size_t count); \ 4772452897bSmatt void __bs_c(f,_bs_wm_8_swap)(void *t, bus_space_handle_t bsh, \ 4782452897bSmatt bus_size_t offset, const uint64_t *addr, bus_size_t count); 47959adf08eSdyoung 48059adf08eSdyoung #define bs_rr_1_proto(f) \ 48159adf08eSdyoung void __bs_c(f, _bs_rr_1)(void *t, bus_space_handle_t bsh, \ 4822452897bSmatt bus_size_t offset, uint8_t *addr, bus_size_t count); 48359adf08eSdyoung 48459adf08eSdyoung #define bs_rr_2_proto(f) \ 48559adf08eSdyoung void __bs_c(f, _bs_rr_2)(void *t, bus_space_handle_t bsh, \ 4862452897bSmatt bus_size_t offset, uint16_t *addr, bus_size_t count); \ 4872452897bSmatt void __bs_c(f, _bs_rr_2_swap)(void *t, bus_space_handle_t bsh, \ 4882452897bSmatt bus_size_t offset, uint16_t *addr, bus_size_t count); 48959adf08eSdyoung 49059adf08eSdyoung #define bs_rr_4_proto(f) \ 49159adf08eSdyoung void __bs_c(f, _bs_rr_4)(void *t, bus_space_handle_t bsh, \ 4922452897bSmatt bus_size_t offset, uint32_t *addr, bus_size_t count); \ 4932452897bSmatt void __bs_c(f, _bs_rr_4_swap)(void *t, bus_space_handle_t bsh, \ 4942452897bSmatt bus_size_t offset, uint32_t *addr, bus_size_t count); 49559adf08eSdyoung 49659adf08eSdyoung #define bs_rr_8_proto(f) \ 49759adf08eSdyoung void __bs_c(f, _bs_rr_8)(void *t, bus_space_handle_t bsh, \ 4982452897bSmatt bus_size_t offset, uint64_t *addr, bus_size_t count); \ 4992452897bSmatt void __bs_c(f, _bs_rr_8_swap)(void *t, bus_space_handle_t bsh, \ 5002452897bSmatt bus_size_t offset, uint64_t *addr, bus_size_t count); 50159adf08eSdyoung 50259adf08eSdyoung #define bs_wr_1_proto(f) \ 50359adf08eSdyoung void __bs_c(f, _bs_wr_1)(void *t, bus_space_handle_t bsh, \ 5042452897bSmatt bus_size_t offset, const uint8_t *addr, bus_size_t count); 50559adf08eSdyoung 50659adf08eSdyoung #define bs_wr_2_proto(f) \ 50759adf08eSdyoung void __bs_c(f, _bs_wr_2)(void *t, bus_space_handle_t bsh, \ 5082452897bSmatt bus_size_t offset, const uint16_t *addr, bus_size_t count); \ 5092452897bSmatt void __bs_c(f, _bs_wr_2_swap)(void *t, bus_space_handle_t bsh, \ 5102452897bSmatt bus_size_t offset, const uint16_t *addr, bus_size_t count); 51159adf08eSdyoung 51259adf08eSdyoung #define bs_wr_4_proto(f) \ 51359adf08eSdyoung void __bs_c(f, _bs_wr_4)(void *t, bus_space_handle_t bsh, \ 5142452897bSmatt bus_size_t offset, const uint32_t *addr, bus_size_t count); \ 5152452897bSmatt void __bs_c(f, _bs_wr_4_swap)(void *t, bus_space_handle_t bsh, \ 5162452897bSmatt bus_size_t offset, const uint32_t *addr, bus_size_t count); 51759adf08eSdyoung 51859adf08eSdyoung #define bs_wr_8_proto(f) \ 51959adf08eSdyoung void __bs_c(f, _bs_wr_8)(void *t, bus_space_handle_t bsh, \ 5202452897bSmatt bus_size_t offset, const uint64_t *addr, bus_size_t count); \ 5212452897bSmatt void __bs_c(f, _bs_wr_8_swap)(void *t, bus_space_handle_t bsh, \ 5222452897bSmatt bus_size_t offset, const uint64_t *addr, bus_size_t count); 52359adf08eSdyoung 52459adf08eSdyoung #define bs_sm_1_proto(f) \ 52559adf08eSdyoung void __bs_c(f,_bs_sm_1)(void *t, bus_space_handle_t bsh, \ 5262452897bSmatt bus_size_t offset, uint8_t value, bus_size_t count); 52759adf08eSdyoung 52859adf08eSdyoung #define bs_sm_2_proto(f) \ 52959adf08eSdyoung void __bs_c(f,_bs_sm_2)(void *t, bus_space_handle_t bsh, \ 530bef068c8Sjakllsch bus_size_t offset, uint16_t value, bus_size_t count); \ 531bef068c8Sjakllsch void __bs_c(f,_bs_sm_2_swap)(void *t, bus_space_handle_t bsh, \ 5322452897bSmatt bus_size_t offset, uint16_t value, bus_size_t count); 53359adf08eSdyoung 53459adf08eSdyoung #define bs_sm_4_proto(f) \ 53559adf08eSdyoung void __bs_c(f,_bs_sm_4)(void *t, bus_space_handle_t bsh, \ 536bef068c8Sjakllsch bus_size_t offset, uint32_t value, bus_size_t count); \ 537bef068c8Sjakllsch void __bs_c(f,_bs_sm_4_swap)(void *t, bus_space_handle_t bsh, \ 5382452897bSmatt bus_size_t offset, uint32_t value, bus_size_t count); 53959adf08eSdyoung 54059adf08eSdyoung #define bs_sm_8_proto(f) \ 54159adf08eSdyoung void __bs_c(f,_bs_sm_8)(void *t, bus_space_handle_t bsh, \ 542bef068c8Sjakllsch bus_size_t offset, uint64_t value, bus_size_t count); \ 543bef068c8Sjakllsch void __bs_c(f,_bs_sm_8_swap)(void *t, bus_space_handle_t bsh, \ 5442452897bSmatt bus_size_t offset, uint64_t value, bus_size_t count); 54559adf08eSdyoung 54659adf08eSdyoung #define bs_sr_1_proto(f) \ 54759adf08eSdyoung void __bs_c(f,_bs_sr_1)(void *t, bus_space_handle_t bsh, \ 5482452897bSmatt bus_size_t offset, uint8_t value, bus_size_t count); 54959adf08eSdyoung 55059adf08eSdyoung #define bs_sr_2_proto(f) \ 55159adf08eSdyoung void __bs_c(f,_bs_sr_2)(void *t, bus_space_handle_t bsh, \ 5522452897bSmatt bus_size_t offset, uint16_t value, bus_size_t count); \ 5532452897bSmatt void __bs_c(f,_bs_sr_2_swap)(void *t, bus_space_handle_t bsh, \ 5542452897bSmatt bus_size_t offset, uint16_t value, bus_size_t count); 55559adf08eSdyoung 55659adf08eSdyoung #define bs_sr_4_proto(f) \ 55759adf08eSdyoung void __bs_c(f,_bs_sr_4)(void *t, bus_space_handle_t bsh, \ 5582452897bSmatt bus_size_t offset, uint32_t value, bus_size_t count); \ 5592452897bSmatt void __bs_c(f,_bs_sr_4_swap)(void *t, bus_space_handle_t bsh, \ 5602452897bSmatt bus_size_t offset, uint32_t value, bus_size_t count); 56159adf08eSdyoung 56259adf08eSdyoung #define bs_sr_8_proto(f) \ 56359adf08eSdyoung void __bs_c(f,_bs_sr_8)(void *t, bus_space_handle_t bsh, \ 5642452897bSmatt bus_size_t offset, uint64_t value, bus_size_t count); \ 5652452897bSmatt void __bs_c(f,_bs_sr_8_swap)(void *t, bus_space_handle_t bsh, \ 5662452897bSmatt bus_size_t offset, uint64_t value, bus_size_t count); 56759adf08eSdyoung 56859adf08eSdyoung #define bs_c_1_proto(f) \ 56959adf08eSdyoung void __bs_c(f,_bs_c_1)(void *t, bus_space_handle_t bsh1, \ 57059adf08eSdyoung bus_size_t offset1, bus_space_handle_t bsh2, \ 57159adf08eSdyoung bus_size_t offset2, bus_size_t count); 57259adf08eSdyoung 57359adf08eSdyoung #define bs_c_2_proto(f) \ 57459adf08eSdyoung void __bs_c(f,_bs_c_2)(void *t, bus_space_handle_t bsh1, \ 57559adf08eSdyoung bus_size_t offset1, bus_space_handle_t bsh2, \ 57659adf08eSdyoung bus_size_t offset2, bus_size_t count); 57759adf08eSdyoung 57859adf08eSdyoung #define bs_c_4_proto(f) \ 57959adf08eSdyoung void __bs_c(f,_bs_c_4)(void *t, bus_space_handle_t bsh1, \ 58059adf08eSdyoung bus_size_t offset1, bus_space_handle_t bsh2, \ 58159adf08eSdyoung bus_size_t offset2, bus_size_t count); 58259adf08eSdyoung 58359adf08eSdyoung #define bs_c_8_proto(f) \ 58459adf08eSdyoung void __bs_c(f,_bs_c_8)(void *t, bus_space_handle_t bsh1, \ 58559adf08eSdyoung bus_size_t offset1, bus_space_handle_t bsh2, \ 58659adf08eSdyoung bus_size_t offset2, bus_size_t count); 58759adf08eSdyoung 588fe33aa27Sryo #define bs_pe_1_proto(f) \ 589fe33aa27Sryo int __bs_c(f,_bs_pe_1)(void *t, bus_space_handle_t bsh, \ 590fe33aa27Sryo bus_size_t offset, uint8_t *datap); 591fe33aa27Sryo 592fe33aa27Sryo #define bs_pe_2_proto(f) \ 593fe33aa27Sryo int __bs_c(f,_bs_pe_2)(void *t, bus_space_handle_t bsh, \ 594fe33aa27Sryo bus_size_t offset, uint16_t *datap); \ 595fe33aa27Sryo 596fe33aa27Sryo #define bs_pe_4_proto(f) \ 597fe33aa27Sryo int __bs_c(f,_bs_pe_4)(void *t, bus_space_handle_t bsh, \ 598fe33aa27Sryo bus_size_t offset, uint32_t *datap); \ 599fe33aa27Sryo 600fe33aa27Sryo #define bs_pe_8_proto(f) \ 601fe33aa27Sryo int __bs_c(f,_bs_pe_8)(void *t, bus_space_handle_t bsh, \ 602fe33aa27Sryo bus_size_t offset, uint64_t *datap); \ 603fe33aa27Sryo 604fe33aa27Sryo #define bs_po_1_proto(f) \ 605fe33aa27Sryo int __bs_c(f,_bs_po_1)(void *t, bus_space_handle_t bsh, \ 606fe33aa27Sryo bus_size_t offset, uint8_t value); 607fe33aa27Sryo 608fe33aa27Sryo #define bs_po_2_proto(f) \ 609fe33aa27Sryo int __bs_c(f,_bs_po_2)(void *t, bus_space_handle_t bsh, \ 610fe33aa27Sryo bus_size_t offset, uint16_t value); \ 611fe33aa27Sryo 612fe33aa27Sryo #define bs_po_4_proto(f) \ 613fe33aa27Sryo int __bs_c(f,_bs_po_4)(void *t, bus_space_handle_t bsh, \ 614fe33aa27Sryo bus_size_t offset, uint32_t value); \ 615fe33aa27Sryo 616fe33aa27Sryo #define bs_po_8_proto(f) \ 617fe33aa27Sryo int __bs_c(f,_bs_po_8)(void *t, bus_space_handle_t bsh, \ 618fe33aa27Sryo bus_size_t offset, uint64_t value); \ 619fe33aa27Sryo 620fe33aa27Sryo 62159adf08eSdyoung #define bs_protos(f) \ 62259adf08eSdyoung bs_map_proto(f); \ 62359adf08eSdyoung bs_unmap_proto(f); \ 62459adf08eSdyoung bs_subregion_proto(f); \ 62559adf08eSdyoung bs_alloc_proto(f); \ 62659adf08eSdyoung bs_free_proto(f); \ 62759adf08eSdyoung bs_vaddr_proto(f); \ 62859adf08eSdyoung bs_mmap_proto(f); \ 62959adf08eSdyoung bs_barrier_proto(f); \ 63059adf08eSdyoung bs_r_1_proto(f); \ 63159adf08eSdyoung bs_r_2_proto(f); \ 63259adf08eSdyoung bs_r_4_proto(f); \ 63359adf08eSdyoung bs_r_8_proto(f); \ 63459adf08eSdyoung bs_w_1_proto(f); \ 63559adf08eSdyoung bs_w_2_proto(f); \ 63659adf08eSdyoung bs_w_4_proto(f); \ 63759adf08eSdyoung bs_w_8_proto(f); \ 63859adf08eSdyoung bs_rm_1_proto(f); \ 63959adf08eSdyoung bs_rm_2_proto(f); \ 64059adf08eSdyoung bs_rm_4_proto(f); \ 64159adf08eSdyoung bs_rm_8_proto(f); \ 64259adf08eSdyoung bs_wm_1_proto(f); \ 64359adf08eSdyoung bs_wm_2_proto(f); \ 64459adf08eSdyoung bs_wm_4_proto(f); \ 64559adf08eSdyoung bs_wm_8_proto(f); \ 64659adf08eSdyoung bs_rr_1_proto(f); \ 64759adf08eSdyoung bs_rr_2_proto(f); \ 64859adf08eSdyoung bs_rr_4_proto(f); \ 64959adf08eSdyoung bs_rr_8_proto(f); \ 65059adf08eSdyoung bs_wr_1_proto(f); \ 65159adf08eSdyoung bs_wr_2_proto(f); \ 65259adf08eSdyoung bs_wr_4_proto(f); \ 65359adf08eSdyoung bs_wr_8_proto(f); \ 65459adf08eSdyoung bs_sm_1_proto(f); \ 65559adf08eSdyoung bs_sm_2_proto(f); \ 65659adf08eSdyoung bs_sm_4_proto(f); \ 65759adf08eSdyoung bs_sm_8_proto(f); \ 65859adf08eSdyoung bs_sr_1_proto(f); \ 65959adf08eSdyoung bs_sr_2_proto(f); \ 66059adf08eSdyoung bs_sr_4_proto(f); \ 66159adf08eSdyoung bs_sr_8_proto(f); \ 66259adf08eSdyoung bs_c_1_proto(f); \ 66359adf08eSdyoung bs_c_2_proto(f); \ 66459adf08eSdyoung bs_c_4_proto(f); \ 665fe33aa27Sryo bs_c_8_proto(f); \ 666fe33aa27Sryo bs_pe_1_proto(f); \ 667fe33aa27Sryo bs_pe_2_proto(f); \ 668fe33aa27Sryo bs_pe_4_proto(f); \ 669fe33aa27Sryo bs_pe_8_proto(f); \ 670fe33aa27Sryo bs_po_1_proto(f); \ 671fe33aa27Sryo bs_po_2_proto(f); \ 672fe33aa27Sryo bs_po_4_proto(f); \ 673fe33aa27Sryo bs_po_8_proto(f); 67459adf08eSdyoung 67559adf08eSdyoung /* Bus Space DMA macros */ 67659adf08eSdyoung 67759adf08eSdyoung /* Forwards needed by prototypes below. */ 67859adf08eSdyoung struct mbuf; 67959adf08eSdyoung struct uio; 68059adf08eSdyoung 68172d0b9e7Smaxv int bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t, 68272d0b9e7Smaxv int, bus_dmamap_t *); 68372d0b9e7Smaxv void bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); 68472d0b9e7Smaxv int bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, 68572d0b9e7Smaxv struct proc *, int); 68672d0b9e7Smaxv int bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int); 68772d0b9e7Smaxv int bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int); 68872d0b9e7Smaxv int bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *, 68972d0b9e7Smaxv int, bus_size_t, int); 69072d0b9e7Smaxv void bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t); 69172d0b9e7Smaxv void bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int); 69259adf08eSdyoung 69359adf08eSdyoung #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ 69459adf08eSdyoung (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) 69559adf08eSdyoung #define bus_dmamem_free(t, sg, n) \ 69659adf08eSdyoung (*(t)->_dmamem_free)((t), (sg), (n)) 69759adf08eSdyoung #define bus_dmamem_map(t, sg, n, s, k, f) \ 69859adf08eSdyoung (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f)) 69959adf08eSdyoung #define bus_dmamem_unmap(t, k, s) \ 70059adf08eSdyoung (*(t)->_dmamem_unmap)((t), (k), (s)) 70159adf08eSdyoung #define bus_dmamem_mmap(t, sg, n, o, p, f) \ 70259adf08eSdyoung (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) 70359adf08eSdyoung 7044710b77fSmatt #define bus_dmatag_subregion(t, mna, mxa, nt, f) \ 7054710b77fSmatt (*(t)->_dmatag_subregion)((t), (mna), (mxa), (nt), (f)) 7064710b77fSmatt #define bus_dmatag_destroy(t) \ 7074710b77fSmatt (*(t)->_dmatag_destroy)(t) 70859adf08eSdyoung 70959adf08eSdyoung #ifdef _ARM32_BUS_DMA_PRIVATE 71059adf08eSdyoung 71159adf08eSdyoung int arm32_dma_range_intersect(struct arm32_dma_range *, int, 71259adf08eSdyoung paddr_t pa, psize_t size, paddr_t *pap, psize_t *sizep); 71359adf08eSdyoung 71459adf08eSdyoung int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, 71559adf08eSdyoung bus_size_t, int, bus_dmamap_t *); 71659adf08eSdyoung void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t); 71759adf08eSdyoung int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, 71859adf08eSdyoung bus_size_t, struct proc *, int); 71959adf08eSdyoung int _bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, 72059adf08eSdyoung struct mbuf *, int); 72159adf08eSdyoung int _bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, 72259adf08eSdyoung struct uio *, int); 72359adf08eSdyoung int _bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, 72459adf08eSdyoung bus_dma_segment_t *, int, bus_size_t, int); 72559adf08eSdyoung void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t); 72659adf08eSdyoung void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, 72759adf08eSdyoung bus_size_t, int); 72859adf08eSdyoung 7291610ae54Smatt #if defined(_ARM32_NEED_BUS_DMA_BOUNCE) || defined(CPU_CORTEX) 7304710b77fSmatt #define _BUS_DMAMAP_SYNC_FUNCS \ 7314710b77fSmatt ._dmamap_sync_pre = _bus_dmamap_sync, \ 7324710b77fSmatt ._dmamap_sync_post = _bus_dmamap_sync 7334710b77fSmatt #else 7344710b77fSmatt #define _BUS_DMAMAP_SYNC_FUNCS \ 7354710b77fSmatt ._dmamap_sync_pre = _bus_dmamap_sync 7364710b77fSmatt #endif 7374710b77fSmatt 7384710b77fSmatt #define _BUS_DMAMAP_FUNCS \ 7394710b77fSmatt ._dmamap_create = _bus_dmamap_create, \ 7404710b77fSmatt ._dmamap_destroy = _bus_dmamap_destroy, \ 7414710b77fSmatt ._dmamap_load = _bus_dmamap_load, \ 7424710b77fSmatt ._dmamap_load_mbuf = _bus_dmamap_load_mbuf, \ 7434710b77fSmatt ._dmamap_load_raw = _bus_dmamap_load_raw, \ 7444710b77fSmatt ._dmamap_load_uio = _bus_dmamap_load_uio, \ 7454710b77fSmatt ._dmamap_unload = _bus_dmamap_unload, \ 7464710b77fSmatt _BUS_DMAMAP_SYNC_FUNCS 7474710b77fSmatt 74859adf08eSdyoung int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size, 74959adf08eSdyoung bus_size_t alignment, bus_size_t boundary, 75059adf08eSdyoung bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags); 75159adf08eSdyoung void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs, 75259adf08eSdyoung int nsegs); 75359adf08eSdyoung int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs, 75459adf08eSdyoung int nsegs, size_t size, void **kvap, int flags); 75559adf08eSdyoung void _bus_dmamem_unmap(bus_dma_tag_t tag, void *kva, 75659adf08eSdyoung size_t size); 75759adf08eSdyoung paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs, 75859adf08eSdyoung int nsegs, off_t off, int prot, int flags); 75959adf08eSdyoung 7604710b77fSmatt #define _BUS_DMAMEM_FUNCS \ 7614710b77fSmatt ._dmamem_alloc = _bus_dmamem_alloc, \ 7624710b77fSmatt ._dmamem_free = _bus_dmamem_free, \ 7634710b77fSmatt ._dmamem_map = _bus_dmamem_map, \ 7644710b77fSmatt ._dmamem_unmap = _bus_dmamem_unmap, \ 7654710b77fSmatt ._dmamem_mmap = _bus_dmamem_mmap 7664710b77fSmatt 76759adf08eSdyoung int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size, 76859adf08eSdyoung bus_size_t alignment, bus_size_t boundary, 76959adf08eSdyoung bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, 77070cb93c5Sskrll paddr_t low, paddr_t high); 7714710b77fSmatt 7724710b77fSmatt int _bus_dmatag_subregion(bus_dma_tag_t, bus_addr_t, bus_addr_t, 7734710b77fSmatt bus_dma_tag_t *, int); 7744710b77fSmatt void _bus_dmatag_destroy(bus_dma_tag_t); 7754710b77fSmatt 7764710b77fSmatt #define _BUS_DMATAG_FUNCS \ 7774710b77fSmatt ._dmatag_subregion = _bus_dmatag_subregion, \ 7784710b77fSmatt ._dmatag_destroy = _bus_dmatag_destroy 7794710b77fSmatt 78059adf08eSdyoung #endif /* _ARM32_BUS_DMA_PRIVATE */ 78159adf08eSdyoung 7822e13731dSmatt #endif /* _ARM_BUS_FUNCS_H_ */ 783