bus_funcs.h revision 1.1
11.1Sdyoung/*	$NetBSD: bus_funcs.h,v 1.1 2011/07/01 17:09:58 dyoung Exp $	*/
21.1Sdyoung
31.1Sdyoung/*-
41.1Sdyoung * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
51.1Sdyoung * All rights reserved.
61.1Sdyoung *
71.1Sdyoung * This code is derived from software contributed to The NetBSD Foundation
81.1Sdyoung * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
91.1Sdyoung * NASA Ames Research Center.
101.1Sdyoung *
111.1Sdyoung * Redistribution and use in source and binary forms, with or without
121.1Sdyoung * modification, are permitted provided that the following conditions
131.1Sdyoung * are met:
141.1Sdyoung * 1. Redistributions of source code must retain the above copyright
151.1Sdyoung *    notice, this list of conditions and the following disclaimer.
161.1Sdyoung * 2. Redistributions in binary form must reproduce the above copyright
171.1Sdyoung *    notice, this list of conditions and the following disclaimer in the
181.1Sdyoung *    documentation and/or other materials provided with the distribution.
191.1Sdyoung *
201.1Sdyoung * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
211.1Sdyoung * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
221.1Sdyoung * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
231.1Sdyoung * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
241.1Sdyoung * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
251.1Sdyoung * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
261.1Sdyoung * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
271.1Sdyoung * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
281.1Sdyoung * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
291.1Sdyoung * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
301.1Sdyoung * POSSIBILITY OF SUCH DAMAGE.
311.1Sdyoung */
321.1Sdyoung
331.1Sdyoung/*
341.1Sdyoung * Copyright (c) 1996 Carnegie-Mellon University.
351.1Sdyoung * All rights reserved.
361.1Sdyoung *
371.1Sdyoung * Author: Chris G. Demetriou
381.1Sdyoung *
391.1Sdyoung * Permission to use, copy, modify and distribute this software and
401.1Sdyoung * its documentation is hereby granted, provided that both the copyright
411.1Sdyoung * notice and this permission notice appear in all copies of the
421.1Sdyoung * software, derivative works or modified versions, and any portions
431.1Sdyoung * thereof, and that both notices appear in supporting documentation.
441.1Sdyoung *
451.1Sdyoung * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
461.1Sdyoung * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
471.1Sdyoung * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
481.1Sdyoung *
491.1Sdyoung * Carnegie Mellon requests users of this software to return to
501.1Sdyoung *
511.1Sdyoung *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
521.1Sdyoung *  School of Computer Science
531.1Sdyoung *  Carnegie Mellon University
541.1Sdyoung *  Pittsburgh PA 15213-3890
551.1Sdyoung *
561.1Sdyoung * any improvements or extensions that they make and grant Carnegie the
571.1Sdyoung * rights to redistribute these changes.
581.1Sdyoung */
591.1Sdyoung
601.1Sdyoung#ifndef _ALGOR_BUS_FUNCS_H_
611.1Sdyoung#define	_ALGOR_BUS_FUNCS_H_
621.1Sdyoung
631.1Sdyoung#ifdef _KERNEL
641.1Sdyoung/*
651.1Sdyoung * Access methods for bus space.
661.1Sdyoung */
671.1Sdyoung
681.1Sdyoung/*
691.1Sdyoung * Utility macros; INTERNAL USE ONLY.
701.1Sdyoung */
711.1Sdyoung#define	__bs_c(a,b)		__CONCAT(a,b)
721.1Sdyoung#define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size)
731.1Sdyoung
741.1Sdyoung#define	__bs_rs(sz, tn, t, h, o)					\
751.1Sdyoung	(__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"),		\
761.1Sdyoung	 (*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o))
771.1Sdyoung
781.1Sdyoung#define	__bs_ws(sz, tn, t, h, o, v)					\
791.1Sdyoungdo {									\
801.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr");		\
811.1Sdyoung	(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v);		\
821.1Sdyoung} while (0)
831.1Sdyoung
841.1Sdyoung#define	__bs_nonsingle(type, sz, tn, t, h, o, a, c)			\
851.1Sdyoungdo {									\
861.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((a), tn, "buffer");			\
871.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr");		\
881.1Sdyoung	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c);	\
891.1Sdyoung} while (0)
901.1Sdyoung
911.1Sdyoung#define	__bs_set(type, sz, tn, t, h, o, v, c)				\
921.1Sdyoungdo {									\
931.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr");		\
941.1Sdyoung	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c);	\
951.1Sdyoung} while (0)
961.1Sdyoung
971.1Sdyoung#define	__bs_copy(sz, tn, t, h1, o1, h2, o2, cnt)			\
981.1Sdyoungdo {									\
991.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((h1) + (o1), tn, "bus addr 1");	\
1001.1Sdyoung	__BUS_SPACE_ADDRESS_SANITY((h2) + (o2), tn, "bus addr 2");	\
1011.1Sdyoung	(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt); \
1021.1Sdyoung} while (0)
1031.1Sdyoung
1041.1Sdyoung
1051.1Sdyoung/*
1061.1Sdyoung * Mapping and unmapping operations.
1071.1Sdyoung */
1081.1Sdyoung#define	bus_space_map(t, a, s, f, hp)					\
1091.1Sdyoung	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (f), (hp), 1)
1101.1Sdyoung#define	algor_bus_space_map_noacct(t, a, s, f, hp)			\
1111.1Sdyoung	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (f), (hp), 0)
1121.1Sdyoung#define	bus_space_unmap(t, h, s)					\
1131.1Sdyoung	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s), 1)
1141.1Sdyoung#define	algor_bus_space_unmap_noacct(t, h, s)				\
1151.1Sdyoung	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s), 0)
1161.1Sdyoung#define	bus_space_subregion(t, h, o, s, hp)				\
1171.1Sdyoung	(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
1181.1Sdyoung
1191.1Sdyoung#define	algor_bus_space_translate(t, a, s, f, bst)			\
1201.1Sdyoung	(*(t)->bs_translate)((t)->bs_cookie, (a), (s), (f), (bst))
1211.1Sdyoung#define	algor_bus_space_get_window(t, w, bst)				\
1221.1Sdyoung	(*(t)->bs_get_window)((t)->bs_cookie, (w), (bst))
1231.1Sdyoung
1241.1Sdyoung/*
1251.1Sdyoung * Allocation and deallocation operations.
1261.1Sdyoung */
1271.1Sdyoung#define	bus_space_alloc(t, rs, re, s, a, b, f, ap, hp)			\
1281.1Sdyoung	(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),	\
1291.1Sdyoung	    (f), (ap), (hp))
1301.1Sdyoung#define	bus_space_free(t, h, s)						\
1311.1Sdyoung	(*(t)->bs_free)((t)->bs_cookie, (h), (s))
1321.1Sdyoung
1331.1Sdyoung/*
1341.1Sdyoung * Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR.
1351.1Sdyoung */
1361.1Sdyoung#define bus_space_vaddr(t, h) \
1371.1Sdyoung	(*(t)->bs_vaddr)((t)->bs_cookie, (h))
1381.1Sdyoung
1391.1Sdyoung/*
1401.1Sdyoung * Mmap for user.
1411.1Sdyoung */
1421.1Sdyoung#define	bus_space_mmap(t, a, o, p, f)					\
1431.1Sdyoung	(*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f))
1441.1Sdyoung
1451.1Sdyoung/*
1461.1Sdyoung * Bus barrier operations.
1471.1Sdyoung */
1481.1Sdyoung#define	bus_space_barrier(t, h, o, l, f)				\
1491.1Sdyoung	(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
1501.1Sdyoung
1511.1Sdyoung/*
1521.1Sdyoung * Bus read (single) operations.
1531.1Sdyoung */
1541.1Sdyoung#define	bus_space_read_1(t, h, o)	__bs_rs(1,u_int8_t,(t),(h),(o))
1551.1Sdyoung#define	bus_space_read_2(t, h, o)	__bs_rs(2,u_int16_t,(t),(h),(o))
1561.1Sdyoung#define	bus_space_read_4(t, h, o)	__bs_rs(4,u_int32_t,(t),(h),(o))
1571.1Sdyoung#define	bus_space_read_8(t, h, o)	__bs_rs(8,u_int64_t,(t),(h),(o))
1581.1Sdyoung
1591.1Sdyoung
1601.1Sdyoung/*
1611.1Sdyoung * Bus read multiple operations.
1621.1Sdyoung */
1631.1Sdyoung#define	bus_space_read_multi_1(t, h, o, a, c)				\
1641.1Sdyoung	__bs_nonsingle(rm,1,u_int8_t,(t),(h),(o),(a),(c))
1651.1Sdyoung#define	bus_space_read_multi_2(t, h, o, a, c)				\
1661.1Sdyoung	__bs_nonsingle(rm,2,u_int16_t,(t),(h),(o),(a),(c))
1671.1Sdyoung#define	bus_space_read_multi_4(t, h, o, a, c)				\
1681.1Sdyoung	__bs_nonsingle(rm,4,u_int32_t,(t),(h),(o),(a),(c))
1691.1Sdyoung#define	bus_space_read_multi_8(t, h, o, a, c)				\
1701.1Sdyoung	__bs_nonsingle(rm,8,u_int64_t,(t),(h),(o),(a),(c))
1711.1Sdyoung
1721.1Sdyoung
1731.1Sdyoung/*
1741.1Sdyoung * Bus read region operations.
1751.1Sdyoung */
1761.1Sdyoung#define	bus_space_read_region_1(t, h, o, a, c)				\
1771.1Sdyoung	__bs_nonsingle(rr,1,u_int8_t,(t),(h),(o),(a),(c))
1781.1Sdyoung#define	bus_space_read_region_2(t, h, o, a, c)				\
1791.1Sdyoung	__bs_nonsingle(rr,2,u_int16_t,(t),(h),(o),(a),(c))
1801.1Sdyoung#define	bus_space_read_region_4(t, h, o, a, c)				\
1811.1Sdyoung	__bs_nonsingle(rr,4,u_int32_t,(t),(h),(o),(a),(c))
1821.1Sdyoung#define	bus_space_read_region_8(t, h, o, a, c)				\
1831.1Sdyoung	__bs_nonsingle(rr,8,u_int64_t,(t),(h),(o),(a),(c))
1841.1Sdyoung
1851.1Sdyoung
1861.1Sdyoung/*
1871.1Sdyoung * Bus write (single) operations.
1881.1Sdyoung */
1891.1Sdyoung#define	bus_space_write_1(t, h, o, v)	__bs_ws(1,u_int8_t,(t),(h),(o),(v))
1901.1Sdyoung#define	bus_space_write_2(t, h, o, v)	__bs_ws(2,u_int16_t,(t),(h),(o),(v))
1911.1Sdyoung#define	bus_space_write_4(t, h, o, v)	__bs_ws(4,u_int32_t,(t),(h),(o),(v))
1921.1Sdyoung#define	bus_space_write_8(t, h, o, v)	__bs_ws(8,u_int64_t,(t),(h),(o),(v))
1931.1Sdyoung
1941.1Sdyoung
1951.1Sdyoung/*
1961.1Sdyoung * Bus write multiple operations.
1971.1Sdyoung */
1981.1Sdyoung#define	bus_space_write_multi_1(t, h, o, a, c)				\
1991.1Sdyoung	__bs_nonsingle(wm,1,u_int8_t,(t),(h),(o),(a),(c))
2001.1Sdyoung#define	bus_space_write_multi_2(t, h, o, a, c)				\
2011.1Sdyoung	__bs_nonsingle(wm,2,u_int16_t,(t),(h),(o),(a),(c))
2021.1Sdyoung#define	bus_space_write_multi_4(t, h, o, a, c)				\
2031.1Sdyoung	__bs_nonsingle(wm,4,u_int32_t,(t),(h),(o),(a),(c))
2041.1Sdyoung#define	bus_space_write_multi_8(t, h, o, a, c)				\
2051.1Sdyoung	__bs_nonsingle(wm,8,u_int64_t,(t),(h),(o),(a),(c))
2061.1Sdyoung
2071.1Sdyoung
2081.1Sdyoung/*
2091.1Sdyoung * Bus write region operations.
2101.1Sdyoung */
2111.1Sdyoung#define	bus_space_write_region_1(t, h, o, a, c)				\
2121.1Sdyoung	__bs_nonsingle(wr,1,u_int8_t,(t),(h),(o),(a),(c))
2131.1Sdyoung#define	bus_space_write_region_2(t, h, o, a, c)				\
2141.1Sdyoung	__bs_nonsingle(wr,2,u_int16_t,(t),(h),(o),(a),(c))
2151.1Sdyoung#define	bus_space_write_region_4(t, h, o, a, c)				\
2161.1Sdyoung	__bs_nonsingle(wr,4,u_int32_t,(t),(h),(o),(a),(c))
2171.1Sdyoung#define	bus_space_write_region_8(t, h, o, a, c)				\
2181.1Sdyoung	__bs_nonsingle(wr,8,u_int64_t,(t),(h),(o),(a),(c))
2191.1Sdyoung
2201.1Sdyoung
2211.1Sdyoung/*
2221.1Sdyoung * Set multiple operations.
2231.1Sdyoung */
2241.1Sdyoung#define	bus_space_set_multi_1(t, h, o, v, c)				\
2251.1Sdyoung	__bs_set(sm,1,u_int8_t,(t),(h),(o),(v),(c))
2261.1Sdyoung#define	bus_space_set_multi_2(t, h, o, v, c)				\
2271.1Sdyoung	__bs_set(sm,2,u_int16_t,(t),(h),(o),(v),(c))
2281.1Sdyoung#define	bus_space_set_multi_4(t, h, o, v, c)				\
2291.1Sdyoung	__bs_set(sm,4,u_int32_t,(t),(h),(o),(v),(c))
2301.1Sdyoung#define	bus_space_set_multi_8(t, h, o, v, c)				\
2311.1Sdyoung	__bs_set(sm,8,u_int64_t,(t),(h),(o),(v),(c))
2321.1Sdyoung
2331.1Sdyoung
2341.1Sdyoung/*
2351.1Sdyoung * Set region operations.
2361.1Sdyoung */
2371.1Sdyoung#define	bus_space_set_region_1(t, h, o, v, c)				\
2381.1Sdyoung	__bs_set(sr,1,u_int8_t,(t),(h),(o),(v),(c))
2391.1Sdyoung#define	bus_space_set_region_2(t, h, o, v, c)				\
2401.1Sdyoung	__bs_set(sr,2,u_int16_t,(t),(h),(o),(v),(c))
2411.1Sdyoung#define	bus_space_set_region_4(t, h, o, v, c)				\
2421.1Sdyoung	__bs_set(sr,4,u_int32_t,(t),(h),(o),(v),(c))
2431.1Sdyoung#define	bus_space_set_region_8(t, h, o, v, c)				\
2441.1Sdyoung	__bs_set(sr,8,u_int64_t,(t),(h),(o),(v),(c))
2451.1Sdyoung
2461.1Sdyoung
2471.1Sdyoung/*
2481.1Sdyoung * Copy region operations.
2491.1Sdyoung */
2501.1Sdyoung#define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)			\
2511.1Sdyoung	__bs_copy(1, u_int8_t, (t), (h1), (o1), (h2), (o2), (c))
2521.1Sdyoung#define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)			\
2531.1Sdyoung	__bs_copy(2, u_int16_t, (t), (h1), (o1), (h2), (o2), (c))
2541.1Sdyoung#define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)			\
2551.1Sdyoung	__bs_copy(4, u_int32_t, (t), (h1), (o1), (h2), (o2), (c))
2561.1Sdyoung#define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)			\
2571.1Sdyoung	__bs_copy(8, u_int64_t, (t), (h1), (o1), (h2), (o2), (c))
2581.1Sdyoung
2591.1Sdyoung/*
2601.1Sdyoung * Bus stream operations--defined in terms of non-stream counterparts
2611.1Sdyoung */
2621.1Sdyoung#define bus_space_read_stream_1 bus_space_read_1
2631.1Sdyoung#define bus_space_read_stream_2 bus_space_read_2
2641.1Sdyoung#define bus_space_read_stream_4 bus_space_read_4
2651.1Sdyoung#define	bus_space_read_stream_8 bus_space_read_8
2661.1Sdyoung#define bus_space_read_multi_stream_1 bus_space_read_multi_1
2671.1Sdyoung#define bus_space_read_multi_stream_2 bus_space_read_multi_2
2681.1Sdyoung#define bus_space_read_multi_stream_4 bus_space_read_multi_4
2691.1Sdyoung#define	bus_space_read_multi_stream_8 bus_space_read_multi_8
2701.1Sdyoung#define bus_space_read_region_stream_1 bus_space_read_region_1
2711.1Sdyoung#define bus_space_read_region_stream_2 bus_space_read_region_2
2721.1Sdyoung#define bus_space_read_region_stream_4 bus_space_read_region_4
2731.1Sdyoung#define	bus_space_read_region_stream_8 bus_space_read_region_8
2741.1Sdyoung#define bus_space_write_stream_1 bus_space_write_1
2751.1Sdyoung#define bus_space_write_stream_2 bus_space_write_2
2761.1Sdyoung#define bus_space_write_stream_4 bus_space_write_4
2771.1Sdyoung#define	bus_space_write_stream_8 bus_space_write_8
2781.1Sdyoung#define bus_space_write_multi_stream_1 bus_space_write_multi_1
2791.1Sdyoung#define bus_space_write_multi_stream_2 bus_space_write_multi_2
2801.1Sdyoung#define bus_space_write_multi_stream_4 bus_space_write_multi_4
2811.1Sdyoung#define	bus_space_write_multi_stream_8 bus_space_write_multi_8
2821.1Sdyoung#define bus_space_write_region_stream_1 bus_space_write_region_1
2831.1Sdyoung#define bus_space_write_region_stream_2 bus_space_write_region_2
2841.1Sdyoung#define bus_space_write_region_stream_4 bus_space_write_region_4
2851.1Sdyoung#define	bus_space_write_region_stream_8	bus_space_write_region_8
2861.1Sdyoung
2871.1Sdyoung
2881.1Sdyoung/*
2891.1Sdyoung * Bus DMA methods.
2901.1Sdyoung */
2911.1Sdyoung
2921.1Sdyoung/* Forwards needed by prototypes below. */
2931.1Sdyoungstruct mbuf;
2941.1Sdyoungstruct uio;
2951.1Sdyoung
2961.1Sdyoung#define	bus_dmamap_create(t, s, n, m, b, f, p)			\
2971.1Sdyoung	(*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p))
2981.1Sdyoung#define	bus_dmamap_destroy(t, p)				\
2991.1Sdyoung	(*(t)->_dmamap_destroy)((t), (p))
3001.1Sdyoung#define	bus_dmamap_load(t, m, b, s, p, f)			\
3011.1Sdyoung	(*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f))
3021.1Sdyoung#define	bus_dmamap_load_mbuf(t, m, b, f)			\
3031.1Sdyoung	(*(t)->_dmamap_load_mbuf)((t), (m), (b), (f))
3041.1Sdyoung#define	bus_dmamap_load_uio(t, m, u, f)				\
3051.1Sdyoung	(*(t)->_dmamap_load_uio)((t), (m), (u), (f))
3061.1Sdyoung#define	bus_dmamap_load_raw(t, m, sg, n, s, f)			\
3071.1Sdyoung	(*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f))
3081.1Sdyoung#define	bus_dmamap_unload(t, p)					\
3091.1Sdyoung	(*(t)->_dmamap_unload)((t), (p))
3101.1Sdyoung#define	bus_dmamap_sync(t, p, o, l, ops)			\
3111.1Sdyoung	(*(t)->_dmamap_sync)((t), (p), (o), (l), (ops))
3121.1Sdyoung#define	bus_dmamem_alloc(t, s, a, b, sg, n, r, f)		\
3131.1Sdyoung	(*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f))
3141.1Sdyoung#define	bus_dmamem_free(t, sg, n)				\
3151.1Sdyoung	(*(t)->_dmamem_free)((t), (sg), (n))
3161.1Sdyoung#define	bus_dmamem_map(t, sg, n, s, k, f)			\
3171.1Sdyoung	(*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f))
3181.1Sdyoung#define	bus_dmamem_unmap(t, k, s)				\
3191.1Sdyoung	(*(t)->_dmamem_unmap)((t), (k), (s))
3201.1Sdyoung#define	bus_dmamem_mmap(t, sg, n, o, p, f)			\
3211.1Sdyoung	(*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
3221.1Sdyoung
3231.1Sdyoung#define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
3241.1Sdyoung#define bus_dmatag_destroy(t)
3251.1Sdyoung
3261.1Sdyoung#ifdef _ALGOR_BUS_DMA_PRIVATE
3271.1Sdyoungint	_bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
3281.1Sdyoung	    bus_size_t, int, bus_dmamap_t *);
3291.1Sdyoungvoid	_bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
3301.1Sdyoung
3311.1Sdyoungint	_bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t,
3321.1Sdyoung	    void *, bus_size_t, struct proc *, int);
3331.1Sdyoungint	_bus_dmamap_load_mbuf(bus_dma_tag_t,
3341.1Sdyoung	    bus_dmamap_t, struct mbuf *, int);
3351.1Sdyoungint	_bus_dmamap_load_uio(bus_dma_tag_t,
3361.1Sdyoung	    bus_dmamap_t, struct uio *, int);
3371.1Sdyoungint	_bus_dmamap_load_raw(bus_dma_tag_t,
3381.1Sdyoung	    bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int);
3391.1Sdyoung
3401.1Sdyoungvoid	_bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
3411.1Sdyoungvoid	_bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
3421.1Sdyoung	    bus_size_t, int);
3431.1Sdyoung
3441.1Sdyoungint	_bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
3451.1Sdyoung	    bus_size_t alignment, bus_size_t boundary,
3461.1Sdyoung	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
3471.1Sdyoungint	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
3481.1Sdyoung	    bus_size_t alignment, bus_size_t boundary,
3491.1Sdyoung	    bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
3501.1Sdyoung	    paddr_t low, paddr_t high);
3511.1Sdyoungvoid	_bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
3521.1Sdyoung	    int nsegs);
3531.1Sdyoungint	_bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
3541.1Sdyoung	    int nsegs, size_t size, void **kvap, int flags);
3551.1Sdyoungvoid	_bus_dmamem_unmap(bus_dma_tag_t tag, void *kva,
3561.1Sdyoung	    size_t size);
3571.1Sdyoungpaddr_t	_bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
3581.1Sdyoung	    int nsegs, off_t off, int prot, int flags);
3591.1Sdyoung#endif /* _ALGOR_BUS_DMA_PRIVATE */
3601.1Sdyoung
3611.1Sdyoung#endif /* _KERNEL */
3621.1Sdyoung
3631.1Sdyoung#endif /* _ALGOR_BUS_FUNCS_H_ */
364