1 /* $NetBSD: bus.h,v 1.28 2008/04/28 20:23:31 martin Exp $ */
4 * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
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.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
36 #include <mips/locore.h>
39 * Utility macros; do not use outside this file.
41 #define __PB_TYPENAME_PREFIX(BITS) ___CONCAT(u_int,BITS)
42 #define __PB_TYPENAME(BITS) ___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
45 * Bus address and size types
47 typedef u_long bus_addr_t
;
48 typedef u_long bus_size_t
;
51 * Access methods for bus resources and address space.
53 typedef int bus_space_tag_t
;
54 typedef u_long bus_space_handle_t
;
57 * int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
58 * bus_size_t size, int flags, bus_space_handle_t *bshp);
60 * Map a region of bus space.
63 #define BUS_SPACE_MAP_CACHEABLE 0x01
64 #define BUS_SPACE_MAP_LINEAR 0x02
65 #define BUS_SPACE_MAP_PREFETCHABLE 0x04
67 int bus_space_map(bus_space_tag_t
, bus_addr_t
, bus_size_t
,
68 int, bus_space_handle_t
*);
71 * void bus_space_unmap(bus_space_tag_t t,
72 * bus_space_handle_t bsh, bus_size_t size);
74 * Unmap a region of bus space.
77 void bus_space_unmap(bus_space_tag_t
, bus_space_handle_t
, bus_size_t
);
80 * int bus_space_subregion(bus_space_tag_t t,
81 * bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
82 * bus_space_handle_t *nbshp);
84 * Get a new handle for a subregion of an already-mapped area of bus space.
87 int bus_space_subregion(bus_space_tag_t t
, bus_space_handle_t bsh
,
88 bus_size_t offset
, bus_size_t size
, bus_space_handle_t
*nbshp
);
91 * int bus_space_alloc(bus_space_tag_t t, bus_addr_t, rstart,
92 * bus_addr_t rend, bus_size_t size, bus_size_t align,
93 * bus_size_t boundary, int flags, bus_addr_t *addrp,
94 * bus_space_handle_t *bshp);
96 * Allocate a region of bus space.
99 int bus_space_alloc(bus_space_tag_t t
, bus_addr_t rstart
,
100 bus_addr_t rend
, bus_size_t size
, bus_size_t align
,
101 bus_size_t boundary
, int cacheable
, bus_addr_t
*addrp
,
102 bus_space_handle_t
*bshp
);
105 * int bus_space_free(bus_space_tag_t t,
106 * bus_space_handle_t bsh, bus_size_t size);
108 * Free a region of bus space.
111 void bus_space_free(bus_space_tag_t t
, bus_space_handle_t bsh
,
115 * void *bus_space_vaddr(bus_space_tag_t, bus_space_handle_t);
117 * Get the kernel virtual address for the mapped bus space.
118 * Only allowed for regions mapped with BUS_SPACE_MAP_LINEAR.
121 #define bus_space_vaddr(t, h) \
125 * u_intN_t bus_space_read_N(bus_space_tag_t tag,
126 * bus_space_handle_t bsh, bus_size_t offset);
128 * Read a 1, 2, 4, or 8 byte quantity from bus space
129 * described by tag/handle/offset.
132 #define bus_space_read_1(t, h, o) \
133 ((void) t, (*(volatile u_int8_t *)((h) + (o))))
135 #define bus_space_read_2(t, h, o) \
136 ((void) t, (*(volatile u_int16_t *)((h) + (o))))
138 #define bus_space_read_4(t, h, o) \
139 ((void) t, (*(volatile u_int32_t *)((h) + (o))))
141 #if 0 /* Cause a link error for bus_space_read_8 */
142 #define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
146 * void bus_space_read_multi_N(bus_space_tag_t tag,
147 * bus_space_handle_t bsh, bus_size_t offset,
148 * u_intN_t *addr, size_t count);
150 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
151 * described by tag/handle/offset and copy into buffer provided.
154 #define __PMAX_bus_space_read_multi(BYTES,BITS) \
155 static __inline void __CONCAT(bus_space_read_multi_,BYTES) \
156 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
157 __PB_TYPENAME(BITS) *, size_t); \
159 static __inline void \
160 __CONCAT(bus_space_read_multi_,BYTES)(t, h, o, a, c) \
162 bus_space_handle_t h; \
164 __PB_TYPENAME(BITS) *a; \
169 *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
172 __PMAX_bus_space_read_multi(1,8)
173 __PMAX_bus_space_read_multi(2,16)
174 __PMAX_bus_space_read_multi(4,32)
176 #if 0 /* Cause a link error for bus_space_read_multi_8 */
177 #define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
180 #undef __PMAX_bus_space_read_multi
183 * void bus_space_read_region_N(bus_space_tag_t tag,
184 * bus_space_handle_t bsh, bus_size_t offset,
185 * u_intN_t *addr, size_t count);
187 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
188 * described by tag/handle and starting at `offset' and copy into
192 #define __PMAX_bus_space_read_region(BYTES,BITS) \
193 static __inline void __CONCAT(bus_space_read_region_,BYTES) \
194 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
195 __PB_TYPENAME(BITS) *, size_t); \
197 static __inline void \
198 __CONCAT(bus_space_read_region_,BYTES)(t, h, o, a, c) \
200 bus_space_handle_t h; \
202 __PB_TYPENAME(BITS) *a; \
207 *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
212 __PMAX_bus_space_read_region(1,8)
213 __PMAX_bus_space_read_region(2,16)
214 __PMAX_bus_space_read_region(4,32)
216 #if 0 /* Cause a link error for bus_space_read_region_8 */
217 #define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
220 #undef __PMAX_bus_space_read_region
223 * void bus_space_write_N(bus_space_tag_t tag,
224 * bus_space_handle_t bsh, bus_size_t offset,
227 * Write the 1, 2, 4, or 8 byte value `value' to bus space
228 * described by tag/handle/offset.
231 #define bus_space_write_1(t, h, o, v) \
234 *(volatile u_int8_t *)((h) + (o)) = (v); \
235 wbflush(); /* XXX */ \
238 #define bus_space_write_2(t, h, o, v) \
241 *(volatile u_int16_t *)((h) + (o)) = (v); \
242 wbflush(); /* XXX */ \
245 #define bus_space_write_4(t, h, o, v) \
248 *(volatile u_int32_t *)((h) + (o)) = (v); \
249 wbflush(); /* XXX */ \
252 #if 0 /* Cause a link error for bus_space_write_8 */
253 #define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
257 * void bus_space_write_multi_N(bus_space_tag_t tag,
258 * bus_space_handle_t bsh, bus_size_t offset,
259 * const u_intN_t *addr, size_t count);
261 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
262 * provided to bus space described by tag/handle/offset.
265 #define __PMAX_bus_space_write_multi(BYTES,BITS) \
266 static __inline void __CONCAT(bus_space_write_multi_,BYTES) \
267 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
268 __PB_TYPENAME(BITS) *, size_t); \
270 static __inline void \
271 __CONCAT(bus_space_write_multi_,BYTES)(t, h, o, a, c) \
273 bus_space_handle_t h; \
275 __PB_TYPENAME(BITS) *a; \
280 __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
283 __PMAX_bus_space_write_multi(1,8)
284 __PMAX_bus_space_write_multi(2,16)
285 __PMAX_bus_space_write_multi(4,32)
287 #if 0 /* Cause a link error for bus_space_write_8 */
288 #define bus_space_write_multi_8(t, h, o, a, c) \
289 !!! bus_space_write_multi_8 unimplimented !!!
292 #undef __PMAX_bus_space_write_multi
295 * void bus_space_write_region_N(bus_space_tag_t tag,
296 * bus_space_handle_t bsh, bus_size_t offset,
297 * const u_intN_t *addr, size_t count);
299 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
300 * to bus space described by tag/handle starting at `offset'.
303 #define __PMAX_bus_space_write_region(BYTES,BITS) \
304 static __inline void __CONCAT(bus_space_write_region_,BYTES) \
305 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
306 __PB_TYPENAME(BITS) *, size_t); \
308 static __inline void \
309 __CONCAT(bus_space_write_region_,BYTES)(t, h, o, a, c) \
311 bus_space_handle_t h; \
313 __PB_TYPENAME(BITS) *a; \
318 __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
323 __PMAX_bus_space_write_region(1,8)
324 __PMAX_bus_space_write_region(2,16)
325 __PMAX_bus_space_write_region(4,32)
327 #if 0 /* Cause a link error for bus_space_write_region_8 */
328 #define bus_space_write_region_8 \
329 !!! bus_space_write_region_8 unimplemented !!!
332 #undef __PMAX_bus_space_write_region
335 * void bus_space_set_multi_N(bus_space_tag_t tag,
336 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
339 * Write the 1, 2, 4, or 8 byte value `val' to bus space described
340 * by tag/handle/offset `count' times.
343 #define __PMAX_bus_space_set_multi(BYTES,BITS) \
344 static __inline void __CONCAT(bus_space_set_multi_,BYTES) \
345 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
346 __PB_TYPENAME(BITS), size_t); \
348 static __inline void \
349 __CONCAT(bus_space_set_multi_,BYTES)(t, h, o, v, c) \
351 bus_space_handle_t h; \
353 __PB_TYPENAME(BITS) v; \
358 __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
361 __PMAX_bus_space_set_multi(1,8)
362 __PMAX_bus_space_set_multi(2,16)
363 __PMAX_bus_space_set_multi(4,32)
365 #if 0 /* Cause a link error for bus_space_set_multi_8 */
366 #define bus_space_set_multi_8 \
367 !!! bus_space_set_multi_8 unimplemented !!!
370 #undef __PMAX_bus_space_set_multi
373 * void bus_space_set_region_N(bus_space_tag_t tag,
374 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
377 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
378 * by tag/handle starting at `offset'.
381 #define __PMAX_bus_space_set_region(BYTES,BITS) \
382 static __inline void __CONCAT(bus_space_set_region_,BYTES) \
383 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
384 __PB_TYPENAME(BITS), size_t); \
386 static __inline void \
387 __CONCAT(bus_space_set_region_,BYTES)(t, h, o, v, c) \
389 bus_space_handle_t h; \
391 __PB_TYPENAME(BITS) v; \
396 __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
401 __PMAX_bus_space_set_region(1,8)
402 __PMAX_bus_space_set_region(2,16)
403 __PMAX_bus_space_set_region(4,32)
405 #if 0 /* Cause a link error for bus_space_set_region_8 */
406 #define bus_space_set_region_8 \
407 !!! bus_space_set_region_8 unimplemented !!!
410 #undef __PMAX_bus_space_set_region
413 * void bus_space_copy_region_N(bus_space_tag_t tag,
414 * bus_space_handle_t bsh1, bus_size_t off1,
415 * bus_space_handle_t bsh2, bus_size_t off2,
418 * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
419 * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
422 #define __PMAX_copy_region(BYTES) \
423 static __inline void __CONCAT(bus_space_copy_region_,BYTES) \
425 bus_space_handle_t bsh1, bus_size_t off1, \
426 bus_space_handle_t bsh2, bus_size_t off2, \
429 static __inline void \
430 __CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c) \
432 bus_space_handle_t h1, h2; \
433 bus_size_t o1, o2, c; \
437 if ((h1 + o1) >= (h2 + o2)) { \
438 /* src after dest: copy forward */ \
439 for (o = 0; c != 0; c--, o += BYTES) \
440 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
441 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
443 /* dest after src: copy backwards */ \
444 for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES) \
445 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
446 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
450 __PMAX_copy_region(1)
451 __PMAX_copy_region(2)
452 __PMAX_copy_region(4)
454 #if 0 /* Cause a link error for bus_space_copy_region_8 */
455 #define bus_space_copy_region_8 \
456 !!! bus_space_copy_region_8 unimplemented !!!
459 #undef __PMAX_copy_region
462 * Bus read/write barrier methods.
464 * void bus_space_barrier(bus_space_tag_t tag,
465 * bus_space_handle_t bsh, bus_size_t offset,
466 * bus_size_t len, int flags);
468 * On the MIPS, we just flush the write buffer.
470 #define bus_space_barrier(t, h, o, l, f) \
471 ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f), \
473 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
474 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
476 #undef __PB_TYPENAME_PREFIX
479 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
482 * Flags used in various bus DMA methods.
484 #define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
485 #define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
486 #define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
487 #define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
488 #define BUS_DMA_STREAMING 0x008 /* hint: sequential, unidirectional */
489 #define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
490 #define BUS_DMA_BUS2 0x020
491 #define BUS_DMA_BUS3 0x040
492 #define BUS_DMA_BUS4 0x080
493 #define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
494 #define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
495 #define BUS_DMA_NOCACHE 0x400 /* hint: map non-cached memory */
497 #define PMAX_DMAMAP_COHERENT 0x10000 /* no cache flush necessary on sync */
499 /* Forwards needed by prototypes below. */
504 * Operations performed by bus_dmamap_sync().
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 */
511 typedef struct pmax_bus_dma_tag
*bus_dma_tag_t
;
512 typedef struct pmax_bus_dmamap
*bus_dmamap_t
;
514 #define BUS_DMA_TAG_VALID(t) ((t) != (bus_dma_tag_t)0)
519 * Describes a single contiguous DMA transaction. Values
520 * are suitable for programming into DMA registers.
522 struct pmax_bus_dma_segment
{
523 bus_addr_t ds_addr
; /* DMA address */
524 bus_size_t ds_len
; /* length of transfer */
525 bus_addr_t _ds_vaddr
; /* virtual address, 0 if invalid */
527 typedef struct pmax_bus_dma_segment bus_dma_segment_t
;
532 * A machine-dependent opaque type describing the implementation of
533 * DMA for a given bus.
536 struct pmax_bus_dma_tag
{
538 * DMA mapping methods.
540 int (*_dmamap_create
)(bus_dma_tag_t
, bus_size_t
, int,
541 bus_size_t
, bus_size_t
, int, bus_dmamap_t
*);
542 void (*_dmamap_destroy
)(bus_dma_tag_t
, bus_dmamap_t
);
543 int (*_dmamap_load
)(bus_dma_tag_t
, bus_dmamap_t
, void *,
544 bus_size_t
, struct proc
*, int);
545 int (*_dmamap_load_mbuf
)(bus_dma_tag_t
, bus_dmamap_t
,
547 int (*_dmamap_load_uio
)(bus_dma_tag_t
, bus_dmamap_t
,
549 int (*_dmamap_load_raw
)(bus_dma_tag_t
, bus_dmamap_t
,
550 bus_dma_segment_t
*, int, bus_size_t
, int);
551 void (*_dmamap_unload
)(bus_dma_tag_t
, bus_dmamap_t
);
552 void (*_dmamap_sync
)(bus_dma_tag_t
, bus_dmamap_t
,
553 bus_addr_t
, bus_size_t
, int);
556 * DMA memory utility functions.
558 int (*_dmamem_alloc
)(bus_dma_tag_t
, bus_size_t
, bus_size_t
,
559 bus_size_t
, bus_dma_segment_t
*, int, int *, int);
560 void (*_dmamem_free
)(bus_dma_tag_t
,
561 bus_dma_segment_t
*, int);
562 int (*_dmamem_map
)(bus_dma_tag_t
, bus_dma_segment_t
*,
563 int, size_t, void **, int);
564 void (*_dmamem_unmap
)(bus_dma_tag_t
, void *, size_t);
565 paddr_t (*_dmamem_mmap
)(bus_dma_tag_t
, bus_dma_segment_t
*,
566 int, off_t
, int, int);
569 #define bus_dmamap_create(t, s, n, m, b, f, p) \
570 (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
571 #define bus_dmamap_destroy(t, p) \
572 (*(t)->_dmamap_destroy)((t), (p))
573 #define bus_dmamap_load(t, m, b, s, p, f) \
574 (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
575 #define bus_dmamap_load_mbuf(t, m, b, f) \
576 (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
577 #define bus_dmamap_load_uio(t, m, u, f) \
578 (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
579 #define bus_dmamap_load_raw(t, m, sg, n, s, f) \
580 (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
581 #define bus_dmamap_unload(t, p) \
582 (*(t)->_dmamap_unload)((t), (p))
583 #define bus_dmamap_sync(t, p, o, l, ops) \
584 (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
586 #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
587 (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
588 #define bus_dmamem_free(t, sg, n) \
589 (*(t)->_dmamem_free)((t), (sg), (n))
590 #define bus_dmamem_map(t, sg, n, s, k, f) \
591 (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
592 #define bus_dmamem_unmap(t, k, s) \
593 (*(t)->_dmamem_unmap)((t), (k), (s))
594 #define bus_dmamem_mmap(t, sg, n, o, p, f) \
595 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
597 #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
598 #define bus_dmatag_destroy(t)
603 * Describes a DMA mapping.
605 struct pmax_bus_dmamap
{
607 * PRIVATE MEMBERS: not for use my machine-independent code.
609 bus_size_t _dm_size
; /* largest DMA transfer mappable */
610 int _dm_segcnt
; /* number of segs this map can map */
611 bus_size_t _dm_maxmaxsegsz
; /* fixed largest possible segment */
612 bus_size_t _dm_boundary
; /* don't cross this */
613 int _dm_flags
; /* misc. flags */
614 struct vmspace
*_dm_vmspace
; /* vmspace that owns the mapping */
617 * PUBLIC MEMBERS: these are used by machine-independent code.
619 bus_size_t dm_maxsegsz
; /* largest possible segment */
620 bus_size_t dm_mapsize
; /* size of the mapping */
621 int dm_nsegs
; /* # valid segments in mapping */
622 bus_dma_segment_t dm_segs
[1]; /* segments; variable length */
625 #ifdef _PMAX_BUS_DMA_PRIVATE
626 void pmax_bus_dma_init(void);
628 int _bus_dmamap_create(bus_dma_tag_t
, bus_size_t
, int, bus_size_t
,
629 bus_size_t
, int, bus_dmamap_t
*);
630 void _bus_dmamap_destroy(bus_dma_tag_t
, bus_dmamap_t
);
631 int _bus_dmamap_load(bus_dma_tag_t
, bus_dmamap_t
, void *,
632 bus_size_t
, struct proc
*, int);
633 int _bus_dmamap_load_mbuf(bus_dma_tag_t
, bus_dmamap_t
,
635 int _bus_dmamap_load_uio(bus_dma_tag_t
, bus_dmamap_t
,
637 int _bus_dmamap_load_raw(bus_dma_tag_t
, bus_dmamap_t
,
638 bus_dma_segment_t
*, int, bus_size_t
, int);
639 void _bus_dmamap_unload(bus_dma_tag_t
, bus_dmamap_t
);
640 void _bus_dmamap_sync_r3k(bus_dma_tag_t
, bus_dmamap_t
, bus_addr_t
,
642 void _bus_dmamap_sync_r4k(bus_dma_tag_t
, bus_dmamap_t
, bus_addr_t
,
645 int _bus_dmamem_alloc(bus_dma_tag_t tag
, bus_size_t size
,
646 bus_size_t alignment
, bus_size_t boundary
,
647 bus_dma_segment_t
*segs
, int nsegs
, int *rsegs
, int flags
);
648 void _bus_dmamem_free(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
650 int _bus_dmamem_map(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
651 int nsegs
, size_t size
, void **kvap
, int flags
);
652 void _bus_dmamem_unmap(bus_dma_tag_t tag
, void *kva
,
654 paddr_t
_bus_dmamem_mmap(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
655 int nsegs
, off_t off
, int prot
, int flags
);
657 int _bus_dmamem_alloc_range(bus_dma_tag_t tag
, bus_size_t size
,
658 bus_size_t alignment
, bus_size_t boundary
,
659 bus_dma_segment_t
*segs
, int nsegs
, int *rsegs
, int flags
,
660 vaddr_t low
, vaddr_t high
);
662 extern struct pmax_bus_dma_tag pmax_default_bus_dma_tag
;
663 #endif /* _PMAX_BUS_DMA_PRIVATE */
665 #endif /* !_PMAX_BUS_H_ */