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