1 /* $NetBSD: bus.h,v 1.18 2007/03/04 06:00:26 christos 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.
33 #ifndef _NEWSMIPS_BUS_H_
34 #define _NEWSMIPS_BUS_H_
36 #include <mips/locore.h>
39 * Utility macros; do not use outside this file.
41 #define __PB_TYPENAME_PREFIX(BITS) ___CONCAT(uint,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 * uintN_t bus_space_read_N(bus_space_tag_t tag,
116 * bus_space_handle_t bsh, bus_size_t offset);
118 * Read a 1, 2, 4, or 8 byte quantity from bus space
119 * described by tag/handle/offset.
122 #define bus_space_read_1(t, h, o) \
123 ((void) t, (*(volatile uint8_t *)((h) + (o))))
125 #define bus_space_read_2(t, h, o) \
126 ((void) t, (*(volatile uint16_t *)((h) + (o))))
128 #define bus_space_read_4(t, h, o) \
129 ((void) t, (*(volatile uint32_t *)((h) + (o))))
131 #if 0 /* Cause a link error for bus_space_read_8 */
132 #define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
136 * void bus_space_read_multi_N(bus_space_tag_t tag,
137 * bus_space_handle_t bsh, bus_size_t offset,
138 * uintN_t *addr, size_t count);
140 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
141 * described by tag/handle/offset and copy into buffer provided.
144 #define __NEWSMIPS_bus_space_read_multi(BYTES,BITS) \
145 static __inline void __CONCAT(bus_space_read_multi_,BYTES) \
146 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
147 __PB_TYPENAME(BITS) *, size_t); \
149 static __inline void \
150 __CONCAT(bus_space_read_multi_,BYTES)(t, h, o, a, c) \
152 bus_space_handle_t h; \
154 __PB_TYPENAME(BITS) *a; \
159 *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
162 __NEWSMIPS_bus_space_read_multi(1,8)
163 __NEWSMIPS_bus_space_read_multi(2,16)
164 __NEWSMIPS_bus_space_read_multi(4,32)
166 #if 0 /* Cause a link error for bus_space_read_multi_8 */
167 #define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
170 #undef __NEWSMIPS_bus_space_read_multi
173 * void bus_space_read_region_N(bus_space_tag_t tag,
174 * bus_space_handle_t bsh, bus_size_t offset,
175 * uintN_t *addr, size_t count);
177 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
178 * described by tag/handle and starting at `offset' and copy into
182 #define __NEWSMIPS_bus_space_read_region(BYTES,BITS) \
183 static __inline void __CONCAT(bus_space_read_region_,BYTES) \
184 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
185 __PB_TYPENAME(BITS) *, size_t); \
187 static __inline void \
188 __CONCAT(bus_space_read_region_,BYTES)(t, h, o, a, c) \
190 bus_space_handle_t h; \
192 __PB_TYPENAME(BITS) *a; \
197 *a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o); \
202 __NEWSMIPS_bus_space_read_region(1,8)
203 __NEWSMIPS_bus_space_read_region(2,16)
204 __NEWSMIPS_bus_space_read_region(4,32)
206 #if 0 /* Cause a link error for bus_space_read_region_8 */
207 #define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
210 #undef __NEWSMIPS_bus_space_read_region
213 * void bus_space_write_N(bus_space_tag_t tag,
214 * bus_space_handle_t bsh, bus_size_t offset,
217 * Write the 1, 2, 4, or 8 byte value `value' to bus space
218 * described by tag/handle/offset.
221 #define bus_space_write_1(t, h, o, v) \
224 *(volatile uint8_t *)((h) + (o)) = (v); \
227 #define bus_space_write_2(t, h, o, v) \
230 *(volatile uint16_t *)((h) + (o)) = (v); \
233 #define bus_space_write_4(t, h, o, v) \
236 *(volatile uint32_t *)((h) + (o)) = (v); \
239 #if 0 /* Cause a link error for bus_space_write_8 */
240 #define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
244 * void bus_space_write_multi_N(bus_space_tag_t tag,
245 * bus_space_handle_t bsh, bus_size_t offset,
246 * const uintN_t *addr, size_t count);
248 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
249 * provided to bus space described by tag/handle/offset.
252 #define __NEWSMIPS_bus_space_write_multi(BYTES,BITS) \
253 static __inline void __CONCAT(bus_space_write_multi_,BYTES) \
254 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
255 const __PB_TYPENAME(BITS) *, size_t); \
257 static __inline void \
258 __CONCAT(bus_space_write_multi_,BYTES)(t, h, o, a, c) \
260 bus_space_handle_t h; \
262 const __PB_TYPENAME(BITS) *a; \
267 __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
270 __NEWSMIPS_bus_space_write_multi(1,8)
271 __NEWSMIPS_bus_space_write_multi(2,16)
272 __NEWSMIPS_bus_space_write_multi(4,32)
274 #if 0 /* Cause a link error for bus_space_write_8 */
275 #define bus_space_write_multi_8(t, h, o, a, c) \
276 !!! bus_space_write_multi_8 unimplimented !!!
279 #undef __NEWSMIPS_bus_space_write_multi
282 * void bus_space_write_region_N(bus_space_tag_t tag,
283 * bus_space_handle_t bsh, bus_size_t offset,
284 * const uintN_t *addr, size_t count);
286 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
287 * to bus space described by tag/handle starting at `offset'.
290 #define __NEWSMIPS_bus_space_write_region(BYTES,BITS) \
291 static __inline void __CONCAT(bus_space_write_region_,BYTES) \
292 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
293 const __PB_TYPENAME(BITS) *, size_t); \
295 static __inline void \
296 __CONCAT(bus_space_write_region_,BYTES)(t, h, o, a, c) \
298 bus_space_handle_t h; \
300 const __PB_TYPENAME(BITS) *a; \
305 __CONCAT(bus_space_write_,BYTES)(t, h, o, *a++); \
310 __NEWSMIPS_bus_space_write_region(1,8)
311 __NEWSMIPS_bus_space_write_region(2,16)
312 __NEWSMIPS_bus_space_write_region(4,32)
314 #if 0 /* Cause a link error for bus_space_write_region_8 */
315 #define bus_space_write_region_8 \
316 !!! bus_space_write_region_8 unimplemented !!!
319 #undef __NEWSMIPS_bus_space_write_region
322 * void bus_space_set_multi_N(bus_space_tag_t tag,
323 * bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
326 * Write the 1, 2, 4, or 8 byte value `val' to bus space described
327 * by tag/handle/offset `count' times.
330 #define __NEWSMIPS_bus_space_set_multi(BYTES,BITS) \
331 static __inline void __CONCAT(bus_space_set_multi_,BYTES) \
332 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
333 __PB_TYPENAME(BITS), size_t); \
335 static __inline void \
336 __CONCAT(bus_space_set_multi_,BYTES)(t, h, o, v, c) \
338 bus_space_handle_t h; \
340 __PB_TYPENAME(BITS) v; \
345 __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
348 __NEWSMIPS_bus_space_set_multi(1,8)
349 __NEWSMIPS_bus_space_set_multi(2,16)
350 __NEWSMIPS_bus_space_set_multi(4,32)
352 #if 0 /* Cause a link error for bus_space_set_multi_8 */
353 #define bus_space_set_multi_8 \
354 !!! bus_space_set_multi_8 unimplemented !!!
357 #undef __NEWSMIPS_bus_space_set_multi
360 * void bus_space_set_region_N(bus_space_tag_t tag,
361 * bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
364 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
365 * by tag/handle starting at `offset'.
368 #define __NEWSMIPS_bus_space_set_region(BYTES,BITS) \
369 static __inline void __CONCAT(bus_space_set_region_,BYTES) \
370 (bus_space_tag_t, bus_space_handle_t, bus_size_t, \
371 __PB_TYPENAME(BITS), size_t); \
373 static __inline void \
374 __CONCAT(bus_space_set_region_,BYTES)(t, h, o, v, c) \
376 bus_space_handle_t h; \
378 __PB_TYPENAME(BITS) v; \
383 __CONCAT(bus_space_write_,BYTES)(t, h, o, v); \
388 __NEWSMIPS_bus_space_set_region(1,8)
389 __NEWSMIPS_bus_space_set_region(2,16)
390 __NEWSMIPS_bus_space_set_region(4,32)
392 #if 0 /* Cause a link error for bus_space_set_region_8 */
393 #define bus_space_set_region_8 \
394 !!! bus_space_set_region_8 unimplemented !!!
397 #undef __NEWSMIPS_bus_space_set_region
400 * void bus_space_copy_region_N(bus_space_tag_t tag,
401 * bus_space_handle_t bsh1, bus_size_t off1,
402 * bus_space_handle_t bsh2, bus_size_t off2,
405 * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
406 * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
409 #define __NEWSMIPS_copy_region(BYTES) \
410 static __inline void __CONCAT(bus_space_copy_region_,BYTES) \
412 bus_space_handle_t bsh1, bus_size_t off1, \
413 bus_space_handle_t bsh2, bus_size_t off2, \
416 static __inline void \
417 __CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c) \
419 bus_space_handle_t h1, h2; \
420 bus_size_t o1, o2, c; \
424 if ((h1 + o1) >= (h2 + o2)) { \
425 /* src after dest: copy forward */ \
426 for (o = 0; c != 0; c--, o += BYTES) \
427 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
428 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
430 /* dest after src: copy backwards */ \
431 for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES) \
432 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \
433 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
437 __NEWSMIPS_copy_region(1)
438 __NEWSMIPS_copy_region(2)
439 __NEWSMIPS_copy_region(4)
441 #if 0 /* Cause a link error for bus_space_copy_region_8 */
442 #define bus_space_copy_region_8 \
443 !!! bus_space_copy_region_8 unimplemented !!!
446 #undef __NEWSMIPS_copy_region
449 * Bus read/write barrier methods.
451 * void bus_space_barrier(bus_space_tag_t tag,
452 * bus_space_handle_t bsh, bus_size_t offset,
453 * bus_size_t len, int flags);
455 * On the MIPS, we just flush the write buffer.
457 #define bus_space_barrier(t, h, o, l, f) \
458 ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f), \
460 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
461 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
463 #undef __PB_TYPENAME_PREFIX
466 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
469 * Flags used in various bus DMA methods.
471 #define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
472 #define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
473 #define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
474 #define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
475 #define BUS_DMA_STREAMING 0x008 /* hint: sequential, unidirectional */
476 #define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
477 #define BUS_DMA_BUS2 0x020
478 #define BUS_DMA_BUS3 0x040
479 #define BUS_DMA_BUS4 0x080
480 #define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
481 #define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
482 #define BUS_DMA_NOCACHE 0x400 /* hint: map non-cached memory */
484 #define NEWSMIPS_DMAMAP_COHERENT 0x10000 /* no cache flush necessary on sync */
485 #define NEWSMIPS_DMAMAP_MAPTBL 0x20000 /* use DMA maping table */
487 /* Forwards needed by prototypes below. */
492 * Operations performed by bus_dmamap_sync().
494 #define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */
495 #define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */
496 #define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */
497 #define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */
499 typedef struct newsmips_bus_dma_tag
*bus_dma_tag_t
;
500 typedef struct newsmips_bus_dmamap
*bus_dmamap_t
;
502 #define BUS_DMA_TAG_VALID(t) ((t) != (bus_dma_tag_t)0)
507 * Describes a single contiguous DMA transaction. Values
508 * are suitable for programming into DMA registers.
510 struct newsmips_bus_dma_segment
{
511 bus_addr_t ds_addr
; /* DMA address */
512 bus_size_t ds_len
; /* length of transfer */
513 bus_addr_t _ds_vaddr
; /* virtual address, 0 if invalid */
515 typedef struct newsmips_bus_dma_segment bus_dma_segment_t
;
520 * A machine-dependent opaque type describing the implementation of
521 * DMA for a given bus.
524 struct newsmips_bus_dma_tag
{
526 * DMA mapping methods.
528 int (*_dmamap_create
)(bus_dma_tag_t
, bus_size_t
, int,
529 bus_size_t
, bus_size_t
, int, bus_dmamap_t
*);
530 void (*_dmamap_destroy
)(bus_dma_tag_t
, bus_dmamap_t
);
531 int (*_dmamap_load
)(bus_dma_tag_t
, bus_dmamap_t
, void *,
532 bus_size_t
, struct proc
*, int);
533 int (*_dmamap_load_mbuf
)(bus_dma_tag_t
, bus_dmamap_t
,
535 int (*_dmamap_load_uio
)(bus_dma_tag_t
, bus_dmamap_t
,
537 int (*_dmamap_load_raw
)(bus_dma_tag_t
, bus_dmamap_t
,
538 bus_dma_segment_t
*, int, bus_size_t
, int);
539 void (*_dmamap_unload
)(bus_dma_tag_t
, bus_dmamap_t
);
540 void (*_dmamap_sync
)(bus_dma_tag_t
, bus_dmamap_t
,
541 bus_addr_t
, bus_size_t
, int);
544 * DMA memory utility functions.
546 int (*_dmamem_alloc
)(bus_dma_tag_t
, bus_size_t
, bus_size_t
,
547 bus_size_t
, bus_dma_segment_t
*, int, int *, int);
548 void (*_dmamem_free
)(bus_dma_tag_t
,
549 bus_dma_segment_t
*, int);
550 int (*_dmamem_map
)(bus_dma_tag_t
, bus_dma_segment_t
*,
551 int, size_t, void **, int);
552 void (*_dmamem_unmap
)(bus_dma_tag_t
, void *, size_t);
553 paddr_t (*_dmamem_mmap
)(bus_dma_tag_t
, bus_dma_segment_t
*,
554 int, off_t
, int, int);
558 * This is NOT a constant. Slot dependent information is
559 * required to flush DMA cache correctly.
562 bus_space_tag_t _slotbaset
;
563 bus_space_handle_t _slotbaseh
;
566 #define bus_dmamap_create(t, s, n, m, b, f, p) \
567 (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
568 #define bus_dmamap_destroy(t, p) \
569 (*(t)->_dmamap_destroy)((t), (p))
570 #define bus_dmamap_load(t, m, b, s, p, f) \
571 (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
572 #define bus_dmamap_load_mbuf(t, m, b, f) \
573 (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
574 #define bus_dmamap_load_uio(t, m, u, f) \
575 (*(t)->_dmamap_load_uio)((t), (m), (u), (f))
576 #define bus_dmamap_load_raw(t, m, sg, n, s, f) \
577 (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
578 #define bus_dmamap_unload(t, p) \
579 (*(t)->_dmamap_unload)((t), (p))
580 #define bus_dmamap_sync(t, p, o, l, ops) \
581 (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
583 #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
584 (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
585 #define bus_dmamem_free(t, sg, n) \
586 (*(t)->_dmamem_free)((t), (sg), (n))
587 #define bus_dmamem_map(t, sg, n, s, k, f) \
588 (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
589 #define bus_dmamem_unmap(t, k, s) \
590 (*(t)->_dmamem_unmap)((t), (k), (s))
591 #define bus_dmamem_mmap(t, sg, n, o, p, f) \
592 (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
594 #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
595 #define bus_dmatag_destroy(t)
600 * Describes a DMA mapping.
602 struct newsmips_bus_dmamap
{
604 * PRIVATE MEMBERS: not for use my machine-independent code.
606 bus_size_t _dm_size
; /* largest DMA transfer mappable */
607 int _dm_segcnt
; /* number of segs this map can map */
608 bus_size_t _dm_maxmaxsegsz
; /* fixed largest possible segment */
609 bus_size_t _dm_boundary
; /* don't cross this */
610 int _dm_flags
; /* misc. flags */
611 int _dm_maptbl
; /* DMA mapping table index */
612 int _dm_maptblcnt
; /* number of DMA mapping table */
613 struct vmspace
*_dm_vmspace
; /* vmspace that owns the mapping */
616 * PUBLIC MEMBERS: these are used by machine-independent code.
618 bus_size_t dm_maxsegsz
; /* largest possible segment */
619 bus_size_t dm_mapsize
; /* size of the mapping */
620 int dm_nsegs
; /* # valid segments in mapping */
621 bus_dma_segment_t dm_segs
[1]; /* segments; variable length */
624 #ifdef _NEWSMIPS_BUS_DMA_PRIVATE
625 void newsmips_bus_dma_init(void);
627 int _bus_dmamap_create(bus_dma_tag_t
, bus_size_t
, int, bus_size_t
,
628 bus_size_t
, int, bus_dmamap_t
*);
629 void _bus_dmamap_destroy(bus_dma_tag_t
, bus_dmamap_t
);
630 int _bus_dmamap_load(bus_dma_tag_t
, bus_dmamap_t
, void *,
631 bus_size_t
, struct proc
*, int);
632 int _bus_dmamap_load_mbuf(bus_dma_tag_t
, bus_dmamap_t
,
634 int _bus_dmamap_load_uio(bus_dma_tag_t
, bus_dmamap_t
,
636 int _bus_dmamap_load_raw(bus_dma_tag_t
, bus_dmamap_t
,
637 bus_dma_segment_t
*, int, bus_size_t
, int);
638 void _bus_dmamap_unload(bus_dma_tag_t
, bus_dmamap_t
);
639 void _bus_dmamap_sync_r3k(bus_dma_tag_t
, bus_dmamap_t
, bus_addr_t
,
641 void _bus_dmamap_sync_r4k(bus_dma_tag_t
, bus_dmamap_t
, bus_addr_t
,
644 int _bus_dmamem_alloc(bus_dma_tag_t tag
, bus_size_t size
,
645 bus_size_t alignment
, bus_size_t boundary
,
646 bus_dma_segment_t
*segs
, int nsegs
, int *rsegs
, int flags
);
647 void _bus_dmamem_free(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
649 int _bus_dmamem_map(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
650 int nsegs
, size_t size
, void **kvap
, int flags
);
651 void _bus_dmamem_unmap(bus_dma_tag_t tag
, void *kva
,
653 paddr_t
_bus_dmamem_mmap(bus_dma_tag_t tag
, bus_dma_segment_t
*segs
,
654 int nsegs
, off_t off
, int prot
, int flags
);
656 int _bus_dmamem_alloc_range(bus_dma_tag_t tag
, bus_size_t size
,
657 bus_size_t alignment
, bus_size_t boundary
,
658 bus_dma_segment_t
*segs
, int nsegs
, int *rsegs
, int flags
,
659 vaddr_t low
, vaddr_t high
);
661 extern struct newsmips_bus_dma_tag newsmips_default_bus_dma_tag
;
662 #endif /* _NEWSMIPS_BUS_DMA_PRIVATE */
664 #endif /* _NEWSMIPS_BUS_H_ */