bus.h revision 1.1.2.1 1 /* $NetBSD: bus.h,v 1.1.2.1 1998/12/23 16:47:32 minoura Exp $ */
2
3 /*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 /*
41 * bus_space(9) and bus_dma(9) interface for NetBSD/x68k.
42 */
43
44 #ifndef _X68K_BUS_H_
45 #define _X68K_BUS_H_
46
47 /*
48 * Bus address and size types
49 */
50 typedef u_long bus_addr_t;
51 typedef u_long bus_size_t;
52 typedef u_long bus_space_handle_t;
53
54 /*
55 * Bus space descripter
56 */
57 typedef struct x68k_bus_space *bus_space_tag_t;
58
59 struct x68k_bus_space {
60 #if 0
61 enum {
62 X68K_INTIO_BUS,
63 X68K_PCI_BUS,
64 X68K_NEPTUNE_BUS
65 } x68k_bus_type;
66 #endif
67
68 int (*x68k_bus_space_map) __P((
69 bus_space_tag_t,
70 bus_addr_t,
71 bus_size_t,
72 int, /* flags */
73 bus_space_handle_t *));
74 void (*x68k_bus_space_unmap) __P((
75 bus_space_tag_t,
76 bus_space_handle_t,
77 bus_size_t));
78 int (*x68k_bus_space_subregion) __P((
79 bus_space_tag_t,
80 bus_space_handle_t,
81 bus_size_t, /* offset */
82 bus_size_t, /* size */
83 bus_space_handle_t *));
84
85 int (*x68k_bus_space_alloc) __P((
86 bus_space_tag_t,
87 bus_addr_t, /* reg_start */
88 bus_addr_t, /* reg_end */
89 bus_size_t,
90 bus_size_t, /* alignment */
91 bus_size_t, /* boundary */
92 int, /* flags */
93 bus_addr_t *,
94 bus_space_handle_t *));
95 void (*x68k_bus_space_free) __P((
96 bus_space_tag_t,
97 bus_space_handle_t,
98 bus_size_t));
99
100 #if 0
101 void (*x68k_bus_space_barrier) __P((
102 bus_space_tag_t,
103 bus_space_handle_t,
104 bus_size_t, /* offset */
105 bus_size_t, /* length */
106 int)); /* flags */
107 #endif
108
109 u_int8_t (*x68k_bus_space_read_1) __P((
110 bus_space_tag_t,
111 bus_space_handle_t,
112 bus_size_t)); /* offset */
113 u_int16_t (*x68k_bus_space_read_2) __P((
114 bus_space_tag_t,
115 bus_space_handle_t,
116 bus_size_t)); /* offset */
117 u_int32_t (*x68k_bus_space_read_4) __P((
118 bus_space_tag_t,
119 bus_space_handle_t,
120 bus_size_t)); /* offset */
121
122 void (*x68k_bus_space_read_multi_1) __P((
123 bus_space_tag_t,
124 bus_space_handle_t,
125 bus_size_t, /* offset */
126 u_int8_t *,
127 bus_size_t)); /* count */
128 void (*x68k_bus_space_read_multi_2) __P((
129 bus_space_tag_t,
130 bus_space_handle_t,
131 bus_size_t, /* offset */
132 u_int16_t *,
133 bus_size_t)); /* count */
134 void (*x68k_bus_space_read_multi_4) __P((
135 bus_space_tag_t,
136 bus_space_handle_t,
137 bus_size_t, /* offset */
138 u_int32_t *,
139 bus_size_t)); /* count */
140
141 void (*x68k_bus_space_read_region_1) __P((
142 bus_space_tag_t,
143 bus_space_handle_t,
144 bus_size_t, /* offset */
145 u_int8_t *,
146 bus_size_t)); /* count */
147 void (*x68k_bus_space_read_region_2) __P((
148 bus_space_tag_t,
149 bus_space_handle_t,
150 bus_size_t, /* offset */
151 u_int16_t *,
152 bus_size_t)); /* count */
153 void (*x68k_bus_space_read_region_4) __P((
154 bus_space_tag_t,
155 bus_space_handle_t,
156 bus_size_t, /* offset */
157 u_int32_t *,
158 bus_size_t)); /* count */
159
160 void (*x68k_bus_space_write_1) __P((
161 bus_space_tag_t,
162 bus_space_handle_t,
163 bus_size_t, /* offset */
164 u_int8_t));
165 void (*x68k_bus_space_write_2) __P((
166 bus_space_tag_t,
167 bus_space_handle_t,
168 bus_size_t, /* offset */
169 u_int16_t));
170 void (*x68k_bus_space_write_4) __P((
171 bus_space_tag_t,
172 bus_space_handle_t,
173 bus_size_t, /* offset */
174 u_int32_t));
175
176 void (*x68k_bus_space_write_multi_1) __P((
177 bus_space_tag_t,
178 bus_space_handle_t,
179 bus_size_t, /* offset */
180 u_int8_t *,
181 bus_size_t)); /* count */
182 void (*x68k_bus_space_write_multi_2) __P((
183 bus_space_tag_t,
184 bus_space_handle_t,
185 bus_size_t, /* offset */
186 u_int16_t *,
187 bus_size_t)); /* count */
188 void (*x68k_bus_space_write_multi_4) __P((
189 bus_space_tag_t,
190 bus_space_handle_t,
191 bus_size_t, /* offset */
192 u_int32_t *,
193 bus_size_t)); /* count */
194
195 void (*x68k_bus_space_write_region_1) __P((
196 bus_space_tag_t,
197 bus_space_handle_t,
198 bus_size_t, /* offset */
199 u_int8_t *,
200 bus_size_t)); /* count */
201 void (*x68k_bus_space_write_region_2) __P((
202 bus_space_tag_t,
203 bus_space_handle_t,
204 bus_size_t, /* offset */
205 u_int16_t *,
206 bus_size_t)); /* count */
207 void (*x68k_bus_space_write_region_4) __P((
208 bus_space_tag_t,
209 bus_space_handle_t,
210 bus_size_t, /* offset */
211 u_int32_t *,
212 bus_size_t)); /* count */
213
214 void (*x68k_bus_space_set_region_1) __P((
215 bus_space_tag_t,
216 bus_space_handle_t,
217 bus_size_t, /* offset */
218 u_int8_t,
219 bus_size_t)); /* count */
220 void (*x68k_bus_space_set_region_2) __P((
221 bus_space_tag_t,
222 bus_space_handle_t,
223 bus_size_t, /* offset */
224 u_int16_t,
225 bus_size_t)); /* count */
226 void (*x68k_bus_space_set_region_4) __P((
227 bus_space_tag_t,
228 bus_space_handle_t,
229 bus_size_t, /* offset */
230 u_int32_t,
231 bus_size_t)); /* count */
232
233 void (*x68k_bus_space_copy_region_1) __P((
234 bus_space_tag_t,
235 bus_space_handle_t, /* srchandle */
236 bus_size_t, /* srcoffset */
237 bus_space_handle_t, /* dsthandle */
238 bus_size_t, /* dstoffset */
239 bus_size_t)); /* count */
240 void (*x68k_bus_space_copy_region_2) __P((
241 bus_space_tag_t,
242 bus_space_handle_t, /* srchandle */
243 bus_size_t, /* srcoffset */
244 bus_space_handle_t, /* dsthandle */
245 bus_size_t, /* dstoffset */
246 bus_size_t)); /* count */
247 void (*x68k_bus_space_copy_region_4) __P((
248 bus_space_tag_t,
249 bus_space_handle_t, /* srchandle */
250 bus_size_t, /* srcoffset */
251 bus_space_handle_t, /* dsthandle */
252 bus_size_t, /* dstoffset */
253 bus_size_t)); /* count */
254
255 struct device *x68k_bus_device;
256 };
257
258 int x68k_bus_space_alloc __P((bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *));
259 void x68k_bus_space_free __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
260
261 u_int8_t x68k_bus_space_read_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
262 u_int16_t x68k_bus_space_read_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
263 u_int32_t x68k_bus_space_read_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
264
265 void x68k_bus_space_read_multi_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
266 void x68k_bus_space_read_multi_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t));
267 void x68k_bus_space_read_multi_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t));
268
269 void x68k_bus_space_read_region_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
270 void x68k_bus_space_read_region_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t));
271 void x68k_bus_space_read_region_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t));
272
273 void x68k_bus_space_write_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t));
274 void x68k_bus_space_write_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t));
275 void x68k_bus_space_write_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t));
276
277 void x68k_bus_space_write_multi_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
278 void x68k_bus_space_write_multi_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t));
279 void x68k_bus_space_write_multi_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t));
280
281 void x68k_bus_space_write_region_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t));
282 void x68k_bus_space_write_region_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t));
283 void x68k_bus_space_write_region_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t));
284
285 void x68k_bus_space_set_region_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t));
286 void x68k_bus_space_set_region_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t));
287 void x68k_bus_space_set_region_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t));
288
289 void x68k_bus_space_copy_region_1 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
290 void x68k_bus_space_copy_region_2 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
291 void x68k_bus_space_copy_region_4 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t));
292
293 /*
294 * bus_space(9) interface
295 */
296
297 #define bus_space_map(t,a,s,f,h) \
298 ((*((t)->x68k_bus_space_map)) ((t),(a),(s),(f),(h)))
299 #define bus_space_unmap(t,h,s) \
300 ((*((t)->x68k_bus_space_unmap)) ((t),(h),(s)))
301 #define bus_space_subregion(t,h,o,s,p) \
302 ((*((t)->x68k_bus_space_subregion)) ((t),(h),(o),(s),(p)))
303 #define BUS_SPACE_MAP_CACHEABLE 0x0001
304 #define BUS_SPACE_MAP_LINEAR 0x0002
305
306 #define bus_space_alloc(t,rs,re,s,a,b,f,r,h) \
307 ((*((t)->x68k_bus_space_alloc)) ((t),(rs),(re),(s),(a),(b),(f),(r),(h)))
308 #define bus_space_free(t,h,s) \
309 ((*((t)->x68k_bus_space_free)) ((t),(h),(s)))
310
311 /*
312 * Note: the 680x0 does not currently require barriers, but we must
313 * provide the flags to MI code.
314 */
315 #define bus_space_barrier(t, h, o, l, f) \
316 ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
317 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
318 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
319
320 #define bus_space_read_1(t,h,o) \
321 ((*((t)->x68k_bus_space_read_1)) ((t),(h),(o)))
322 #define bus_space_read_2(t,h,o) \
323 ((*((t)->x68k_bus_space_read_2)) ((t),(h),(o)))
324 #define bus_space_read_4(t,h,o) \
325 ((*((t)->x68k_bus_space_read_4)) ((t),(h),(o)))
326
327 #define bus_space_read_multi_1(t,h,o,p,c) \
328 ((*((t)->x68k_bus_space_read_multi_1)) ((t),(h),(o),(p),(c)))
329 #define bus_space_read_multi_2(t,h,o,p,c) \
330 ((*((t)->x68k_bus_space_read_multi_2)) ((t),(h),(o),(p),(c)))
331 #define bus_space_read_multi_4(t,h,o,p,c) \
332 ((*((t)->x68k_bus_space_read_multi_4)) ((t),(h),(o),(p),(c)))
333
334 #define bus_space_read_region_1(t,h,o,p,c) \
335 ((*((t)->x68k_bus_space_read_region_1)) ((t),(h),(o),(p),(c)))
336 #define bus_space_read_region_2(t,h,o,p,c) \
337 ((*((t)->x68k_bus_space_read_region_2)) ((t),(h),(o),(p),(c)))
338 #define bus_space_read_region_4(t,h,o,p,c) \
339 ((*((t)->x68k_bus_space_read_region_4)) ((t),(h),(o),(p),(c)))
340
341 #define bus_space_write_1(t,h,o,v) \
342 ((*((t)->x68k_bus_space_write_1)) ((t),(h),(o),(v)))
343 #define bus_space_write_2(t,h,o,v) \
344 ((*((t)->x68k_bus_space_write_2)) ((t),(h),(o),(v)))
345 #define bus_space_write_4(t,h,o,v) \
346 ((*((t)->x68k_bus_space_write_4)) ((t),(h),(o),(v)))
347
348 #define bus_space_write_multi_1(t,h,o,p,c) \
349 ((*((t)->x68k_bus_space_write_multi_1)) ((t),(h),(o),(p),(c)))
350 #define bus_space_write_multi_2(t,h,o,p,c) \
351 ((*((t)->x68k_bus_space_write_multi_2)) ((t),(h),(o),(p),(c)))
352 #define bus_space_write_multi_4(t,h,o,p,c) \
353 ((*((t)->x68k_bus_space_write_multi_4)) ((t),(h),(o),(p),(c)))
354
355 #define bus_space_write_region_1(t,h,o,p,c) \
356 ((*((t)->x68k_bus_space_write_region_1)) ((t),(h),(o),(p),(c)))
357 #define bus_space_write_region_2(t,h,o,p,c) \
358 ((*((t)->x68k_bus_space_write_region_2)) ((t),(h),(o),(p),(c)))
359 #define bus_space_write_region_4(t,h,o,p,c) \
360 ((*((t)->x68k_bus_space_write_region_4)) ((t),(h),(o),(p),(c)))
361
362 #define bus_space_set_region_1(t,h,o,v,c) \
363 ((*((t)->x68k_bus_space_set_region_1)) ((t),(h),(o),(v),(c)))
364 #define bus_space_set_region_2(t,h,o,v,c) \
365 ((*((t)->x68k_bus_space_set_region_2)) ((t),(h),(o),(v),(c)))
366 #define bus_space_set_region_4(t,h,o,v,c) \
367 ((*((t)->x68k_bus_space_set_region_4)) ((t),(h),(o),(v),(c)))
368
369 #define bus_space_copy_region_1(t,sh,so,dh,do,c) \
370 ((*((t)->x68k_bus_space_copy_region_1)) ((t),(sh),(so),(dh),(do),(c)))
371 #define bus_space_copy_region_2(t,sh,so,dh,do,c) \
372 ((*((t)->x68k_bus_space_copy_region_2)) ((t),(sh),(so),(dh),(do),(c)))
373 #define bus_space_copy_region_4(t,sh,so,dh,do,c) \
374 ((*((t)->x68k_bus_space_copy_region_4)) ((t),(sh),(so),(dh),(do),(c)))
375
376
377 /*
378 * DMA segment
379 */
380 struct x68k_bus_dma_segment {
381 bus_addr_t ds_addr;
382 bus_size_t ds_len;
383 };
384 typedef struct x68k_bus_dma_segment bus_dma_segment_t;
385
386 /*
387 * DMA descriptor
388 */
389 /* Forwards needed by prototypes below. */
390 struct mbuf;
391 struct uio;
392
393 typedef struct x68k_bus_dma *bus_dma_tag_t;
394 typedef struct x68k_bus_dmamap *bus_dmamap_t;
395 struct x68k_bus_dma {
396 /*
397 * The `bounce threshold' is checked while we are loading
398 * the DMA map. If the physical address of the segment
399 * exceeds the threshold, an error will be returned. The
400 * caller can then take whatever action is necessary to
401 * bounce the transfer. If this value is 0, it will be
402 * ignored.
403 */
404 bus_addr_t _bounce_thresh;
405
406 /*
407 * DMA mapping methods.
408 */
409 int (*x68k_dmamap_create) __P((bus_dma_tag_t, bus_size_t, int,
410 bus_size_t, bus_size_t, int, bus_dmamap_t *));
411 void (*x68k_dmamap_destroy) __P((bus_dma_tag_t, bus_dmamap_t));
412 int (*x68k_dmamap_load) __P((bus_dma_tag_t, bus_dmamap_t, void *,
413 bus_size_t, struct proc *, int));
414 int (*x68k_dmamap_load_mbuf) __P((bus_dma_tag_t, bus_dmamap_t,
415 struct mbuf *, int));
416 int (*x68k_dmamap_load_uio) __P((bus_dma_tag_t, bus_dmamap_t,
417 struct uio *, int));
418 int (*x68k_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t,
419 bus_dma_segment_t *, int, bus_size_t, int));
420 void (*x68k_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t));
421 void (*x68k_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t,
422 bus_addr_t, bus_size_t, int));
423
424 /*
425 * DMA memory utility functions.
426 */
427 int (*x68k_dmamem_alloc) __P((bus_dma_tag_t, bus_size_t, bus_size_t,
428 bus_size_t, bus_dma_segment_t *, int, int *, int));
429 void (*x68k_dmamem_free) __P((bus_dma_tag_t,
430 bus_dma_segment_t *, int));
431 int (*x68k_dmamem_map) __P((bus_dma_tag_t, bus_dma_segment_t *,
432 int, size_t, caddr_t *, int));
433 void (*x68k_dmamem_unmap) __P((bus_dma_tag_t, caddr_t, size_t));
434 int (*x68k_dmamem_mmap) __P((bus_dma_tag_t, bus_dma_segment_t *,
435 int, int, int, int));
436 };
437
438 /*
439 * bus_dmamap_t
440 *
441 * Describes a DMA mapping.
442 */
443 struct x68k_bus_dmamap {
444 /*
445 * PRIVATE MEMBERS: not for use my machine-independent code.
446 */
447 bus_size_t x68k_dm_size; /* largest DMA transfer mappable */
448 int x68k_dm_segcnt; /* number of segs this map can map */
449 bus_size_t x68k_dm_maxsegsz; /* largest possible segment */
450 bus_size_t x68k_dm_boundary; /* don't cross this */
451 int x68k_dm_flags; /* misc. flags */
452
453 void *x68k_dm_cookie; /* cookie for bus-specific functions */
454
455 /*
456 * PUBLIC MEMBERS: these are used by machine-independent code.
457 */
458 bus_size_t dm_mapsize; /* size of the mapping */
459 int dm_nsegs; /* # valid segments in mapping */
460 bus_dma_segment_t dm_segs[1]; /* segments; variable length */
461 };
462
463 #define bus_dmamap_create(t,s,n,m,b,f,p) \
464 ((*((t)->x68k_dmamap_create)) ((t),(s),(n),(m),(b),(f),(p)))
465 #define bus_dmamap_destroy(t,p) \
466 ((*((t)->x68k_dmamap_destroy)) ((t),(p)))
467 #define bus_dmamap_load(t,m,b,s,p,f) \
468 ((*((t)->x68k_dmamap_load)) ((t),(m),(b),(s),(p),(f)))
469 #define bus_dmamap_load_mbuf(t,m,b,f) \
470 ((*((t)->x68k_dmamap_load_mbuf)) ((t),(m),(b),(f)))
471 #define bus_dmamap_load_uio(t,m,u,f) \
472 ((*((t)->x68k_dmamap_load_uio)) ((t),(m),(u),(f)))
473 #define bus_dmamap_load_raw(t,m,sg,n,s,f) \
474 ((*((t)->x68k_dmamap_load_raw)) ((t),(m),(sg),(n),(s),(f)))
475 #define bus_dmamap_unload(t,p) \
476 ((*((t)->x68k_dmamap_unload)) ((t),(p)))
477 #define bus_dmamap_sync(t,p,o,l,ops) \
478 ((*((t)->x68k_dmamap_sync)) ((t),(p),(o),(l),(ops)))
479
480 #define bus_dmamem_alloc(t,s,a,b,sg,n,r,f) \
481 ((*((t)->x68k_dmamem_alloc)) ((t),(s),(a),(b),(sg),(n),(r),(f)))
482 #define bus_dmamem_free(t,sg,n) \
483 ((*((t)->x68k_dmamem_free)) ((t),(sg),(n)))
484 #define bus_dmamem_map(t,sg,n,s,k,f) \
485 ((*((t)->x68k_dmamem_map)) ((t),(sg),(n),(s),(k),(f)))
486 #define bus_dmamem_unmap(t,k,s) \
487 ((*((t)->x68k_dmamem_unmap)) ((t),(k),(s)))
488 #define bus_dmamem_mmap(t,sg,n,o,p,f) \
489 ((*((t)->x68k_dmamem_mmap)) ((t),(sg),(n),(o),(p),(f)))
490
491 /*
492 * Flags used in various bus DMA methods.
493 */
494 #define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */
495 #define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */
496 #define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */
497 #define BUS_DMA_COHERENT 0x04 /* hint: map memory DMA coherent */
498 #define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */
499 #define BUS_DMA_BUS2 0x20
500 #define BUS_DMA_BUS3 0x40
501 #define BUS_DMA_BUS4 0x80
502
503 /*
504 * Operations performed by bus_dmamap_sync().
505 */
506 #define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */
507 #define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */
508 #define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */
509 #define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */
510
511 #endif /* _X68K_BUS_H_ */
512