bus_funcs.h revision 1.1 1 1.1 dyoung /* $NetBSD: bus_funcs.h,v 1.1 2011/07/01 17:10:01 dyoung Exp $ */
2 1.1 dyoung
3 1.1 dyoung /*-
4 1.1 dyoung * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
5 1.1 dyoung * All rights reserved.
6 1.1 dyoung *
7 1.1 dyoung * This code is derived from software contributed to The NetBSD Foundation
8 1.1 dyoung * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.1 dyoung * NASA Ames Research Center.
10 1.1 dyoung *
11 1.1 dyoung * Redistribution and use in source and binary forms, with or without
12 1.1 dyoung * modification, are permitted provided that the following conditions
13 1.1 dyoung * are met:
14 1.1 dyoung * 1. Redistributions of source code must retain the above copyright
15 1.1 dyoung * notice, this list of conditions and the following disclaimer.
16 1.1 dyoung * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 dyoung * notice, this list of conditions and the following disclaimer in the
18 1.1 dyoung * documentation and/or other materials provided with the distribution.
19 1.1 dyoung *
20 1.1 dyoung * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.1 dyoung * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1 dyoung * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1 dyoung * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.1 dyoung * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 dyoung * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 dyoung * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 dyoung * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 dyoung * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 dyoung * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 dyoung * POSSIBILITY OF SUCH DAMAGE.
31 1.1 dyoung */
32 1.1 dyoung
33 1.1 dyoung /*
34 1.1 dyoung * Copyright (c) 1997-1999, 2001 Eduardo E. Horvath. All rights reserved.
35 1.1 dyoung * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
36 1.1 dyoung * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
37 1.1 dyoung *
38 1.1 dyoung * Redistribution and use in source and binary forms, with or without
39 1.1 dyoung * modification, are permitted provided that the following conditions
40 1.1 dyoung * are met:
41 1.1 dyoung * 1. Redistributions of source code must retain the above copyright
42 1.1 dyoung * notice, this list of conditions and the following disclaimer.
43 1.1 dyoung * 2. Redistributions in binary form must reproduce the above copyright
44 1.1 dyoung * notice, this list of conditions and the following disclaimer in the
45 1.1 dyoung * documentation and/or other materials provided with the distribution.
46 1.1 dyoung * 3. All advertising materials mentioning features or use of this software
47 1.1 dyoung * must display the following acknowledgement:
48 1.1 dyoung * This product includes software developed by Christopher G. Demetriou
49 1.1 dyoung * for the NetBSD Project.
50 1.1 dyoung * 4. The name of the author may not be used to endorse or promote products
51 1.1 dyoung * derived from this software without specific prior written permission
52 1.1 dyoung *
53 1.1 dyoung * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
54 1.1 dyoung * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
55 1.1 dyoung * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
56 1.1 dyoung * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
57 1.1 dyoung * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58 1.1 dyoung * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 1.1 dyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 1.1 dyoung * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 1.1 dyoung * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62 1.1 dyoung * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 1.1 dyoung */
64 1.1 dyoung
65 1.1 dyoung #ifndef _SPARC_BUS_FUNCS_H_
66 1.1 dyoung #define _SPARC_BUS_FUNCS_H_
67 1.1 dyoung
68 1.1 dyoung /*
69 1.1 dyoung * Debug hooks
70 1.1 dyoung */
71 1.1 dyoung
72 1.1 dyoung extern int bus_space_debug;
73 1.1 dyoung
74 1.1 dyoung bus_space_tag_t bus_space_tag_alloc(bus_space_tag_t, void *);
75 1.1 dyoung int bus_space_translate_address_generic(struct openprom_range *,
76 1.1 dyoung int, bus_addr_t *);
77 1.1 dyoung
78 1.1 dyoung #if 0
79 1.1 dyoung /*
80 1.1 dyoung * The following macro could be used to generate the bus_space*() functions
81 1.1 dyoung * but it uses a gcc extension and is ANSI-only.
82 1.1 dyoung #define PROTO_bus_space_xxx (bus_space_tag_t t, ...)
83 1.1 dyoung #define RETURNTYPE_bus_space_xxx void *
84 1.1 dyoung #define BUSFUN(name, returntype, t, args...) \
85 1.1 dyoung static __inline RETURNTYPE_##name \
86 1.1 dyoung bus_##name PROTO_##name \
87 1.1 dyoung { \
88 1.1 dyoung while (t->sparc_##name == NULL) \
89 1.1 dyoung t = t->parent; \
90 1.1 dyoung return (*(t)->sparc_##name)(t, args); \
91 1.1 dyoung }
92 1.1 dyoung */
93 1.1 dyoung #endif
94 1.1 dyoung
95 1.1 dyoung /*
96 1.1 dyoung * Bus space function prototypes.
97 1.1 dyoung */
98 1.1 dyoung static void *bus_intr_establish(
99 1.1 dyoung bus_space_tag_t,
100 1.1 dyoung int, /*bus-specific intr*/
101 1.1 dyoung int, /*device class level,
102 1.1 dyoung see machine/intr.h*/
103 1.1 dyoung int (*)(void *), /*handler*/
104 1.1 dyoung void *); /*handler arg*/
105 1.1 dyoung
106 1.1 dyoung
107 1.1 dyoung /* This macro finds the first "upstream" implementation of method `f' */
108 1.1 dyoung #define _BS_CALL(t,f) \
109 1.1 dyoung while (t->f == NULL) \
110 1.1 dyoung t = t->parent; \
111 1.1 dyoung return (*(t)->f)
112 1.1 dyoung
113 1.1 dyoung #define _BS_VOID_CALL(t,f) \
114 1.1 dyoung while (t->f == NULL) \
115 1.1 dyoung t = t->parent; \
116 1.1 dyoung (*(t)->f)
117 1.1 dyoung
118 1.1 dyoung static __inline void *
119 1.1 dyoung bus_intr_establish(bus_space_tag_t t, int p, int l, int (*h)(void *), void *a)
120 1.1 dyoung {
121 1.1 dyoung _BS_CALL(t, sparc_intr_establish)(t, p, l, h, a, NULL);
122 1.1 dyoung }
123 1.1 dyoung
124 1.1 dyoung /* XXXX Things get complicated if we use unmapped register accesses. */
125 1.1 dyoung #define bus_space_vaddr(t, h) (PHYS_ASI((h)._asi) ? \
126 1.1 dyoung NULL : (void *)(vaddr_t)((h)._ptr))
127 1.1 dyoung
128 1.1 dyoung /*
129 1.1 dyoung * uintN_t bus_space_read_N(bus_space_tag_t tag,
130 1.1 dyoung * bus_space_handle_t bsh, bus_size_t offset);
131 1.1 dyoung *
132 1.1 dyoung * Read a 1, 2, 4, or 8 byte quantity from bus space
133 1.1 dyoung * described by tag/handle/offset.
134 1.1 dyoung */
135 1.1 dyoung #ifndef BUS_SPACE_DEBUG
136 1.1 dyoung #define bus_space_read_1(t, h, o) \
137 1.1 dyoung (0 ? (t)->type : lduba((h)._ptr + (o), (h)._asi))
138 1.1 dyoung
139 1.1 dyoung #define bus_space_read_2(t, h, o) \
140 1.1 dyoung (0 ? (t)->type : lduha((h)._ptr + (o), (h)._asi))
141 1.1 dyoung
142 1.1 dyoung #define bus_space_read_4(t, h, o) \
143 1.1 dyoung (0 ? (t)->type : lda((h)._ptr + (o), (h)._asi))
144 1.1 dyoung
145 1.1 dyoung #define bus_space_read_8(t, h, o) \
146 1.1 dyoung (0 ? (t)->type : ldxa((h)._ptr + (o), (h)._asi))
147 1.1 dyoung #else
148 1.1 dyoung #define bus_space_read_1(t, h, o) ({ \
149 1.1 dyoung uint8_t __bv = \
150 1.1 dyoung lduba((h)._ptr + (o), (h)._asi); \
151 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
152 1.1 dyoung printf("bsr1(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
153 1.1 dyoung (long long)(o), \
154 1.1 dyoung (h)._asi, (uint32_t) __bv); \
155 1.1 dyoung __bv; })
156 1.1 dyoung
157 1.1 dyoung #define bus_space_read_2(t, h, o) ({ \
158 1.1 dyoung uint16_t __bv = \
159 1.1 dyoung lduha((h)._ptr + (o), (h)._asi); \
160 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
161 1.1 dyoung printf("bsr2(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
162 1.1 dyoung (long long)(o), \
163 1.1 dyoung (h)._asi, (uint32_t)__bv); \
164 1.1 dyoung __bv; })
165 1.1 dyoung
166 1.1 dyoung #define bus_space_read_4(t, h, o) ({ \
167 1.1 dyoung uint32_t __bv = \
168 1.1 dyoung lda((h)._ptr + (o), (h)._asi); \
169 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
170 1.1 dyoung printf("bsr4(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
171 1.1 dyoung (long long)(o), \
172 1.1 dyoung (h)._asi, __bv); \
173 1.1 dyoung __bv; })
174 1.1 dyoung
175 1.1 dyoung #define bus_space_read_8(t, h, o) ({ \
176 1.1 dyoung uint64_t __bv = \
177 1.1 dyoung ldxa((h)._ptr + (o), (h)._asi); \
178 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
179 1.1 dyoung printf("bsr8(%llx + %llx, %x) -> %llx\n", (long long)(h)._ptr, \
180 1.1 dyoung (long long)(o), \
181 1.1 dyoung (h)._asi, (long long)__bv); \
182 1.1 dyoung __bv; })
183 1.1 dyoung #endif
184 1.1 dyoung /*
185 1.1 dyoung * void bus_space_write_N(bus_space_tag_t tag,
186 1.1 dyoung * bus_space_handle_t bsh, bus_size_t offset,
187 1.1 dyoung * uintN_t value);
188 1.1 dyoung *
189 1.1 dyoung * Write the 1, 2, 4, or 8 byte value `value' to bus space
190 1.1 dyoung * described by tag/handle/offset.
191 1.1 dyoung */
192 1.1 dyoung #ifndef BUS_SPACE_DEBUG
193 1.1 dyoung #define bus_space_write_1(t, h, o, v) \
194 1.1 dyoung (0 ? (t)->type : ((void)(stba((h)._ptr + (o), (h)._asi, (v)))))
195 1.1 dyoung
196 1.1 dyoung #define bus_space_write_2(t, h, o, v) \
197 1.1 dyoung (0 ? (t)->type : ((void)(stha((h)._ptr + (o), (h)._asi, (v)))))
198 1.1 dyoung
199 1.1 dyoung #define bus_space_write_4(t, h, o, v) \
200 1.1 dyoung (0 ? (t)->type : ((void)(sta((h)._ptr + (o), (h)._asi, (v)))))
201 1.1 dyoung
202 1.1 dyoung #define bus_space_write_8(t, h, o, v) \
203 1.1 dyoung (0 ? (t)->type : ((void)(stxa((h)._ptr + (o), (h)._asi, (v)))))
204 1.1 dyoung #else
205 1.1 dyoung #define bus_space_write_1(t, h, o, v) ({ \
206 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
207 1.1 dyoung printf("bsw1(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
208 1.1 dyoung (long long)(o), \
209 1.1 dyoung (h)._asi, (uint32_t) v); \
210 1.1 dyoung ((void)(stba((h)._ptr + (o), (h)._asi, (v)))); })
211 1.1 dyoung
212 1.1 dyoung #define bus_space_write_2(t, h, o, v) ({ \
213 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
214 1.1 dyoung printf("bsw2(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
215 1.1 dyoung (long long)(o), \
216 1.1 dyoung (h)._asi, (uint32_t) v); \
217 1.1 dyoung ((void)(stha((h)._ptr + (o), (h)._asi, (v)))); })
218 1.1 dyoung
219 1.1 dyoung #define bus_space_write_4(t, h, o, v) ({ \
220 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
221 1.1 dyoung printf("bsw4(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
222 1.1 dyoung (long long)(o), \
223 1.1 dyoung (h)._asi, (uint32_t) v); \
224 1.1 dyoung ((void)(sta((h)._ptr + (o), (h)._asi, (v)))); })
225 1.1 dyoung
226 1.1 dyoung #define bus_space_write_8(t, h, o, v) ({ \
227 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
228 1.1 dyoung printf("bsw8(%llx + %llx, %x) <- %llx\n", (long long)(h)._ptr, \
229 1.1 dyoung (long long)(o), \
230 1.1 dyoung (h)._asi, (long long) v); \
231 1.1 dyoung ((void)(stxa((h)._ptr + (o), (h)._asi, (v)))); })
232 1.1 dyoung #endif
233 1.1 dyoung /*
234 1.1 dyoung * uintN_t bus_space_read_stream_N(bus_space_tag_t tag,
235 1.1 dyoung * bus_space_handle_t bsh, bus_size_t offset);
236 1.1 dyoung *
237 1.1 dyoung * Read a 1, 2, 4, or 8 byte quantity from bus space
238 1.1 dyoung * described by tag/handle/offset.
239 1.1 dyoung */
240 1.1 dyoung #ifndef BUS_SPACE_DEBUG
241 1.1 dyoung #define bus_space_read_stream_1(t, h, o) \
242 1.1 dyoung (0 ? (t)->type : lduba((h)._ptr + (o), (h)._sasi))
243 1.1 dyoung
244 1.1 dyoung #define bus_space_read_stream_2(t, h, o) \
245 1.1 dyoung (0 ? (t)->type : lduha((h)._ptr + (o), (h)._sasi))
246 1.1 dyoung
247 1.1 dyoung #define bus_space_read_stream_4(t, h, o) \
248 1.1 dyoung (0 ? (t)->type : lda((h)._ptr + (o), (h)._sasi))
249 1.1 dyoung
250 1.1 dyoung #define bus_space_read_stream_8(t, h, o) \
251 1.1 dyoung (0 ? (t)->type : ldxa((h)._ptr + (o), (h)._sasi))
252 1.1 dyoung #else
253 1.1 dyoung #define bus_space_read_stream_1(t, h, o) ({ \
254 1.1 dyoung uint8_t __bv = \
255 1.1 dyoung lduba((h)._ptr + (o), (h)._sasi); \
256 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
257 1.1 dyoung printf("bsr1(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
258 1.1 dyoung (long long)(o), \
259 1.1 dyoung (h)._sasi, (uint32_t) __bv); \
260 1.1 dyoung __bv; })
261 1.1 dyoung
262 1.1 dyoung #define bus_space_read_stream_2(t, h, o) ({ \
263 1.1 dyoung uint16_t __bv = \
264 1.1 dyoung lduha((h)._ptr + (o), (h)._sasi); \
265 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
266 1.1 dyoung printf("bsr2(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
267 1.1 dyoung (long long)(o), \
268 1.1 dyoung (h)._sasi, (uint32_t)__bv); \
269 1.1 dyoung __bv; })
270 1.1 dyoung
271 1.1 dyoung #define bus_space_read_stream_4(t, h, o) ({ \
272 1.1 dyoung uint32_t __bv = \
273 1.1 dyoung lda((h)._ptr + (o), (h)._sasi); \
274 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
275 1.1 dyoung printf("bsr4(%llx + %llx, %x) -> %x\n", (long long)(h)._ptr, \
276 1.1 dyoung (long long)(o), \
277 1.1 dyoung (h)._sasi, __bv); \
278 1.1 dyoung __bv; })
279 1.1 dyoung
280 1.1 dyoung #define bus_space_read_stream_8(t, h, o) ({ \
281 1.1 dyoung uint64_t __bv = \
282 1.1 dyoung ldxa((h)._ptr + (o), (h)._sasi); \
283 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
284 1.1 dyoung printf("bsr8(%llx + %llx, %x) -> %llx\n", (long long)(h)._ptr, \
285 1.1 dyoung (long long)(o), \
286 1.1 dyoung (h)._sasi, (long long)__bv); \
287 1.1 dyoung __bv; })
288 1.1 dyoung #endif
289 1.1 dyoung /*
290 1.1 dyoung * void bus_space_write_stream_N(bus_space_tag_t tag,
291 1.1 dyoung * bus_space_handle_t bsh, bus_size_t offset,
292 1.1 dyoung * uintN_t value);
293 1.1 dyoung *
294 1.1 dyoung * Write the 1, 2, 4, or 8 byte value `value' to bus space
295 1.1 dyoung * described by tag/handle/offset.
296 1.1 dyoung */
297 1.1 dyoung #ifndef BUS_SPACE_DEBUG
298 1.1 dyoung #define bus_space_write_stream_1(t, h, o, v) \
299 1.1 dyoung (0 ? (t)->type : ((void)(stba((h)._ptr + (o), (h)._sasi, (v)))))
300 1.1 dyoung
301 1.1 dyoung #define bus_space_write_stream_2(t, h, o, v) \
302 1.1 dyoung (0 ? (t)->type : ((void)(stha((h)._ptr + (o), (h)._sasi, (v)))))
303 1.1 dyoung
304 1.1 dyoung #define bus_space_write_stream_4(t, h, o, v) \
305 1.1 dyoung (0 ? (t)->type : ((void)(sta((h)._ptr + (o), (h)._sasi, (v)))))
306 1.1 dyoung
307 1.1 dyoung #define bus_space_write_stream_8(t, h, o, v) \
308 1.1 dyoung (0 ? (t)->type : ((void)(stxa((h)._ptr + (o), (h)._sasi, (v)))))
309 1.1 dyoung #else
310 1.1 dyoung #define bus_space_write_stream_1(t, h, o, v) ({ \
311 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
312 1.1 dyoung printf("bsw1(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
313 1.1 dyoung (long long)(o), \
314 1.1 dyoung (h)._sasi, (uint32_t) v); \
315 1.1 dyoung ((void)(stba((h)._ptr + (o), (h)._sasi, (v)))); })
316 1.1 dyoung
317 1.1 dyoung #define bus_space_write_stream_2(t, h, o, v) ({ \
318 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
319 1.1 dyoung printf("bsw2(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
320 1.1 dyoung (long long)(o), \
321 1.1 dyoung (h)._sasi, (uint32_t) v); \
322 1.1 dyoung ((void)(stha((h)._ptr + (o), (h)._sasi, (v)))); })
323 1.1 dyoung
324 1.1 dyoung #define bus_space_write_stream_4(t, h, o, v) ({ \
325 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
326 1.1 dyoung printf("bsw4(%llx + %llx, %x) <- %x\n", (long long)(h)._ptr, \
327 1.1 dyoung (long long)(o), \
328 1.1 dyoung (h)._sasi, (uint32_t) v); \
329 1.1 dyoung ((void)(sta((h)._ptr + (o), (h)._sasi, (v)))); })
330 1.1 dyoung
331 1.1 dyoung #define bus_space_write_stream_8(t, h, o, v) ({ \
332 1.1 dyoung if (bus_space_debug & BSDB_ACCESS) \
333 1.1 dyoung printf("bsw8(%llx + %llx, %x) <- %llx\n", (long long)(h)._ptr, \
334 1.1 dyoung (long long)(o), \
335 1.1 dyoung (h)._sasi, (long long) v); \
336 1.1 dyoung ((void)(stxa((h)._ptr + (o), (h)._sasi, (v)))); })
337 1.1 dyoung #endif
338 1.1 dyoung /* Forwards needed by prototypes below. */
339 1.1 dyoung struct mbuf;
340 1.1 dyoung struct uio;
341 1.1 dyoung
342 1.1 dyoung #define bus_dmamap_create(t, s, n, m, b, f, p) \
343 1.1 dyoung (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
344 1.1 dyoung #define bus_dmamap_destroy(t, p) \
345 1.1 dyoung (*(t)->_dmamap_destroy)((t), (p))
346 1.1 dyoung #define bus_dmamap_load(t, m, b, s, p, f) \
347 1.1 dyoung (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
348 1.1 dyoung #define bus_dmamap_load_mbuf(t, m, b, f) \
349 1.1 dyoung (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
350 1.1 dyoung #define bus_dmamap_load_uio(t, m, u, f) \
351 1.1 dyoung (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
352 1.1 dyoung #define bus_dmamap_load_raw(t, m, sg, n, s, f) \
353 1.1 dyoung (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
354 1.1 dyoung #define bus_dmamap_unload(t, p) \
355 1.1 dyoung (*(t)->_dmamap_unload)((t), (p))
356 1.1 dyoung #define bus_dmamap_sync(t, p, o, l, ops) \
357 1.1 dyoung (void)((t)->_dmamap_sync ? \
358 1.1 dyoung (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops)) : (void)0)
359 1.1 dyoung
360 1.1 dyoung #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
361 1.1 dyoung (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
362 1.1 dyoung #define bus_dmamem_free(t, sg, n) \
363 1.1 dyoung (*(t)->_dmamem_free)((t), (sg), (n))
364 1.1 dyoung #define bus_dmamem_map(t, sg, n, s, k, f) \
365 1.1 dyoung (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
366 1.1 dyoung #define bus_dmamem_unmap(t, k, s) \
367 1.1 dyoung (*(t)->_dmamem_unmap)((t), (k), (s))
368 1.1 dyoung #define bus_dmamem_mmap(t, sg, n, o, p, f) \
369 1.1 dyoung (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
370 1.1 dyoung
371 1.1 dyoung #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
372 1.1 dyoung #define bus_dmatag_destroy(t)
373 1.1 dyoung
374 1.1 dyoung #ifdef _SPARC_BUS_DMA_PRIVATE
375 1.1 dyoung int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
376 1.1 dyoung bus_size_t, int, bus_dmamap_t *);
377 1.1 dyoung void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
378 1.1 dyoung int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
379 1.1 dyoung bus_size_t, struct proc *, int);
380 1.1 dyoung int _bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
381 1.1 dyoung struct mbuf *, int);
382 1.1 dyoung int _bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
383 1.1 dyoung struct uio *, int);
384 1.1 dyoung int _bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
385 1.1 dyoung bus_dma_segment_t *, int, bus_size_t, int);
386 1.1 dyoung void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
387 1.1 dyoung void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
388 1.1 dyoung bus_size_t, int);
389 1.1 dyoung
390 1.1 dyoung int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
391 1.1 dyoung bus_size_t alignment, bus_size_t boundary,
392 1.1 dyoung bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
393 1.1 dyoung void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
394 1.1 dyoung int nsegs);
395 1.1 dyoung int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
396 1.1 dyoung int nsegs, size_t size, void **kvap, int flags);
397 1.1 dyoung void _bus_dmamem_unmap(bus_dma_tag_t tag, void *kva,
398 1.1 dyoung size_t size);
399 1.1 dyoung paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
400 1.1 dyoung int nsegs, off_t off, int prot, int flags);
401 1.1 dyoung
402 1.1 dyoung int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
403 1.1 dyoung bus_size_t alignment, bus_size_t boundary,
404 1.1 dyoung bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
405 1.1 dyoung vaddr_t low, vaddr_t high);
406 1.1 dyoung #endif /* _SPARC_BUS_DMA_PRIVATE */
407 1.1 dyoung
408 1.1 dyoung #endif /* _SPARC_BUS_FUNCS_H_ */
409