bus_funcs.h revision 1.3.6.1 1 1.3.6.1 perseant /* $NetBSD: bus_funcs.h,v 1.3.6.1 2025/08/02 05:56:03 perseant Exp $ */
2 1.1 skrll
3 1.1 skrll /*-
4 1.1 skrll * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
5 1.1 skrll * All rights reserved.
6 1.1 skrll *
7 1.1 skrll * This code is derived from software contributed to The NetBSD Foundation
8 1.1 skrll * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.1 skrll * NASA Ames Research Center.
10 1.1 skrll *
11 1.1 skrll * Redistribution and use in source and binary forms, with or without
12 1.1 skrll * modification, are permitted provided that the following conditions
13 1.1 skrll * are met:
14 1.1 skrll * 1. Redistributions of source code must retain the above copyright
15 1.1 skrll * notice, this list of conditions and the following disclaimer.
16 1.1 skrll * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 skrll * notice, this list of conditions and the following disclaimer in the
18 1.1 skrll * documentation and/or other materials provided with the distribution.
19 1.1 skrll *
20 1.1 skrll * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.1 skrll * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1 skrll * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1 skrll * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.1 skrll * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 skrll * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 skrll * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 skrll * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 skrll * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 skrll * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 skrll * POSSIBILITY OF SUCH DAMAGE.
31 1.1 skrll */
32 1.1 skrll
33 1.1 skrll /*
34 1.1 skrll * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
35 1.1 skrll * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
36 1.1 skrll *
37 1.1 skrll * Redistribution and use in source and binary forms, with or without
38 1.1 skrll * modification, are permitted provided that the following conditions
39 1.1 skrll * are met:
40 1.1 skrll * 1. Redistributions of source code must retain the above copyright
41 1.1 skrll * notice, this list of conditions and the following disclaimer.
42 1.1 skrll * 2. Redistributions in binary form must reproduce the above copyright
43 1.1 skrll * notice, this list of conditions and the following disclaimer in the
44 1.1 skrll * documentation and/or other materials provided with the distribution.
45 1.1 skrll * 3. All advertising materials mentioning features or use of this software
46 1.1 skrll * must display the following acknowledgement:
47 1.1 skrll * This product includes software developed by Christopher G. Demetriou
48 1.1 skrll * for the NetBSD Project.
49 1.1 skrll * 4. The name of the author may not be used to endorse or promote products
50 1.1 skrll * derived from this software without specific prior written permission
51 1.1 skrll *
52 1.1 skrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
53 1.1 skrll * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
54 1.1 skrll * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55 1.1 skrll * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
56 1.1 skrll * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
57 1.1 skrll * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58 1.1 skrll * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59 1.1 skrll * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 1.1 skrll * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
61 1.1 skrll * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 1.1 skrll */
63 1.1 skrll
64 1.1 skrll #ifndef _RISCV_BUS_FUNCS_H_
65 1.1 skrll #define _RISCV_BUS_FUNCS_H_
66 1.1 skrll
67 1.1 skrll /*
68 1.1 skrll * Utility macros; INTERNAL USE ONLY.
69 1.1 skrll */
70 1.1 skrll #define __bs_c(a,b) __CONCAT(a,b)
71 1.1 skrll #define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size)
72 1.1 skrll
73 1.1 skrll #define __bs_rs(sz, t, h, o) \
74 1.1 skrll (*(t)->__bs_opname(r,sz))(t, h, o)
75 1.1 skrll #define __bs_ws(sz, t, h, o, v) \
76 1.1 skrll (*(t)->__bs_opname(w,sz))(t, h, o, v)
77 1.1 skrll #define __bs_nonsingle(type, sz, t, h, o, a, c) \
78 1.1 skrll (*(t)->__bs_opname(type,sz))(t, h, o, a, c)
79 1.1 skrll #define __bs_set(type, sz, t, h, o, v, c) \
80 1.1 skrll (*(t)->__bs_opname(type,sz))(t, h, o, v, c)
81 1.1 skrll #define __bs_copy(sz, t, h1, o1, h2, o2, cnt) \
82 1.1 skrll (*(t)->__bs_opname(c,sz))(t, h1, o1, h2, o2, cnt)
83 1.1 skrll
84 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
85 1.1 skrll #define __bs_opname_s(op,size) __bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
86 1.1 skrll #define __bs_rs_s(sz, t, h, o) \
87 1.1 skrll (*(t)->__bs_opname_s(r,sz))(t, h, o)
88 1.1 skrll #define __bs_ws_s(sz, t, h, o, v) \
89 1.1 skrll (*(t)->__bs_opname_s(w,sz))(t, h, o, v)
90 1.1 skrll #define __bs_nonsingle_s(type, sz, t, h, o, a, c) \
91 1.1 skrll (*(t)->__bs_opname_s(type,sz))(t, h, o, a, c)
92 1.1 skrll #define __bs_set_s(type, sz, t, h, o, v, c) \
93 1.1 skrll (*(t)->__bs_opname_s(type,sz))(t, h, o, v, c)
94 1.1 skrll #define __bs_copy_s(sz, t, h1, o1, h2, o2, cnt) \
95 1.1 skrll (*(t)->__bs_opname_s(c,sz))(t, h1, o1, h2, o2, cnt)
96 1.1 skrll #endif
97 1.1 skrll
98 1.1 skrll #ifdef __BUS_SPACE_HAS_PROBING_METHODS
99 1.1 skrll #define __bs_pe(sz, t, h, o, v) \
100 1.1 skrll (*(t)->__bs_opname(pe,sz))(t, h, o, v)
101 1.1 skrll #define __bs_po(sz, t, h, o, v) \
102 1.1 skrll (*(t)->__bs_opname(po,sz))(t, h, o, v)
103 1.1 skrll #endif
104 1.1 skrll
105 1.1 skrll /*
106 1.1 skrll * Mapping and unmapping operations.
107 1.1 skrll */
108 1.1 skrll #define bus_space_map(t, a, s, c, hp) \
109 1.1 skrll (*(t)->bs_map)((t), (a), (s), (c), (hp))
110 1.1 skrll #define bus_space_unmap(t, h, s) \
111 1.1 skrll (*(t)->bs_unmap)((t), (h), (s))
112 1.1 skrll #define bus_space_subregion(t, h, o, s, hp) \
113 1.1 skrll (*(t)->bs_subregion)((t), (h), (o), (s), (hp))
114 1.1 skrll
115 1.1 skrll
116 1.1 skrll /*
117 1.1 skrll * Allocation and deallocation operations.
118 1.1 skrll */
119 1.1 skrll #define bus_space_alloc(t, rs, re, s, a, b, c, ap, hp) \
120 1.3 skrll (*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b), \
121 1.1 skrll (c), (ap), (hp))
122 1.1 skrll #define bus_space_free(t, h, s) \
123 1.3 skrll (*(t)->bs_free)((t)->bs_cookie, (h), (s))
124 1.1 skrll
125 1.1 skrll /*
126 1.1 skrll * Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR.
127 1.1 skrll */
128 1.1 skrll #define bus_space_vaddr(t, h) \
129 1.1 skrll (*(t)->bs_vaddr)((t), (h))
130 1.1 skrll
131 1.1 skrll /*
132 1.1 skrll * MMap bus space for a user application.
133 1.1 skrll */
134 1.1 skrll #define bus_space_mmap(t, a, o, p, f) \
135 1.3 skrll (*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f))
136 1.1 skrll
137 1.1 skrll /*
138 1.1 skrll * Bus barrier operations.
139 1.1 skrll */
140 1.1 skrll #define bus_space_barrier(t, h, o, l, f) \
141 1.1 skrll (*(t)->bs_barrier)((t), (h), (o), (l), (f))
142 1.1 skrll
143 1.1 skrll /*
144 1.1 skrll * Bus read (single) operations.
145 1.1 skrll */
146 1.1 skrll #define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o))
147 1.1 skrll #define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o))
148 1.1 skrll #define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o))
149 1.1 skrll #define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o))
150 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
151 1.1 skrll #define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t),(h),(o))
152 1.1 skrll #define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t),(h),(o))
153 1.1 skrll #define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t),(h),(o))
154 1.1 skrll #define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t),(h),(o))
155 1.1 skrll #endif
156 1.1 skrll
157 1.1 skrll
158 1.1 skrll /*
159 1.1 skrll * Bus read multiple operations.
160 1.1 skrll */
161 1.1 skrll #define bus_space_read_multi_1(t, h, o, a, c) \
162 1.1 skrll __bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
163 1.1 skrll #define bus_space_read_multi_2(t, h, o, a, c) \
164 1.1 skrll __bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
165 1.1 skrll #define bus_space_read_multi_4(t, h, o, a, c) \
166 1.1 skrll __bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
167 1.1 skrll #define bus_space_read_multi_8(t, h, o, a, c) \
168 1.1 skrll __bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
169 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
170 1.1 skrll #define bus_space_read_multi_stream_1(t, h, o, a, c) \
171 1.1 skrll __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
172 1.1 skrll #define bus_space_read_multi_stream_2(t, h, o, a, c) \
173 1.1 skrll __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
174 1.1 skrll #define bus_space_read_multi_stream_4(t, h, o, a, c) \
175 1.1 skrll __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
176 1.1 skrll #define bus_space_read_multi_stream_8(t, h, o, a, c) \
177 1.1 skrll __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
178 1.1 skrll #endif
179 1.1 skrll
180 1.1 skrll
181 1.1 skrll /*
182 1.1 skrll * Bus read region operations.
183 1.1 skrll */
184 1.1 skrll #define bus_space_read_region_1(t, h, o, a, c) \
185 1.1 skrll __bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
186 1.1 skrll #define bus_space_read_region_2(t, h, o, a, c) \
187 1.1 skrll __bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
188 1.1 skrll #define bus_space_read_region_4(t, h, o, a, c) \
189 1.1 skrll __bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
190 1.1 skrll #define bus_space_read_region_8(t, h, o, a, c) \
191 1.1 skrll __bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
192 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
193 1.1 skrll #define bus_space_read_region_stream_1(t, h, o, a, c) \
194 1.1 skrll __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
195 1.1 skrll #define bus_space_read_region_stream_2(t, h, o, a, c) \
196 1.1 skrll __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
197 1.1 skrll #define bus_space_read_region_stream_4(t, h, o, a, c) \
198 1.1 skrll __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
199 1.1 skrll #define bus_space_read_region_stream_8(t, h, o, a, c) \
200 1.1 skrll __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
201 1.1 skrll #endif
202 1.1 skrll
203 1.1 skrll
204 1.1 skrll /*
205 1.1 skrll * Bus write (single) operations.
206 1.1 skrll */
207 1.1 skrll #define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v))
208 1.1 skrll #define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v))
209 1.1 skrll #define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v))
210 1.1 skrll #define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v))
211 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
212 1.1 skrll #define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v))
213 1.1 skrll #define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v))
214 1.1 skrll #define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v))
215 1.1 skrll #define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v))
216 1.1 skrll #endif
217 1.1 skrll
218 1.1 skrll
219 1.1 skrll /*
220 1.1 skrll * Bus write multiple operations.
221 1.1 skrll */
222 1.1 skrll #define bus_space_write_multi_1(t, h, o, a, c) \
223 1.1 skrll __bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
224 1.1 skrll #define bus_space_write_multi_2(t, h, o, a, c) \
225 1.1 skrll __bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
226 1.1 skrll #define bus_space_write_multi_4(t, h, o, a, c) \
227 1.1 skrll __bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
228 1.1 skrll #define bus_space_write_multi_8(t, h, o, a, c) \
229 1.1 skrll __bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
230 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
231 1.1 skrll #define bus_space_write_multi_stream_1(t, h, o, a, c) \
232 1.1 skrll __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
233 1.1 skrll #define bus_space_write_multi_stream_2(t, h, o, a, c) \
234 1.1 skrll __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
235 1.1 skrll #define bus_space_write_multi_stream_4(t, h, o, a, c) \
236 1.1 skrll __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
237 1.1 skrll #define bus_space_write_multi_stream_8(t, h, o, a, c) \
238 1.1 skrll __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
239 1.1 skrll #endif
240 1.1 skrll
241 1.1 skrll
242 1.1 skrll /*
243 1.1 skrll * Bus write region operations.
244 1.1 skrll */
245 1.1 skrll #define bus_space_write_region_1(t, h, o, a, c) \
246 1.1 skrll __bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
247 1.1 skrll #define bus_space_write_region_2(t, h, o, a, c) \
248 1.1 skrll __bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
249 1.1 skrll #define bus_space_write_region_4(t, h, o, a, c) \
250 1.1 skrll __bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
251 1.1 skrll #define bus_space_write_region_8(t, h, o, a, c) \
252 1.1 skrll __bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
253 1.1 skrll #ifdef __BUS_SPACE_HAS_STREAM_METHODS
254 1.1 skrll #define bus_space_write_region_stream_1(t, h, o, a, c) \
255 1.1 skrll __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
256 1.1 skrll #define bus_space_write_region_stream_2(t, h, o, a, c) \
257 1.1 skrll __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
258 1.1 skrll #define bus_space_write_region_stream_4(t, h, o, a, c) \
259 1.1 skrll __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
260 1.1 skrll #define bus_space_write_region_stream_8(t, h, o, a, c) \
261 1.1 skrll __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
262 1.1 skrll #endif
263 1.1 skrll
264 1.1 skrll
265 1.1 skrll /*
266 1.1 skrll * Set multiple operations.
267 1.1 skrll */
268 1.1 skrll #define bus_space_set_multi_1(t, h, o, v, c) \
269 1.1 skrll __bs_set(sm,1,(t),(h),(o),(v),(c))
270 1.1 skrll #define bus_space_set_multi_2(t, h, o, v, c) \
271 1.1 skrll __bs_set(sm,2,(t),(h),(o),(v),(c))
272 1.1 skrll #define bus_space_set_multi_4(t, h, o, v, c) \
273 1.1 skrll __bs_set(sm,4,(t),(h),(o),(v),(c))
274 1.1 skrll #define bus_space_set_multi_8(t, h, o, v, c) \
275 1.1 skrll __bs_set(sm,8,(t),(h),(o),(v),(c))
276 1.1 skrll
277 1.1 skrll /*
278 1.1 skrll * Set region operations.
279 1.1 skrll */
280 1.1 skrll #define bus_space_set_region_1(t, h, o, v, c) \
281 1.1 skrll __bs_set(sr,1,(t),(h),(o),(v),(c))
282 1.1 skrll #define bus_space_set_region_2(t, h, o, v, c) \
283 1.1 skrll __bs_set(sr,2,(t),(h),(o),(v),(c))
284 1.1 skrll #define bus_space_set_region_4(t, h, o, v, c) \
285 1.1 skrll __bs_set(sr,4,(t),(h),(o),(v),(c))
286 1.1 skrll #define bus_space_set_region_8(t, h, o, v, c) \
287 1.1 skrll __bs_set(sr,8,(t),(h),(o),(v),(c))
288 1.1 skrll
289 1.1 skrll /*
290 1.1 skrll * Copy operations.
291 1.1 skrll */
292 1.3.6.1 perseant #define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \
293 1.1 skrll __bs_copy(1, t, h1, o1, h2, o2, c)
294 1.3.6.1 perseant #define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \
295 1.1 skrll __bs_copy(2, t, h1, o1, h2, o2, c)
296 1.3.6.1 perseant #define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \
297 1.1 skrll __bs_copy(4, t, h1, o1, h2, o2, c)
298 1.3.6.1 perseant #define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \
299 1.1 skrll __bs_copy(8, t, h1, o1, h2, o2, c)
300 1.1 skrll
301 1.1 skrll /*
302 1.1 skrll * Probing operations.
303 1.1 skrll */
304 1.1 skrll #ifdef __BUS_SPACE_HAS_PROBING_METHODS
305 1.1 skrll #define bus_space_peek_1(t, h, o, p) __bs_pe(1,(t),(h),(o),(p))
306 1.1 skrll #define bus_space_peek_2(t, h, o, p) __bs_pe(2,(t),(h),(o),(p))
307 1.1 skrll #define bus_space_peek_4(t, h, o, p) __bs_pe(4,(t),(h),(o),(p))
308 1.1 skrll #define bus_space_peek_8(t, h, o, p) __bs_pe(8,(t),(h),(o),(p))
309 1.1 skrll
310 1.1 skrll #define bus_space_poke_1(t, h, o, v) __bs_po(1,(t),(h),(o),(v))
311 1.1 skrll #define bus_space_poke_2(t, h, o, v) __bs_po(2,(t),(h),(o),(v))
312 1.1 skrll #define bus_space_poke_4(t, h, o, v) __bs_po(4,(t),(h),(o),(v))
313 1.1 skrll #define bus_space_poke_8(t, h, o, v) __bs_po(8,(t),(h),(o),(v))
314 1.1 skrll #endif
315 1.1 skrll
316 1.1 skrll /*
317 1.1 skrll * Macros to provide prototypes for all the functions used in the
318 1.1 skrll * bus_space structure
319 1.1 skrll */
320 1.1 skrll
321 1.1 skrll #define bs_map_proto(f) \
322 1.3.6.1 perseant int __bs_c(f,_bs_map)(void *t, bus_addr_t addr, \
323 1.1 skrll bus_size_t size, int cacheable, bus_space_handle_t *bshp);
324 1.1 skrll
325 1.1 skrll #define bs_unmap_proto(f) \
326 1.3.6.1 perseant void __bs_c(f,_bs_unmap)(void *t, bus_space_handle_t bsh, \
327 1.1 skrll bus_size_t size);
328 1.1 skrll
329 1.1 skrll #define bs_subregion_proto(f) \
330 1.1 skrll int __bs_c(f,_bs_subregion)(void *t, bus_space_handle_t bsh, \
331 1.1 skrll bus_size_t offset, bus_size_t size, \
332 1.1 skrll bus_space_handle_t *nbshp);
333 1.1 skrll
334 1.1 skrll #define bs_alloc_proto(f) \
335 1.3.6.1 perseant int __bs_c(f,_bs_alloc)(void *t, bus_addr_t rstart, \
336 1.1 skrll bus_addr_t rend, bus_size_t size, bus_size_t align, \
337 1.1 skrll bus_size_t boundary, int cacheable, bus_addr_t *addrp, \
338 1.1 skrll bus_space_handle_t *bshp);
339 1.1 skrll
340 1.1 skrll #define bs_free_proto(f) \
341 1.3.6.1 perseant void __bs_c(f,_bs_free)(void *t, bus_space_handle_t bsh, \
342 1.1 skrll bus_size_t size);
343 1.1 skrll
344 1.1 skrll #define bs_vaddr_proto(f) \
345 1.1 skrll void * __bs_c(f,_bs_vaddr)(void *t, bus_space_handle_t bsh);
346 1.1 skrll
347 1.1 skrll #define bs_mmap_proto(f) \
348 1.1 skrll paddr_t __bs_c(f,_bs_mmap)(void *, bus_addr_t, off_t, int, int);
349 1.1 skrll
350 1.1 skrll #define bs_barrier_proto(f) \
351 1.3.6.1 perseant void __bs_c(f,_bs_barrier)(void *t, bus_space_handle_t bsh, \
352 1.1 skrll bus_size_t offset, bus_size_t len, int flags);
353 1.1 skrll
354 1.1 skrll #define bs_r_1_proto(f) \
355 1.3.6.1 perseant uint8_t __bs_c(f,_bs_r_1)(void *t, bus_space_handle_t bsh, \
356 1.1 skrll bus_size_t offset);
357 1.1 skrll
358 1.1 skrll #define bs_r_2_proto(f) \
359 1.1 skrll uint16_t __bs_c(f,_bs_r_2)(void *t, bus_space_handle_t bsh, \
360 1.1 skrll bus_size_t offset); \
361 1.1 skrll uint16_t __bs_c(f,_bs_r_2_swap)(void *t, bus_space_handle_t bsh, \
362 1.1 skrll bus_size_t offset);
363 1.1 skrll
364 1.1 skrll #define bs_r_4_proto(f) \
365 1.1 skrll uint32_t __bs_c(f,_bs_r_4)(void *t, bus_space_handle_t bsh, \
366 1.1 skrll bus_size_t offset); \
367 1.1 skrll uint32_t __bs_c(f,_bs_r_4_swap)(void *t, bus_space_handle_t bsh, \
368 1.1 skrll bus_size_t offset);
369 1.1 skrll
370 1.1 skrll #define bs_r_8_proto(f) \
371 1.1 skrll uint64_t __bs_c(f,_bs_r_8)(void *t, bus_space_handle_t bsh, \
372 1.1 skrll bus_size_t offset); \
373 1.1 skrll uint64_t __bs_c(f,_bs_r_8_swap)(void *t, bus_space_handle_t bsh, \
374 1.1 skrll bus_size_t offset);
375 1.1 skrll
376 1.1 skrll #define bs_w_1_proto(f) \
377 1.1 skrll void __bs_c(f,_bs_w_1)(void *t, bus_space_handle_t bsh, \
378 1.1 skrll bus_size_t offset, uint8_t value);
379 1.1 skrll
380 1.1 skrll #define bs_w_2_proto(f) \
381 1.1 skrll void __bs_c(f,_bs_w_2)(void *t, bus_space_handle_t bsh, \
382 1.1 skrll bus_size_t offset, uint16_t value); \
383 1.1 skrll void __bs_c(f,_bs_w_2_swap)(void *t, bus_space_handle_t bsh, \
384 1.1 skrll bus_size_t offset, uint16_t value);
385 1.1 skrll
386 1.1 skrll #define bs_w_4_proto(f) \
387 1.1 skrll void __bs_c(f,_bs_w_4)(void *t, bus_space_handle_t bsh, \
388 1.1 skrll bus_size_t offset, uint32_t value); \
389 1.1 skrll void __bs_c(f,_bs_w_4_swap)(void *t, bus_space_handle_t bsh, \
390 1.1 skrll bus_size_t offset, uint32_t value);
391 1.1 skrll
392 1.1 skrll #define bs_w_8_proto(f) \
393 1.1 skrll void __bs_c(f,_bs_w_8)(void *t, bus_space_handle_t bsh, \
394 1.1 skrll bus_size_t offset, uint64_t value); \
395 1.1 skrll void __bs_c(f,_bs_w_8_swap)(void *t, bus_space_handle_t bsh, \
396 1.1 skrll bus_size_t offset, uint64_t value);
397 1.1 skrll
398 1.1 skrll #define bs_rm_1_proto(f) \
399 1.1 skrll void __bs_c(f,_bs_rm_1)(void *t, bus_space_handle_t bsh, \
400 1.1 skrll bus_size_t offset, uint8_t *addr, bus_size_t count);
401 1.1 skrll
402 1.1 skrll #define bs_rm_2_proto(f) \
403 1.1 skrll void __bs_c(f,_bs_rm_2)(void *t, bus_space_handle_t bsh, \
404 1.1 skrll bus_size_t offset, uint16_t *addr, bus_size_t count); \
405 1.1 skrll void __bs_c(f,_bs_rm_2_swap)(void *t, bus_space_handle_t bsh, \
406 1.1 skrll bus_size_t offset, uint16_t *addr, bus_size_t count);
407 1.1 skrll
408 1.1 skrll #define bs_rm_4_proto(f) \
409 1.1 skrll void __bs_c(f,_bs_rm_4)(void *t, bus_space_handle_t bsh, \
410 1.1 skrll bus_size_t offset, uint32_t *addr, bus_size_t count); \
411 1.1 skrll void __bs_c(f,_bs_rm_4_swap)(void *t, bus_space_handle_t bsh, \
412 1.1 skrll bus_size_t offset, uint32_t *addr, bus_size_t count);
413 1.1 skrll
414 1.1 skrll #define bs_rm_8_proto(f) \
415 1.1 skrll void __bs_c(f,_bs_rm_8)(void *t, bus_space_handle_t bsh, \
416 1.1 skrll bus_size_t offset, uint64_t *addr, bus_size_t count); \
417 1.1 skrll void __bs_c(f,_bs_rm_8_swap)(void *t, bus_space_handle_t bsh, \
418 1.1 skrll bus_size_t offset, uint64_t *addr, bus_size_t count);
419 1.1 skrll
420 1.1 skrll #define bs_wm_1_proto(f) \
421 1.1 skrll void __bs_c(f,_bs_wm_1)(void *t, bus_space_handle_t bsh, \
422 1.1 skrll bus_size_t offset, const uint8_t *addr, bus_size_t count); \
423 1.1 skrll
424 1.1 skrll #define bs_wm_2_proto(f) \
425 1.1 skrll void __bs_c(f,_bs_wm_2)(void *t, bus_space_handle_t bsh, \
426 1.1 skrll bus_size_t offset, const uint16_t *addr, bus_size_t count); \
427 1.1 skrll void __bs_c(f,_bs_wm_2_swap)(void *t, bus_space_handle_t bsh, \
428 1.1 skrll bus_size_t offset, const uint16_t *addr, bus_size_t count);
429 1.1 skrll
430 1.1 skrll #define bs_wm_4_proto(f) \
431 1.1 skrll void __bs_c(f,_bs_wm_4)(void *t, bus_space_handle_t bsh, \
432 1.1 skrll bus_size_t offset, const uint32_t *addr, bus_size_t count); \
433 1.1 skrll void __bs_c(f,_bs_wm_4_swap)(void *t, bus_space_handle_t bsh, \
434 1.1 skrll bus_size_t offset, const uint32_t *addr, bus_size_t count);
435 1.1 skrll
436 1.1 skrll #define bs_wm_8_proto(f) \
437 1.1 skrll void __bs_c(f,_bs_wm_8)(void *t, bus_space_handle_t bsh, \
438 1.1 skrll bus_size_t offset, const uint64_t *addr, bus_size_t count); \
439 1.1 skrll void __bs_c(f,_bs_wm_8_swap)(void *t, bus_space_handle_t bsh, \
440 1.1 skrll bus_size_t offset, const uint64_t *addr, bus_size_t count);
441 1.1 skrll
442 1.1 skrll #define bs_rr_1_proto(f) \
443 1.1 skrll void __bs_c(f, _bs_rr_1)(void *t, bus_space_handle_t bsh, \
444 1.1 skrll bus_size_t offset, uint8_t *addr, bus_size_t count);
445 1.1 skrll
446 1.1 skrll #define bs_rr_2_proto(f) \
447 1.1 skrll void __bs_c(f, _bs_rr_2)(void *t, bus_space_handle_t bsh, \
448 1.1 skrll bus_size_t offset, uint16_t *addr, bus_size_t count); \
449 1.1 skrll void __bs_c(f, _bs_rr_2_swap)(void *t, bus_space_handle_t bsh, \
450 1.1 skrll bus_size_t offset, uint16_t *addr, bus_size_t count);
451 1.1 skrll
452 1.1 skrll #define bs_rr_4_proto(f) \
453 1.1 skrll void __bs_c(f, _bs_rr_4)(void *t, bus_space_handle_t bsh, \
454 1.1 skrll bus_size_t offset, uint32_t *addr, bus_size_t count); \
455 1.1 skrll void __bs_c(f, _bs_rr_4_swap)(void *t, bus_space_handle_t bsh, \
456 1.1 skrll bus_size_t offset, uint32_t *addr, bus_size_t count);
457 1.1 skrll
458 1.1 skrll #define bs_rr_8_proto(f) \
459 1.1 skrll void __bs_c(f, _bs_rr_8)(void *t, bus_space_handle_t bsh, \
460 1.1 skrll bus_size_t offset, uint64_t *addr, bus_size_t count); \
461 1.1 skrll void __bs_c(f, _bs_rr_8_swap)(void *t, bus_space_handle_t bsh, \
462 1.1 skrll bus_size_t offset, uint64_t *addr, bus_size_t count);
463 1.1 skrll
464 1.1 skrll #define bs_wr_1_proto(f) \
465 1.1 skrll void __bs_c(f, _bs_wr_1)(void *t, bus_space_handle_t bsh, \
466 1.1 skrll bus_size_t offset, const uint8_t *addr, bus_size_t count);
467 1.1 skrll
468 1.1 skrll #define bs_wr_2_proto(f) \
469 1.1 skrll void __bs_c(f, _bs_wr_2)(void *t, bus_space_handle_t bsh, \
470 1.1 skrll bus_size_t offset, const uint16_t *addr, bus_size_t count); \
471 1.1 skrll void __bs_c(f, _bs_wr_2_swap)(void *t, bus_space_handle_t bsh, \
472 1.1 skrll bus_size_t offset, const uint16_t *addr, bus_size_t count);
473 1.1 skrll
474 1.1 skrll #define bs_wr_4_proto(f) \
475 1.1 skrll void __bs_c(f, _bs_wr_4)(void *t, bus_space_handle_t bsh, \
476 1.1 skrll bus_size_t offset, const uint32_t *addr, bus_size_t count); \
477 1.1 skrll void __bs_c(f, _bs_wr_4_swap)(void *t, bus_space_handle_t bsh, \
478 1.1 skrll bus_size_t offset, const uint32_t *addr, bus_size_t count);
479 1.1 skrll
480 1.1 skrll #define bs_wr_8_proto(f) \
481 1.1 skrll void __bs_c(f, _bs_wr_8)(void *t, bus_space_handle_t bsh, \
482 1.1 skrll bus_size_t offset, const uint64_t *addr, bus_size_t count); \
483 1.1 skrll void __bs_c(f, _bs_wr_8_swap)(void *t, bus_space_handle_t bsh, \
484 1.1 skrll bus_size_t offset, const uint64_t *addr, bus_size_t count);
485 1.1 skrll
486 1.1 skrll #define bs_sm_1_proto(f) \
487 1.1 skrll void __bs_c(f,_bs_sm_1)(void *t, bus_space_handle_t bsh, \
488 1.1 skrll bus_size_t offset, uint8_t value, bus_size_t count);
489 1.1 skrll
490 1.1 skrll #define bs_sm_2_proto(f) \
491 1.1 skrll void __bs_c(f,_bs_sm_2)(void *t, bus_space_handle_t bsh, \
492 1.1 skrll bus_size_t offset, uint16_t value, bus_size_t count); \
493 1.3.6.1 perseant void __bs_c(f,_bs_sm_2_swap)(void *t, bus_space_handle_t bsh, \
494 1.1 skrll bus_size_t offset, uint16_t value, bus_size_t count);
495 1.1 skrll
496 1.1 skrll #define bs_sm_4_proto(f) \
497 1.1 skrll void __bs_c(f,_bs_sm_4)(void *t, bus_space_handle_t bsh, \
498 1.1 skrll bus_size_t offset, uint32_t value, bus_size_t count); \
499 1.1 skrll void __bs_c(f,_bs_sm_4_swap)(void *t, bus_space_handle_t bsh, \
500 1.1 skrll bus_size_t offset, uint32_t value, bus_size_t count);
501 1.1 skrll
502 1.1 skrll #define bs_sm_8_proto(f) \
503 1.1 skrll void __bs_c(f,_bs_sm_8)(void *t, bus_space_handle_t bsh, \
504 1.1 skrll bus_size_t offset, uint64_t value, bus_size_t count); \
505 1.1 skrll void __bs_c(f,_bs_sm_8_swap)(void *t, bus_space_handle_t bsh, \
506 1.1 skrll bus_size_t offset, uint64_t value, bus_size_t count);
507 1.1 skrll
508 1.1 skrll #define bs_sr_1_proto(f) \
509 1.1 skrll void __bs_c(f,_bs_sr_1)(void *t, bus_space_handle_t bsh, \
510 1.1 skrll bus_size_t offset, uint8_t value, bus_size_t count);
511 1.1 skrll
512 1.1 skrll #define bs_sr_2_proto(f) \
513 1.1 skrll void __bs_c(f,_bs_sr_2)(void *t, bus_space_handle_t bsh, \
514 1.1 skrll bus_size_t offset, uint16_t value, bus_size_t count); \
515 1.1 skrll void __bs_c(f,_bs_sr_2_swap)(void *t, bus_space_handle_t bsh, \
516 1.1 skrll bus_size_t offset, uint16_t value, bus_size_t count);
517 1.1 skrll
518 1.1 skrll #define bs_sr_4_proto(f) \
519 1.1 skrll void __bs_c(f,_bs_sr_4)(void *t, bus_space_handle_t bsh, \
520 1.1 skrll bus_size_t offset, uint32_t value, bus_size_t count); \
521 1.1 skrll void __bs_c(f,_bs_sr_4_swap)(void *t, bus_space_handle_t bsh, \
522 1.1 skrll bus_size_t offset, uint32_t value, bus_size_t count);
523 1.1 skrll
524 1.1 skrll #define bs_sr_8_proto(f) \
525 1.1 skrll void __bs_c(f,_bs_sr_8)(void *t, bus_space_handle_t bsh, \
526 1.1 skrll bus_size_t offset, uint64_t value, bus_size_t count); \
527 1.1 skrll void __bs_c(f,_bs_sr_8_swap)(void *t, bus_space_handle_t bsh, \
528 1.1 skrll bus_size_t offset, uint64_t value, bus_size_t count);
529 1.1 skrll
530 1.1 skrll #define bs_c_1_proto(f) \
531 1.1 skrll void __bs_c(f,_bs_c_1)(void *t, bus_space_handle_t bsh1, \
532 1.1 skrll bus_size_t offset1, bus_space_handle_t bsh2, \
533 1.1 skrll bus_size_t offset2, bus_size_t count);
534 1.1 skrll
535 1.1 skrll #define bs_c_2_proto(f) \
536 1.1 skrll void __bs_c(f,_bs_c_2)(void *t, bus_space_handle_t bsh1, \
537 1.1 skrll bus_size_t offset1, bus_space_handle_t bsh2, \
538 1.1 skrll bus_size_t offset2, bus_size_t count);
539 1.1 skrll
540 1.1 skrll #define bs_c_4_proto(f) \
541 1.1 skrll void __bs_c(f,_bs_c_4)(void *t, bus_space_handle_t bsh1, \
542 1.1 skrll bus_size_t offset1, bus_space_handle_t bsh2, \
543 1.1 skrll bus_size_t offset2, bus_size_t count);
544 1.1 skrll
545 1.1 skrll #define bs_c_8_proto(f) \
546 1.1 skrll void __bs_c(f,_bs_c_8)(void *t, bus_space_handle_t bsh1, \
547 1.1 skrll bus_size_t offset1, bus_space_handle_t bsh2, \
548 1.1 skrll bus_size_t offset2, bus_size_t count);
549 1.1 skrll
550 1.1 skrll #define bs_pe_1_proto(f) \
551 1.1 skrll int __bs_c(f,_bs_pe_1)(void *t, bus_space_handle_t bsh, \
552 1.1 skrll bus_size_t offset, uint8_t *datap);
553 1.1 skrll
554 1.1 skrll #define bs_pe_2_proto(f) \
555 1.1 skrll int __bs_c(f,_bs_pe_2)(void *t, bus_space_handle_t bsh, \
556 1.1 skrll bus_size_t offset, uint16_t *datap); \
557 1.1 skrll
558 1.1 skrll #define bs_pe_4_proto(f) \
559 1.1 skrll int __bs_c(f,_bs_pe_4)(void *t, bus_space_handle_t bsh, \
560 1.1 skrll bus_size_t offset, uint32_t *datap); \
561 1.1 skrll
562 1.1 skrll #define bs_pe_8_proto(f) \
563 1.1 skrll int __bs_c(f,_bs_pe_8)(void *t, bus_space_handle_t bsh, \
564 1.1 skrll bus_size_t offset, uint64_t *datap); \
565 1.1 skrll
566 1.1 skrll #define bs_po_1_proto(f) \
567 1.1 skrll int __bs_c(f,_bs_po_1)(void *t, bus_space_handle_t bsh, \
568 1.1 skrll bus_size_t offset, uint8_t value);
569 1.1 skrll
570 1.1 skrll #define bs_po_2_proto(f) \
571 1.1 skrll int __bs_c(f,_bs_po_2)(void *t, bus_space_handle_t bsh, \
572 1.1 skrll bus_size_t offset, uint16_t value); \
573 1.1 skrll
574 1.1 skrll #define bs_po_4_proto(f) \
575 1.1 skrll int __bs_c(f,_bs_po_4)(void *t, bus_space_handle_t bsh, \
576 1.1 skrll bus_size_t offset, uint32_t value); \
577 1.1 skrll
578 1.1 skrll #define bs_po_8_proto(f) \
579 1.1 skrll int __bs_c(f,_bs_po_8)(void *t, bus_space_handle_t bsh, \
580 1.1 skrll bus_size_t offset, uint64_t value); \
581 1.1 skrll
582 1.1 skrll
583 1.1 skrll #define bs_protos(f) \
584 1.1 skrll bs_map_proto(f); \
585 1.1 skrll bs_unmap_proto(f); \
586 1.1 skrll bs_subregion_proto(f); \
587 1.1 skrll bs_alloc_proto(f); \
588 1.1 skrll bs_free_proto(f); \
589 1.1 skrll bs_vaddr_proto(f); \
590 1.1 skrll bs_mmap_proto(f); \
591 1.1 skrll bs_barrier_proto(f); \
592 1.1 skrll bs_r_1_proto(f); \
593 1.1 skrll bs_r_2_proto(f); \
594 1.1 skrll bs_r_4_proto(f); \
595 1.1 skrll bs_r_8_proto(f); \
596 1.1 skrll bs_w_1_proto(f); \
597 1.1 skrll bs_w_2_proto(f); \
598 1.1 skrll bs_w_4_proto(f); \
599 1.1 skrll bs_w_8_proto(f); \
600 1.1 skrll bs_rm_1_proto(f); \
601 1.1 skrll bs_rm_2_proto(f); \
602 1.1 skrll bs_rm_4_proto(f); \
603 1.1 skrll bs_rm_8_proto(f); \
604 1.1 skrll bs_wm_1_proto(f); \
605 1.1 skrll bs_wm_2_proto(f); \
606 1.1 skrll bs_wm_4_proto(f); \
607 1.1 skrll bs_wm_8_proto(f); \
608 1.1 skrll bs_rr_1_proto(f); \
609 1.1 skrll bs_rr_2_proto(f); \
610 1.1 skrll bs_rr_4_proto(f); \
611 1.1 skrll bs_rr_8_proto(f); \
612 1.1 skrll bs_wr_1_proto(f); \
613 1.1 skrll bs_wr_2_proto(f); \
614 1.1 skrll bs_wr_4_proto(f); \
615 1.1 skrll bs_wr_8_proto(f); \
616 1.1 skrll bs_sm_1_proto(f); \
617 1.1 skrll bs_sm_2_proto(f); \
618 1.1 skrll bs_sm_4_proto(f); \
619 1.1 skrll bs_sm_8_proto(f); \
620 1.1 skrll bs_sr_1_proto(f); \
621 1.1 skrll bs_sr_2_proto(f); \
622 1.1 skrll bs_sr_4_proto(f); \
623 1.1 skrll bs_sr_8_proto(f); \
624 1.1 skrll bs_c_1_proto(f); \
625 1.1 skrll bs_c_2_proto(f); \
626 1.1 skrll bs_c_4_proto(f); \
627 1.1 skrll bs_c_8_proto(f); \
628 1.1 skrll bs_pe_1_proto(f); \
629 1.1 skrll bs_pe_2_proto(f); \
630 1.1 skrll bs_pe_4_proto(f); \
631 1.1 skrll bs_pe_8_proto(f); \
632 1.1 skrll bs_po_1_proto(f); \
633 1.1 skrll bs_po_2_proto(f); \
634 1.1 skrll bs_po_4_proto(f); \
635 1.1 skrll bs_po_8_proto(f);
636 1.1 skrll
637 1.1 skrll /* Bus Space DMA macros */
638 1.1 skrll
639 1.1 skrll /* Forwards needed by prototypes below. */
640 1.1 skrll struct mbuf;
641 1.1 skrll struct uio;
642 1.1 skrll
643 1.1 skrll int bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t, bus_size_t,
644 1.1 skrll int, bus_dmamap_t *);
645 1.1 skrll void bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
646 1.1 skrll int bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
647 1.1 skrll struct proc *, int);
648 1.1 skrll int bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *, int);
649 1.1 skrll int bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *, int);
650 1.1 skrll int bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *,
651 1.1 skrll int, bus_size_t, int);
652 1.1 skrll void bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
653 1.1 skrll void bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t, bus_size_t, int);
654 1.1 skrll
655 1.1 skrll #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
656 1.1 skrll (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
657 1.1 skrll #define bus_dmamem_free(t, sg, n) \
658 1.1 skrll (*(t)->_dmamem_free)((t), (sg), (n))
659 1.1 skrll #define bus_dmamem_map(t, sg, n, s, k, f) \
660 1.1 skrll (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
661 1.1 skrll #define bus_dmamem_unmap(t, k, s) \
662 1.1 skrll (*(t)->_dmamem_unmap)((t), (k), (s))
663 1.1 skrll #define bus_dmamem_mmap(t, sg, n, o, p, f) \
664 1.1 skrll (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
665 1.1 skrll
666 1.1 skrll #define bus_dmatag_subregion(t, mna, mxa, nt, f) \
667 1.1 skrll (*(t)->_dmatag_subregion)((t), (mna), (mxa), (nt), (f))
668 1.1 skrll #define bus_dmatag_destroy(t) \
669 1.1 skrll (*(t)->_dmatag_destroy)(t)
670 1.1 skrll
671 1.1 skrll #ifdef _RISCV_BUS_DMA_PRIVATE
672 1.1 skrll
673 1.1 skrll int riscv_dma_range_intersect(struct riscv_dma_range *, int,
674 1.1 skrll paddr_t pa, psize_t size, paddr_t *pap, psize_t *sizep);
675 1.1 skrll
676 1.1 skrll int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
677 1.1 skrll bus_size_t, int, bus_dmamap_t *);
678 1.1 skrll void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
679 1.1 skrll int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
680 1.1 skrll bus_size_t, struct proc *, int);
681 1.1 skrll int _bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
682 1.1 skrll struct mbuf *, int);
683 1.1 skrll int _bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
684 1.1 skrll struct uio *, int);
685 1.1 skrll int _bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
686 1.1 skrll bus_dma_segment_t *, int, bus_size_t, int);
687 1.1 skrll void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
688 1.1 skrll void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
689 1.1 skrll bus_size_t, int);
690 1.1 skrll
691 1.1 skrll #define _BUS_DMAMAP_FUNCS \
692 1.1 skrll ._dmamap_create = _bus_dmamap_create, \
693 1.1 skrll ._dmamap_destroy = _bus_dmamap_destroy, \
694 1.1 skrll ._dmamap_load = _bus_dmamap_load, \
695 1.1 skrll ._dmamap_load_mbuf = _bus_dmamap_load_mbuf, \
696 1.1 skrll ._dmamap_load_raw = _bus_dmamap_load_raw, \
697 1.1 skrll ._dmamap_load_uio = _bus_dmamap_load_uio, \
698 1.1 skrll ._dmamap_unload = _bus_dmamap_unload, \
699 1.1 skrll ._dmamap_sync = _bus_dmamap_sync
700 1.1 skrll
701 1.1 skrll int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
702 1.1 skrll bus_size_t alignment, bus_size_t boundary,
703 1.1 skrll bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
704 1.1 skrll void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
705 1.1 skrll int nsegs);
706 1.1 skrll int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
707 1.1 skrll int nsegs, size_t size, void **kvap, int flags);
708 1.1 skrll void _bus_dmamem_unmap(bus_dma_tag_t tag, void *kva,
709 1.1 skrll size_t size);
710 1.1 skrll paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
711 1.1 skrll int nsegs, off_t off, int prot, int flags);
712 1.1 skrll
713 1.1 skrll #define _BUS_DMAMEM_FUNCS \
714 1.1 skrll ._dmamem_alloc = _bus_dmamem_alloc, \
715 1.1 skrll ._dmamem_free = _bus_dmamem_free, \
716 1.1 skrll ._dmamem_map = _bus_dmamem_map, \
717 1.1 skrll ._dmamem_unmap = _bus_dmamem_unmap, \
718 1.1 skrll ._dmamem_mmap = _bus_dmamem_mmap
719 1.1 skrll
720 1.1 skrll int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
721 1.1 skrll bus_size_t alignment, bus_size_t boundary,
722 1.1 skrll bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
723 1.2 skrll paddr_t low, paddr_t high);
724 1.1 skrll
725 1.1 skrll int _bus_dmatag_subregion(bus_dma_tag_t, bus_addr_t, bus_addr_t,
726 1.1 skrll bus_dma_tag_t *, int);
727 1.1 skrll void _bus_dmatag_destroy(bus_dma_tag_t);
728 1.1 skrll
729 1.1 skrll #define _BUS_DMATAG_FUNCS \
730 1.1 skrll ._dmatag_subregion = _bus_dmatag_subregion, \
731 1.1 skrll ._dmatag_destroy = _bus_dmatag_destroy
732 1.1 skrll
733 1.1 skrll #endif /* _RISCV_BUS_DMA_PRIVATE */
734 1.1 skrll
735 1.1 skrll #endif /* _RISCV_BUS_FUNCS_H_ */
736