xref: /freebsd/sys/arm/include/bus.h (revision 588a2322a991f6ecc1226bd8dca1b58aee59568d)
16fc729afSOlivier Houchard /*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/
26fc729afSOlivier Houchard 
36fc729afSOlivier Houchard /*-
46fc729afSOlivier Houchard  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
56fc729afSOlivier Houchard  * All rights reserved.
66fc729afSOlivier Houchard  *
76fc729afSOlivier Houchard  * This code is derived from software contributed to The NetBSD Foundation
86fc729afSOlivier Houchard  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
96fc729afSOlivier Houchard  * NASA Ames Research Center.
106fc729afSOlivier Houchard  *
116fc729afSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
126fc729afSOlivier Houchard  * modification, are permitted provided that the following conditions
136fc729afSOlivier Houchard  * are met:
146fc729afSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
156fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
166fc729afSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
176fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
186fc729afSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
196fc729afSOlivier Houchard  * 3. All advertising materials mentioning features or use of this software
206fc729afSOlivier Houchard  *    must display the following acknowledgement:
216fc729afSOlivier Houchard  *	This product includes software developed by the NetBSD
226fc729afSOlivier Houchard  *	Foundation, Inc. and its contributors.
236fc729afSOlivier Houchard  * 4. Neither the name of The NetBSD Foundation nor the names of its
246fc729afSOlivier Houchard  *    contributors may be used to endorse or promote products derived
256fc729afSOlivier Houchard  *    from this software without specific prior written permission.
266fc729afSOlivier Houchard  *
276fc729afSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
286fc729afSOlivier Houchard  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
296fc729afSOlivier Houchard  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
306fc729afSOlivier Houchard  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
316fc729afSOlivier Houchard  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
326fc729afSOlivier Houchard  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
336fc729afSOlivier Houchard  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
346fc729afSOlivier Houchard  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
356fc729afSOlivier Houchard  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
366fc729afSOlivier Houchard  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
376fc729afSOlivier Houchard  * POSSIBILITY OF SUCH DAMAGE.
386fc729afSOlivier Houchard  */
396fc729afSOlivier Houchard 
40d8315c79SWarner Losh /*-
416fc729afSOlivier Houchard  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
426fc729afSOlivier Houchard  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
436fc729afSOlivier Houchard  *
446fc729afSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
456fc729afSOlivier Houchard  * modification, are permitted provided that the following conditions
466fc729afSOlivier Houchard  * are met:
476fc729afSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
486fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
496fc729afSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
506fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
516fc729afSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
526fc729afSOlivier Houchard  * 3. All advertising materials mentioning features or use of this software
536fc729afSOlivier Houchard  *    must display the following acknowledgement:
546fc729afSOlivier Houchard  *      This product includes software developed by Christopher G. Demetriou
556fc729afSOlivier Houchard  *	for the NetBSD Project.
566fc729afSOlivier Houchard  * 4. The name of the author may not be used to endorse or promote products
576fc729afSOlivier Houchard  *    derived from this software without specific prior written permission
586fc729afSOlivier Houchard  *
596fc729afSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
606fc729afSOlivier Houchard  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
616fc729afSOlivier Houchard  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
626fc729afSOlivier Houchard  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
636fc729afSOlivier Houchard  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
646fc729afSOlivier Houchard  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
656fc729afSOlivier Houchard  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
666fc729afSOlivier Houchard  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
676fc729afSOlivier Houchard  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
686fc729afSOlivier Houchard  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
696fc729afSOlivier Houchard  *
706fc729afSOlivier Houchard  * $FreeBSD$
716fc729afSOlivier Houchard  */
726fc729afSOlivier Houchard 
736fc729afSOlivier Houchard #ifndef _MACHINE_BUS_H_
746fc729afSOlivier Houchard #define _MACHINE_BUS_H_
756fc729afSOlivier Houchard 
7606db52b6SWarner Losh #include <machine/_bus.h>
776fc729afSOlivier Houchard 
786fc729afSOlivier Houchard /*
796fc729afSOlivier Houchard  *	int bus_space_map  (bus_space_tag_t t, bus_addr_t addr,
806fc729afSOlivier Houchard  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
816fc729afSOlivier Houchard  *
826fc729afSOlivier Houchard  * Map a region of bus space.
836fc729afSOlivier Houchard  */
846fc729afSOlivier Houchard 
856fc729afSOlivier Houchard #define	BUS_SPACE_MAP_CACHEABLE		0x01
866fc729afSOlivier Houchard #define	BUS_SPACE_MAP_LINEAR		0x02
876fc729afSOlivier Houchard #define	BUS_SPACE_MAP_PREFETCHABLE     	0x04
886fc729afSOlivier Houchard 
896fc729afSOlivier Houchard struct bus_space {
906fc729afSOlivier Houchard 	/* cookie */
916fc729afSOlivier Houchard 	void		*bs_cookie;
926fc729afSOlivier Houchard 
936fc729afSOlivier Houchard 	/* mapping/unmapping */
946fc729afSOlivier Houchard 	int		(*bs_map) (void *, bus_addr_t, bus_size_t,
956fc729afSOlivier Houchard 			    int, bus_space_handle_t *);
96588a2322SSam Leffler 	void		(*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
976fc729afSOlivier Houchard 	int		(*bs_subregion) (void *, bus_space_handle_t,
986fc729afSOlivier Houchard 			    bus_size_t, bus_size_t, bus_space_handle_t *);
996fc729afSOlivier Houchard 
1006fc729afSOlivier Houchard 	/* allocation/deallocation */
1016fc729afSOlivier Houchard 	int		(*bs_alloc) (void *, bus_addr_t, bus_addr_t,
1026fc729afSOlivier Houchard 			    bus_size_t, bus_size_t, bus_size_t, int,
1036fc729afSOlivier Houchard 			    bus_addr_t *, bus_space_handle_t *);
1046fc729afSOlivier Houchard 	void		(*bs_free) (void *, bus_space_handle_t,
1056fc729afSOlivier Houchard 			    bus_size_t);
1066fc729afSOlivier Houchard 
1076fc729afSOlivier Houchard 	/* get kernel virtual address */
1086fc729afSOlivier Houchard 	/* barrier */
1096fc729afSOlivier Houchard 	void		(*bs_barrier) (void *, bus_space_handle_t,
1106fc729afSOlivier Houchard 			    bus_size_t, bus_size_t, int);
1116fc729afSOlivier Houchard 
1126fc729afSOlivier Houchard 	/* read (single) */
1136fc729afSOlivier Houchard 	u_int8_t	(*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
1146fc729afSOlivier Houchard 	u_int16_t	(*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
1156fc729afSOlivier Houchard 	u_int32_t	(*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
1166fc729afSOlivier Houchard 	u_int64_t	(*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
1176fc729afSOlivier Houchard 
1186fc729afSOlivier Houchard 	/* read multiple */
1196fc729afSOlivier Houchard 	void		(*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
1206fc729afSOlivier Houchard 	    u_int8_t *, bus_size_t);
1216fc729afSOlivier Houchard 	void		(*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
1226fc729afSOlivier Houchard 	    u_int16_t *, bus_size_t);
1236fc729afSOlivier Houchard 	void		(*bs_rm_4) (void *, bus_space_handle_t,
1246fc729afSOlivier Houchard 			    bus_size_t, u_int32_t *, bus_size_t);
1256fc729afSOlivier Houchard 	void		(*bs_rm_8) (void *, bus_space_handle_t,
1266fc729afSOlivier Houchard 			    bus_size_t, u_int64_t *, bus_size_t);
1276fc729afSOlivier Houchard 
1286fc729afSOlivier Houchard 	/* read region */
1296fc729afSOlivier Houchard 	void		(*bs_rr_1) (void *, bus_space_handle_t,
1306fc729afSOlivier Houchard 			    bus_size_t, u_int8_t *, bus_size_t);
1316fc729afSOlivier Houchard 	void		(*bs_rr_2) (void *, bus_space_handle_t,
1326fc729afSOlivier Houchard 			    bus_size_t, u_int16_t *, bus_size_t);
1336fc729afSOlivier Houchard 	void		(*bs_rr_4) (void *, bus_space_handle_t,
1346fc729afSOlivier Houchard 			    bus_size_t, u_int32_t *, bus_size_t);
1356fc729afSOlivier Houchard 	void		(*bs_rr_8) (void *, bus_space_handle_t,
1366fc729afSOlivier Houchard 			    bus_size_t, u_int64_t *, bus_size_t);
1376fc729afSOlivier Houchard 
1386fc729afSOlivier Houchard 	/* write (single) */
1396fc729afSOlivier Houchard 	void		(*bs_w_1) (void *, bus_space_handle_t,
1406fc729afSOlivier Houchard 			    bus_size_t, u_int8_t);
1416fc729afSOlivier Houchard 	void		(*bs_w_2) (void *, bus_space_handle_t,
1426fc729afSOlivier Houchard 			    bus_size_t, u_int16_t);
1436fc729afSOlivier Houchard 	void		(*bs_w_4) (void *, bus_space_handle_t,
1446fc729afSOlivier Houchard 			    bus_size_t, u_int32_t);
1456fc729afSOlivier Houchard 	void		(*bs_w_8) (void *, bus_space_handle_t,
1466fc729afSOlivier Houchard 			    bus_size_t, u_int64_t);
1476fc729afSOlivier Houchard 
1486fc729afSOlivier Houchard 	/* write multiple */
1496fc729afSOlivier Houchard 	void		(*bs_wm_1) (void *, bus_space_handle_t,
1506fc729afSOlivier Houchard 			    bus_size_t, const u_int8_t *, bus_size_t);
1516fc729afSOlivier Houchard 	void		(*bs_wm_2) (void *, bus_space_handle_t,
1526fc729afSOlivier Houchard 			    bus_size_t, const u_int16_t *, bus_size_t);
1536fc729afSOlivier Houchard 	void		(*bs_wm_4) (void *, bus_space_handle_t,
1546fc729afSOlivier Houchard 			    bus_size_t, const u_int32_t *, bus_size_t);
1556fc729afSOlivier Houchard 	void		(*bs_wm_8) (void *, bus_space_handle_t,
1566fc729afSOlivier Houchard 			    bus_size_t, const u_int64_t *, bus_size_t);
1576fc729afSOlivier Houchard 
1586fc729afSOlivier Houchard 	/* write region */
1596fc729afSOlivier Houchard 	void		(*bs_wr_1) (void *, bus_space_handle_t,
1606fc729afSOlivier Houchard 			    bus_size_t, const u_int8_t *, bus_size_t);
1616fc729afSOlivier Houchard 	void		(*bs_wr_2) (void *, bus_space_handle_t,
1626fc729afSOlivier Houchard 			    bus_size_t, const u_int16_t *, bus_size_t);
1636fc729afSOlivier Houchard 	void		(*bs_wr_4) (void *, bus_space_handle_t,
1646fc729afSOlivier Houchard 			    bus_size_t, const u_int32_t *, bus_size_t);
1656fc729afSOlivier Houchard 	void		(*bs_wr_8) (void *, bus_space_handle_t,
1666fc729afSOlivier Houchard 			    bus_size_t, const u_int64_t *, bus_size_t);
1676fc729afSOlivier Houchard 
1686fc729afSOlivier Houchard 	/* set multiple */
1696fc729afSOlivier Houchard 	void		(*bs_sm_1) (void *, bus_space_handle_t,
1706fc729afSOlivier Houchard 			    bus_size_t, u_int8_t, bus_size_t);
1716fc729afSOlivier Houchard 	void		(*bs_sm_2) (void *, bus_space_handle_t,
1726fc729afSOlivier Houchard 			    bus_size_t, u_int16_t, bus_size_t);
1736fc729afSOlivier Houchard 	void		(*bs_sm_4) (void *, bus_space_handle_t,
1746fc729afSOlivier Houchard 			    bus_size_t, u_int32_t, bus_size_t);
1756fc729afSOlivier Houchard 	void		(*bs_sm_8) (void *, bus_space_handle_t,
1766fc729afSOlivier Houchard 			    bus_size_t, u_int64_t, bus_size_t);
1776fc729afSOlivier Houchard 
1786fc729afSOlivier Houchard 	/* set region */
1796fc729afSOlivier Houchard 	void		(*bs_sr_1) (void *, bus_space_handle_t,
1806fc729afSOlivier Houchard 			    bus_size_t, u_int8_t, bus_size_t);
1816fc729afSOlivier Houchard 	void		(*bs_sr_2) (void *, bus_space_handle_t,
1826fc729afSOlivier Houchard 			    bus_size_t, u_int16_t, bus_size_t);
1836fc729afSOlivier Houchard 	void		(*bs_sr_4) (void *, bus_space_handle_t,
1846fc729afSOlivier Houchard 			    bus_size_t, u_int32_t, bus_size_t);
1856fc729afSOlivier Houchard 	void		(*bs_sr_8) (void *, bus_space_handle_t,
1866fc729afSOlivier Houchard 			    bus_size_t, u_int64_t, bus_size_t);
1876fc729afSOlivier Houchard 
1886fc729afSOlivier Houchard 	/* copy */
1896fc729afSOlivier Houchard 	void		(*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
1906fc729afSOlivier Houchard 			    bus_space_handle_t, bus_size_t, bus_size_t);
1916fc729afSOlivier Houchard 	void		(*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
1926fc729afSOlivier Houchard 			    bus_space_handle_t, bus_size_t, bus_size_t);
1936fc729afSOlivier Houchard 	void		(*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
1946fc729afSOlivier Houchard 			    bus_space_handle_t, bus_size_t, bus_size_t);
1956fc729afSOlivier Houchard 	void		(*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
1966fc729afSOlivier Houchard 			    bus_space_handle_t, bus_size_t, bus_size_t);
1976fc729afSOlivier Houchard 
198588a2322SSam Leffler 	/* read stream (single) */
199588a2322SSam Leffler 	u_int8_t	(*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
200588a2322SSam Leffler 	u_int16_t	(*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
201588a2322SSam Leffler 	u_int32_t	(*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
202588a2322SSam Leffler 	u_int64_t	(*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
203588a2322SSam Leffler 
204588a2322SSam Leffler 	/* read multiple stream */
205588a2322SSam Leffler 	void		(*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
206588a2322SSam Leffler 	    u_int8_t *, bus_size_t);
207588a2322SSam Leffler 	void		(*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
208588a2322SSam Leffler 	    u_int16_t *, bus_size_t);
209588a2322SSam Leffler 	void		(*bs_rm_4_s) (void *, bus_space_handle_t,
210588a2322SSam Leffler 			    bus_size_t, u_int32_t *, bus_size_t);
211588a2322SSam Leffler 	void		(*bs_rm_8_s) (void *, bus_space_handle_t,
212588a2322SSam Leffler 			    bus_size_t, u_int64_t *, bus_size_t);
213588a2322SSam Leffler 
214588a2322SSam Leffler 	/* read region stream */
215588a2322SSam Leffler 	void		(*bs_rr_1_s) (void *, bus_space_handle_t,
216588a2322SSam Leffler 			    bus_size_t, u_int8_t *, bus_size_t);
217588a2322SSam Leffler 	void		(*bs_rr_2_s) (void *, bus_space_handle_t,
218588a2322SSam Leffler 			    bus_size_t, u_int16_t *, bus_size_t);
219588a2322SSam Leffler 	void		(*bs_rr_4_s) (void *, bus_space_handle_t,
220588a2322SSam Leffler 			    bus_size_t, u_int32_t *, bus_size_t);
221588a2322SSam Leffler 	void		(*bs_rr_8_s) (void *, bus_space_handle_t,
222588a2322SSam Leffler 			    bus_size_t, u_int64_t *, bus_size_t);
223588a2322SSam Leffler 
224588a2322SSam Leffler 	/* write stream (single) */
225588a2322SSam Leffler 	void		(*bs_w_1_s) (void *, bus_space_handle_t,
226588a2322SSam Leffler 			    bus_size_t, u_int8_t);
227588a2322SSam Leffler 	void		(*bs_w_2_s) (void *, bus_space_handle_t,
228588a2322SSam Leffler 			    bus_size_t, u_int16_t);
229588a2322SSam Leffler 	void		(*bs_w_4_s) (void *, bus_space_handle_t,
230588a2322SSam Leffler 			    bus_size_t, u_int32_t);
231588a2322SSam Leffler 	void		(*bs_w_8_s) (void *, bus_space_handle_t,
232588a2322SSam Leffler 			    bus_size_t, u_int64_t);
233588a2322SSam Leffler 
234588a2322SSam Leffler 	/* write multiple stream */
235588a2322SSam Leffler 	void		(*bs_wm_1_s) (void *, bus_space_handle_t,
236588a2322SSam Leffler 			    bus_size_t, const u_int8_t *, bus_size_t);
237588a2322SSam Leffler 	void		(*bs_wm_2_s) (void *, bus_space_handle_t,
238588a2322SSam Leffler 			    bus_size_t, const u_int16_t *, bus_size_t);
239588a2322SSam Leffler 	void		(*bs_wm_4_s) (void *, bus_space_handle_t,
240588a2322SSam Leffler 			    bus_size_t, const u_int32_t *, bus_size_t);
241588a2322SSam Leffler 	void		(*bs_wm_8_s) (void *, bus_space_handle_t,
242588a2322SSam Leffler 			    bus_size_t, const u_int64_t *, bus_size_t);
243588a2322SSam Leffler 
244588a2322SSam Leffler 	/* write region stream */
245588a2322SSam Leffler 	void		(*bs_wr_1_s) (void *, bus_space_handle_t,
246588a2322SSam Leffler 			    bus_size_t, const u_int8_t *, bus_size_t);
247588a2322SSam Leffler 	void		(*bs_wr_2_s) (void *, bus_space_handle_t,
248588a2322SSam Leffler 			    bus_size_t, const u_int16_t *, bus_size_t);
249588a2322SSam Leffler 	void		(*bs_wr_4_s) (void *, bus_space_handle_t,
250588a2322SSam Leffler 			    bus_size_t, const u_int32_t *, bus_size_t);
251588a2322SSam Leffler 	void		(*bs_wr_8_s) (void *, bus_space_handle_t,
252588a2322SSam Leffler 			    bus_size_t, const u_int64_t *, bus_size_t);
2536fc729afSOlivier Houchard };
2546fc729afSOlivier Houchard 
2556fc729afSOlivier Houchard 
2566fc729afSOlivier Houchard /*
2576fc729afSOlivier Houchard  * Utility macros; INTERNAL USE ONLY.
2586fc729afSOlivier Houchard  */
2596fc729afSOlivier Houchard #define	__bs_c(a,b)		__CONCAT(a,b)
2606fc729afSOlivier Houchard #define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size)
2616fc729afSOlivier Houchard 
2626fc729afSOlivier Houchard #define	__bs_rs(sz, t, h, o)						\
2636fc729afSOlivier Houchard 	(*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
2646fc729afSOlivier Houchard #define	__bs_ws(sz, t, h, o, v)						\
2656fc729afSOlivier Houchard 	(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
2666fc729afSOlivier Houchard #define	__bs_nonsingle(type, sz, t, h, o, a, c)				\
2676fc729afSOlivier Houchard 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
2686fc729afSOlivier Houchard #define	__bs_set(type, sz, t, h, o, v, c)				\
2696fc729afSOlivier Houchard 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
2706fc729afSOlivier Houchard #define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\
2716fc729afSOlivier Houchard 	(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
2726fc729afSOlivier Houchard 
273588a2322SSam Leffler #define	__bs_opname_s(op,size)	__bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
274588a2322SSam Leffler #define	__bs_rs_s(sz, t, h, o)						\
275588a2322SSam Leffler 	(*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
276588a2322SSam Leffler #define	__bs_ws_s(sz, t, h, o, v)					\
277588a2322SSam Leffler 	(*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
278588a2322SSam Leffler #define	__bs_nonsingle_s(type, sz, t, h, o, a, c)			\
279588a2322SSam Leffler 	(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
280588a2322SSam Leffler 
2816fc729afSOlivier Houchard 
2826fc729afSOlivier Houchard /*
2836fc729afSOlivier Houchard  * Mapping and unmapping operations.
2846fc729afSOlivier Houchard  */
2856fc729afSOlivier Houchard #define	bus_space_map(t, a, s, c, hp)					\
2866fc729afSOlivier Houchard 	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
2876fc729afSOlivier Houchard #define	bus_space_unmap(t, h, s)					\
2886fc729afSOlivier Houchard 	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
2896fc729afSOlivier Houchard #define	bus_space_subregion(t, h, o, s, hp)				\
2906fc729afSOlivier Houchard 	(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
2916fc729afSOlivier Houchard 
2926fc729afSOlivier Houchard 
2936fc729afSOlivier Houchard /*
2946fc729afSOlivier Houchard  * Allocation and deallocation operations.
2956fc729afSOlivier Houchard  */
2966fc729afSOlivier Houchard #define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)			\
2976fc729afSOlivier Houchard 	(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),	\
2986fc729afSOlivier Houchard 	    (c), (ap), (hp))
2996fc729afSOlivier Houchard #define	bus_space_free(t, h, s)						\
3006fc729afSOlivier Houchard 	(*(t)->bs_free)((t)->bs_cookie, (h), (s))
3016fc729afSOlivier Houchard 
3026fc729afSOlivier Houchard /*
3036fc729afSOlivier Houchard  * Bus barrier operations.
3046fc729afSOlivier Houchard  */
3056fc729afSOlivier Houchard #define	bus_space_barrier(t, h, o, l, f)				\
3066fc729afSOlivier Houchard 	(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
3076fc729afSOlivier Houchard 
3086fc729afSOlivier Houchard #define	BUS_SPACE_BARRIER_READ	0x01
3096fc729afSOlivier Houchard #define	BUS_SPACE_BARRIER_WRITE	0x02
3106fc729afSOlivier Houchard 
3116fc729afSOlivier Houchard /*
3126fc729afSOlivier Houchard  * Bus read (single) operations.
3136fc729afSOlivier Houchard  */
3146fc729afSOlivier Houchard #define	bus_space_read_1(t, h, o)	__bs_rs(1,(t),(h),(o))
3156fc729afSOlivier Houchard #define	bus_space_read_2(t, h, o)	__bs_rs(2,(t),(h),(o))
3166fc729afSOlivier Houchard #define	bus_space_read_4(t, h, o)	__bs_rs(4,(t),(h),(o))
3176fc729afSOlivier Houchard #define	bus_space_read_8(t, h, o)	__bs_rs(8,(t),(h),(o))
3186fc729afSOlivier Houchard 
319588a2322SSam Leffler #define bus_space_read_stream_1(t, h, o)        __bs_rs_s(1,(t), (h), (o))
320588a2322SSam Leffler #define bus_space_read_stream_2(t, h, o)        __bs_rs_s(2,(t), (h), (o))
321588a2322SSam Leffler #define bus_space_read_stream_4(t, h, o)        __bs_rs_s(4,(t), (h), (o))
322588a2322SSam Leffler #define	bus_space_read_stream_8(t, h, o)	__bs_rs_s(8,8,(t),(h),(o))
3236fc729afSOlivier Houchard 
3246fc729afSOlivier Houchard /*
3256fc729afSOlivier Houchard  * Bus read multiple operations.
3266fc729afSOlivier Houchard  */
3276fc729afSOlivier Houchard #define	bus_space_read_multi_1(t, h, o, a, c)				\
3286fc729afSOlivier Houchard 	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
3296fc729afSOlivier Houchard #define	bus_space_read_multi_2(t, h, o, a, c)				\
3306fc729afSOlivier Houchard 	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
3316fc729afSOlivier Houchard #define	bus_space_read_multi_4(t, h, o, a, c)				\
3326fc729afSOlivier Houchard 	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
3336fc729afSOlivier Houchard #define	bus_space_read_multi_8(t, h, o, a, c)				\
3346fc729afSOlivier Houchard 	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
3356fc729afSOlivier Houchard 
336588a2322SSam Leffler #define	bus_space_read_multi_stream_1(t, h, o, a, c)			\
337588a2322SSam Leffler 	__bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
338588a2322SSam Leffler #define	bus_space_read_multi_stream_2(t, h, o, a, c)			\
339588a2322SSam Leffler 	__bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
340588a2322SSam Leffler #define	bus_space_read_multi_stream_4(t, h, o, a, c)			\
341588a2322SSam Leffler 	__bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
342588a2322SSam Leffler #define	bus_space_read_multi_stream_8(t, h, o, a, c)			\
343588a2322SSam Leffler 	__bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
344588a2322SSam Leffler 
3456fc729afSOlivier Houchard 
3466fc729afSOlivier Houchard /*
3476fc729afSOlivier Houchard  * Bus read region operations.
3486fc729afSOlivier Houchard  */
3496fc729afSOlivier Houchard #define	bus_space_read_region_1(t, h, o, a, c)				\
3506fc729afSOlivier Houchard 	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
3516fc729afSOlivier Houchard #define	bus_space_read_region_2(t, h, o, a, c)				\
3526fc729afSOlivier Houchard 	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
3536fc729afSOlivier Houchard #define	bus_space_read_region_4(t, h, o, a, c)				\
3546fc729afSOlivier Houchard 	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
3556fc729afSOlivier Houchard #define	bus_space_read_region_8(t, h, o, a, c)				\
3566fc729afSOlivier Houchard 	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
3576fc729afSOlivier Houchard 
358588a2322SSam Leffler #define	bus_space_read_region_stream_1(t, h, o, a, c)			\
359588a2322SSam Leffler 	__bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
360588a2322SSam Leffler #define	bus_space_read_region_stream_2(t, h, o, a, c)			\
361588a2322SSam Leffler 	__bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
362588a2322SSam Leffler #define	bus_space_read_region_stream_4(t, h, o, a, c)			\
363588a2322SSam Leffler 	__bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
364588a2322SSam Leffler #define	bus_space_read_region_stream_8(t, h, o, a, c)			\
365588a2322SSam Leffler 	__bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
366588a2322SSam Leffler 
3676fc729afSOlivier Houchard 
3686fc729afSOlivier Houchard /*
3696fc729afSOlivier Houchard  * Bus write (single) operations.
3706fc729afSOlivier Houchard  */
3716fc729afSOlivier Houchard #define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v))
3726fc729afSOlivier Houchard #define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v))
3736fc729afSOlivier Houchard #define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v))
3746fc729afSOlivier Houchard #define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v))
3756fc729afSOlivier Houchard 
376588a2322SSam Leffler #define	bus_space_write_stream_1(t, h, o, v)	__bs_ws_s(1,(t),(h),(o),(v))
377588a2322SSam Leffler #define	bus_space_write_stream_2(t, h, o, v)	__bs_ws_s(2,(t),(h),(o),(v))
378588a2322SSam Leffler #define	bus_space_write_stream_4(t, h, o, v)	__bs_ws_s(4,(t),(h),(o),(v))
379588a2322SSam Leffler #define	bus_space_write_stream_8(t, h, o, v)	__bs_ws_s(8,(t),(h),(o),(v))
380588a2322SSam Leffler 
3816fc729afSOlivier Houchard 
3826fc729afSOlivier Houchard /*
3836fc729afSOlivier Houchard  * Bus write multiple operations.
3846fc729afSOlivier Houchard  */
3856fc729afSOlivier Houchard #define	bus_space_write_multi_1(t, h, o, a, c)				\
3866fc729afSOlivier Houchard 	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
3876fc729afSOlivier Houchard #define	bus_space_write_multi_2(t, h, o, a, c)				\
3886fc729afSOlivier Houchard 	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
3896fc729afSOlivier Houchard #define	bus_space_write_multi_4(t, h, o, a, c)				\
3906fc729afSOlivier Houchard 	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
3916fc729afSOlivier Houchard #define	bus_space_write_multi_8(t, h, o, a, c)				\
3926fc729afSOlivier Houchard 	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
3936fc729afSOlivier Houchard 
394588a2322SSam Leffler #define	bus_space_write_multi_stream_1(t, h, o, a, c)			\
395588a2322SSam Leffler 	__bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
396588a2322SSam Leffler #define	bus_space_write_multi_stream_2(t, h, o, a, c)			\
397588a2322SSam Leffler 	__bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
398588a2322SSam Leffler #define	bus_space_write_multi_stream_4(t, h, o, a, c)			\
399588a2322SSam Leffler 	__bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
400588a2322SSam Leffler #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\
401588a2322SSam Leffler 	__bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
402588a2322SSam Leffler 
4036fc729afSOlivier Houchard 
4046fc729afSOlivier Houchard /*
4056fc729afSOlivier Houchard  * Bus write region operations.
4066fc729afSOlivier Houchard  */
4076fc729afSOlivier Houchard #define	bus_space_write_region_1(t, h, o, a, c)				\
4086fc729afSOlivier Houchard 	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
4096fc729afSOlivier Houchard #define	bus_space_write_region_2(t, h, o, a, c)				\
4106fc729afSOlivier Houchard 	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
4116fc729afSOlivier Houchard #define	bus_space_write_region_4(t, h, o, a, c)				\
4126fc729afSOlivier Houchard 	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
4136fc729afSOlivier Houchard #define	bus_space_write_region_8(t, h, o, a, c)				\
4146fc729afSOlivier Houchard 	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
4156fc729afSOlivier Houchard 
416588a2322SSam Leffler #define	bus_space_write_region_stream_1(t, h, o, a, c)			\
417588a2322SSam Leffler 	__bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
418588a2322SSam Leffler #define	bus_space_write_region_stream_2(t, h, o, a, c)			\
419588a2322SSam Leffler 	__bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
420588a2322SSam Leffler #define	bus_space_write_region_stream_4(t, h, o, a, c)			\
421588a2322SSam Leffler 	__bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
422588a2322SSam Leffler #define	bus_space_write_region_stream_8(t, h, o, a, c)			\
423588a2322SSam Leffler 	__bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
424588a2322SSam Leffler 
4256fc729afSOlivier Houchard 
4266fc729afSOlivier Houchard /*
4276fc729afSOlivier Houchard  * Set multiple operations.
4286fc729afSOlivier Houchard  */
4296fc729afSOlivier Houchard #define	bus_space_set_multi_1(t, h, o, v, c)				\
4306fc729afSOlivier Houchard 	__bs_set(sm,1,(t),(h),(o),(v),(c))
4316fc729afSOlivier Houchard #define	bus_space_set_multi_2(t, h, o, v, c)				\
4326fc729afSOlivier Houchard 	__bs_set(sm,2,(t),(h),(o),(v),(c))
4336fc729afSOlivier Houchard #define	bus_space_set_multi_4(t, h, o, v, c)				\
4346fc729afSOlivier Houchard 	__bs_set(sm,4,(t),(h),(o),(v),(c))
4356fc729afSOlivier Houchard #define	bus_space_set_multi_8(t, h, o, v, c)				\
4366fc729afSOlivier Houchard 	__bs_set(sm,8,(t),(h),(o),(v),(c))
4376fc729afSOlivier Houchard 
4386fc729afSOlivier Houchard 
4396fc729afSOlivier Houchard /*
4406fc729afSOlivier Houchard  * Set region operations.
4416fc729afSOlivier Houchard  */
4426fc729afSOlivier Houchard #define	bus_space_set_region_1(t, h, o, v, c)				\
4436fc729afSOlivier Houchard 	__bs_set(sr,1,(t),(h),(o),(v),(c))
4446fc729afSOlivier Houchard #define	bus_space_set_region_2(t, h, o, v, c)				\
4456fc729afSOlivier Houchard 	__bs_set(sr,2,(t),(h),(o),(v),(c))
4466fc729afSOlivier Houchard #define	bus_space_set_region_4(t, h, o, v, c)				\
4476fc729afSOlivier Houchard 	__bs_set(sr,4,(t),(h),(o),(v),(c))
4486fc729afSOlivier Houchard #define	bus_space_set_region_8(t, h, o, v, c)				\
4496fc729afSOlivier Houchard 	__bs_set(sr,8,(t),(h),(o),(v),(c))
4506fc729afSOlivier Houchard 
4516fc729afSOlivier Houchard 
4526fc729afSOlivier Houchard /*
4536fc729afSOlivier Houchard  * Copy operations.
4546fc729afSOlivier Houchard  */
4556fc729afSOlivier Houchard #define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)				\
4566fc729afSOlivier Houchard 	__bs_copy(1, t, h1, o1, h2, o2, c)
4576fc729afSOlivier Houchard #define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)				\
4586fc729afSOlivier Houchard 	__bs_copy(2, t, h1, o1, h2, o2, c)
4596fc729afSOlivier Houchard #define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)				\
4606fc729afSOlivier Houchard 	__bs_copy(4, t, h1, o1, h2, o2, c)
4616fc729afSOlivier Houchard #define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)				\
4626fc729afSOlivier Houchard 	__bs_copy(8, t, h1, o1, h2, o2, c)
4636fc729afSOlivier Houchard 
4646fc729afSOlivier Houchard /*
4656fc729afSOlivier Houchard  * Macros to provide prototypes for all the functions used in the
4666fc729afSOlivier Houchard  * bus_space structure
4676fc729afSOlivier Houchard  */
4686fc729afSOlivier Houchard 
4696fc729afSOlivier Houchard #define bs_map_proto(f)							\
4706fc729afSOlivier Houchard int	__bs_c(f,_bs_map) (void *t, bus_addr_t addr,		\
4716fc729afSOlivier Houchard 	    bus_size_t size, int cacheable, bus_space_handle_t *bshp);
4726fc729afSOlivier Houchard 
4736fc729afSOlivier Houchard #define bs_unmap_proto(f)						\
474588a2322SSam Leffler void	__bs_c(f,_bs_unmap) (void *t, bus_space_handle_t bsh,		\
475588a2322SSam Leffler 	    bus_size_t size);
4766fc729afSOlivier Houchard 
4776fc729afSOlivier Houchard #define bs_subregion_proto(f)						\
4786fc729afSOlivier Houchard int	__bs_c(f,_bs_subregion) (void *t, bus_space_handle_t bsh,	\
4796fc729afSOlivier Houchard 	    bus_size_t offset, bus_size_t size, 			\
4806fc729afSOlivier Houchard 	    bus_space_handle_t *nbshp);
4816fc729afSOlivier Houchard 
4826fc729afSOlivier Houchard #define bs_alloc_proto(f)						\
4836fc729afSOlivier Houchard int	__bs_c(f,_bs_alloc) (void *t, bus_addr_t rstart,		\
4846fc729afSOlivier Houchard 	    bus_addr_t rend, bus_size_t size, bus_size_t align,		\
4856fc729afSOlivier Houchard 	    bus_size_t boundary, int cacheable, bus_addr_t *addrp,	\
4866fc729afSOlivier Houchard 	    bus_space_handle_t *bshp);
4876fc729afSOlivier Houchard 
4886fc729afSOlivier Houchard #define bs_free_proto(f)						\
4896fc729afSOlivier Houchard void	__bs_c(f,_bs_free) (void *t, bus_space_handle_t bsh,	\
4906fc729afSOlivier Houchard 	    bus_size_t size);
4916fc729afSOlivier Houchard 
4926fc729afSOlivier Houchard #define bs_mmap_proto(f)						\
49389c9c53dSPoul-Henning Kamp int	__bs_c(f,_bs_mmap) (struct cdev *, vm_offset_t, vm_paddr_t *, int);
4946fc729afSOlivier Houchard 
4956fc729afSOlivier Houchard #define bs_barrier_proto(f)						\
4966fc729afSOlivier Houchard void	__bs_c(f,_bs_barrier) (void *t, bus_space_handle_t bsh,	\
4976fc729afSOlivier Houchard 	    bus_size_t offset, bus_size_t len, int flags);
4986fc729afSOlivier Houchard 
4996fc729afSOlivier Houchard #define	bs_r_1_proto(f)							\
5006fc729afSOlivier Houchard u_int8_t	__bs_c(f,_bs_r_1) (void *t, bus_space_handle_t bsh,	\
5016fc729afSOlivier Houchard 		    bus_size_t offset);
5026fc729afSOlivier Houchard 
5036fc729afSOlivier Houchard #define	bs_r_2_proto(f)							\
5046fc729afSOlivier Houchard u_int16_t	__bs_c(f,_bs_r_2) (void *t, bus_space_handle_t bsh,	\
5056fc729afSOlivier Houchard 		    bus_size_t offset);
5066fc729afSOlivier Houchard 
5076fc729afSOlivier Houchard #define	bs_r_4_proto(f)							\
5086fc729afSOlivier Houchard u_int32_t	__bs_c(f,_bs_r_4) (void *t, bus_space_handle_t bsh,	\
5096fc729afSOlivier Houchard 		    bus_size_t offset);
5106fc729afSOlivier Houchard 
5116fc729afSOlivier Houchard #define	bs_r_8_proto(f)							\
5126fc729afSOlivier Houchard u_int64_t	__bs_c(f,_bs_r_8) (void *t, bus_space_handle_t bsh,	\
5136fc729afSOlivier Houchard 		    bus_size_t offset);
5146fc729afSOlivier Houchard 
515588a2322SSam Leffler #define	bs_r_1_s_proto(f)						\
516588a2322SSam Leffler u_int8_t	__bs_c(f,_bs_r_1_s) (void *t, bus_space_handle_t bsh,	\
517588a2322SSam Leffler 		    bus_size_t offset);
518588a2322SSam Leffler 
519588a2322SSam Leffler #define	bs_r_2_s_proto(f)						\
520588a2322SSam Leffler u_int16_t	__bs_c(f,_bs_r_2_s) (void *t, bus_space_handle_t bsh,	\
521588a2322SSam Leffler 		    bus_size_t offset);
522588a2322SSam Leffler 
523588a2322SSam Leffler #define	bs_r_4_s_proto(f)						\
524588a2322SSam Leffler u_int32_t	__bs_c(f,_bs_r_4_s) (void *t, bus_space_handle_t bsh,	\
525588a2322SSam Leffler 		    bus_size_t offset);
526588a2322SSam Leffler 
5276fc729afSOlivier Houchard #define	bs_w_1_proto(f)							\
5286fc729afSOlivier Houchard void	__bs_c(f,_bs_w_1) (void *t, bus_space_handle_t bsh,		\
5296fc729afSOlivier Houchard 	    bus_size_t offset, u_int8_t value);
5306fc729afSOlivier Houchard 
5316fc729afSOlivier Houchard #define	bs_w_2_proto(f)							\
5326fc729afSOlivier Houchard void	__bs_c(f,_bs_w_2) (void *t, bus_space_handle_t bsh,		\
5336fc729afSOlivier Houchard 	    bus_size_t offset, u_int16_t value);
5346fc729afSOlivier Houchard 
5356fc729afSOlivier Houchard #define	bs_w_4_proto(f)							\
5366fc729afSOlivier Houchard void	__bs_c(f,_bs_w_4) (void *t, bus_space_handle_t bsh,		\
5376fc729afSOlivier Houchard 	    bus_size_t offset, u_int32_t value);
5386fc729afSOlivier Houchard 
5396fc729afSOlivier Houchard #define	bs_w_8_proto(f)							\
5406fc729afSOlivier Houchard void	__bs_c(f,_bs_w_8) (void *t, bus_space_handle_t bsh,		\
5416fc729afSOlivier Houchard 	    bus_size_t offset, u_int64_t value);
5426fc729afSOlivier Houchard 
543588a2322SSam Leffler #define	bs_w_1_s_proto(f)						\
544588a2322SSam Leffler void	__bs_c(f,_bs_w_1_s) (void *t, bus_space_handle_t bsh,		\
545588a2322SSam Leffler 	    bus_size_t offset, u_int8_t value);
546588a2322SSam Leffler 
547588a2322SSam Leffler #define	bs_w_2_s_proto(f)						\
548588a2322SSam Leffler void	__bs_c(f,_bs_w_2_s) (void *t, bus_space_handle_t bsh,		\
549588a2322SSam Leffler 	    bus_size_t offset, u_int16_t value);
550588a2322SSam Leffler 
551588a2322SSam Leffler #define	bs_w_4_s_proto(f)						\
552588a2322SSam Leffler void	__bs_c(f,_bs_w_4_s) (void *t, bus_space_handle_t bsh,		\
553588a2322SSam Leffler 	    bus_size_t offset, u_int32_t value);
554588a2322SSam Leffler 
5556fc729afSOlivier Houchard #define	bs_rm_1_proto(f)						\
5566fc729afSOlivier Houchard void	__bs_c(f,_bs_rm_1) (void *t, bus_space_handle_t bsh,	\
5576fc729afSOlivier Houchard 	    bus_size_t offset, u_int8_t *addr, bus_size_t count);
5586fc729afSOlivier Houchard 
5596fc729afSOlivier Houchard #define	bs_rm_2_proto(f)						\
5606fc729afSOlivier Houchard void	__bs_c(f,_bs_rm_2) (void *t, bus_space_handle_t bsh,	\
5616fc729afSOlivier Houchard 	    bus_size_t offset, u_int16_t *addr, bus_size_t count);
5626fc729afSOlivier Houchard 
5636fc729afSOlivier Houchard #define	bs_rm_4_proto(f)						\
5646fc729afSOlivier Houchard void	__bs_c(f,_bs_rm_4) (void *t, bus_space_handle_t bsh,	\
5656fc729afSOlivier Houchard 	    bus_size_t offset, u_int32_t *addr, bus_size_t count);
5666fc729afSOlivier Houchard 
5676fc729afSOlivier Houchard #define	bs_rm_8_proto(f)						\
5686fc729afSOlivier Houchard void	__bs_c(f,_bs_rm_8) (void *t, bus_space_handle_t bsh,	\
5696fc729afSOlivier Houchard 	    bus_size_t offset, u_int64_t *addr, bus_size_t count);
5706fc729afSOlivier Houchard 
5716fc729afSOlivier Houchard #define	bs_wm_1_proto(f)						\
5726fc729afSOlivier Houchard void	__bs_c(f,_bs_wm_1) (void *t, bus_space_handle_t bsh,	\
5736fc729afSOlivier Houchard 	    bus_size_t offset, const u_int8_t *addr, bus_size_t count);
5746fc729afSOlivier Houchard 
5756fc729afSOlivier Houchard #define	bs_wm_2_proto(f)						\
5766fc729afSOlivier Houchard void	__bs_c(f,_bs_wm_2) (void *t, bus_space_handle_t bsh,	\
5776fc729afSOlivier Houchard 	    bus_size_t offset, const u_int16_t *addr, bus_size_t count);
5786fc729afSOlivier Houchard 
5796fc729afSOlivier Houchard #define	bs_wm_4_proto(f)						\
5806fc729afSOlivier Houchard void	__bs_c(f,_bs_wm_4) (void *t, bus_space_handle_t bsh,	\
5816fc729afSOlivier Houchard 	    bus_size_t offset, const u_int32_t *addr, bus_size_t count);
5826fc729afSOlivier Houchard 
5836fc729afSOlivier Houchard #define	bs_wm_8_proto(f)						\
5846fc729afSOlivier Houchard void	__bs_c(f,_bs_wm_8) (void *t, bus_space_handle_t bsh,	\
5856fc729afSOlivier Houchard 	    bus_size_t offset, const u_int64_t *addr, bus_size_t count);
5866fc729afSOlivier Houchard 
5876fc729afSOlivier Houchard #define	bs_rr_1_proto(f)						\
5886fc729afSOlivier Houchard void	__bs_c(f, _bs_rr_1) (void *t, bus_space_handle_t bsh,	\
5896fc729afSOlivier Houchard 	    bus_size_t offset, u_int8_t *addr, bus_size_t count);
5906fc729afSOlivier Houchard 
5916fc729afSOlivier Houchard #define	bs_rr_2_proto(f)						\
5926fc729afSOlivier Houchard void	__bs_c(f, _bs_rr_2) (void *t, bus_space_handle_t bsh,	\
5936fc729afSOlivier Houchard 	    bus_size_t offset, u_int16_t *addr, bus_size_t count);
5946fc729afSOlivier Houchard 
5956fc729afSOlivier Houchard #define	bs_rr_4_proto(f)						\
5966fc729afSOlivier Houchard void	__bs_c(f, _bs_rr_4) (void *t, bus_space_handle_t bsh,	\
5976fc729afSOlivier Houchard 	    bus_size_t offset, u_int32_t *addr, bus_size_t count);
5986fc729afSOlivier Houchard 
5996fc729afSOlivier Houchard #define	bs_rr_8_proto(f)						\
6006fc729afSOlivier Houchard void	__bs_c(f, _bs_rr_8) (void *t, bus_space_handle_t bsh,	\
6016fc729afSOlivier Houchard 	    bus_size_t offset, u_int64_t *addr, bus_size_t count);
6026fc729afSOlivier Houchard 
6036fc729afSOlivier Houchard #define	bs_wr_1_proto(f)						\
6046fc729afSOlivier Houchard void	__bs_c(f, _bs_wr_1) (void *t, bus_space_handle_t bsh,	\
6056fc729afSOlivier Houchard 	    bus_size_t offset, const u_int8_t *addr, bus_size_t count);
6066fc729afSOlivier Houchard 
6076fc729afSOlivier Houchard #define	bs_wr_2_proto(f)						\
6086fc729afSOlivier Houchard void	__bs_c(f, _bs_wr_2) (void *t, bus_space_handle_t bsh,	\
6096fc729afSOlivier Houchard 	    bus_size_t offset, const u_int16_t *addr, bus_size_t count);
6106fc729afSOlivier Houchard 
6116fc729afSOlivier Houchard #define	bs_wr_4_proto(f)						\
6126fc729afSOlivier Houchard void	__bs_c(f, _bs_wr_4) (void *t, bus_space_handle_t bsh,	\
6136fc729afSOlivier Houchard 	    bus_size_t offset, const u_int32_t *addr, bus_size_t count);
6146fc729afSOlivier Houchard 
6156fc729afSOlivier Houchard #define	bs_wr_8_proto(f)						\
6166fc729afSOlivier Houchard void	__bs_c(f, _bs_wr_8) (void *t, bus_space_handle_t bsh,	\
6176fc729afSOlivier Houchard 	    bus_size_t offset, const u_int64_t *addr, bus_size_t count);
6186fc729afSOlivier Houchard 
6196fc729afSOlivier Houchard #define	bs_sm_1_proto(f)						\
6206fc729afSOlivier Houchard void	__bs_c(f,_bs_sm_1) (void *t, bus_space_handle_t bsh,	\
6216fc729afSOlivier Houchard 	    bus_size_t offset, u_int8_t value, bus_size_t count);
6226fc729afSOlivier Houchard 
6236fc729afSOlivier Houchard #define	bs_sm_2_proto(f)						\
6246fc729afSOlivier Houchard void	__bs_c(f,_bs_sm_2) (void *t, bus_space_handle_t bsh,	\
6256fc729afSOlivier Houchard 	    bus_size_t offset, u_int16_t value, bus_size_t count);
6266fc729afSOlivier Houchard 
6276fc729afSOlivier Houchard #define	bs_sm_4_proto(f)						\
6286fc729afSOlivier Houchard void	__bs_c(f,_bs_sm_4) (void *t, bus_space_handle_t bsh,	\
6296fc729afSOlivier Houchard 	    bus_size_t offset, u_int32_t value, bus_size_t count);
6306fc729afSOlivier Houchard 
6316fc729afSOlivier Houchard #define	bs_sm_8_proto(f)						\
6326fc729afSOlivier Houchard void	__bs_c(f,_bs_sm_8) (void *t, bus_space_handle_t bsh,	\
6336fc729afSOlivier Houchard 	    bus_size_t offset, u_int64_t value, bus_size_t count);
6346fc729afSOlivier Houchard 
6356fc729afSOlivier Houchard #define	bs_sr_1_proto(f)						\
6366fc729afSOlivier Houchard void	__bs_c(f,_bs_sr_1) (void *t, bus_space_handle_t bsh,	\
6376fc729afSOlivier Houchard 	    bus_size_t offset, u_int8_t value, bus_size_t count);
6386fc729afSOlivier Houchard 
6396fc729afSOlivier Houchard #define	bs_sr_2_proto(f)						\
6406fc729afSOlivier Houchard void	__bs_c(f,_bs_sr_2) (void *t, bus_space_handle_t bsh,	\
6416fc729afSOlivier Houchard 	    bus_size_t offset, u_int16_t value, bus_size_t count);
6426fc729afSOlivier Houchard 
6436fc729afSOlivier Houchard #define	bs_sr_4_proto(f)						\
6446fc729afSOlivier Houchard void	__bs_c(f,_bs_sr_4) (void *t, bus_space_handle_t bsh,	\
6456fc729afSOlivier Houchard 	    bus_size_t offset, u_int32_t value, bus_size_t count);
6466fc729afSOlivier Houchard 
6476fc729afSOlivier Houchard #define	bs_sr_8_proto(f)						\
6486fc729afSOlivier Houchard void	__bs_c(f,_bs_sr_8) (void *t, bus_space_handle_t bsh,	\
6496fc729afSOlivier Houchard 	    bus_size_t offset, u_int64_t value, bus_size_t count);
6506fc729afSOlivier Houchard 
6516fc729afSOlivier Houchard #define	bs_c_1_proto(f)							\
6526fc729afSOlivier Houchard void	__bs_c(f,_bs_c_1) (void *t, bus_space_handle_t bsh1,	\
6536fc729afSOlivier Houchard 	    bus_size_t offset1, bus_space_handle_t bsh2,		\
6546fc729afSOlivier Houchard 	    bus_size_t offset2, bus_size_t count);
6556fc729afSOlivier Houchard 
6566fc729afSOlivier Houchard #define	bs_c_2_proto(f)							\
6576fc729afSOlivier Houchard void	__bs_c(f,_bs_c_2) (void *t, bus_space_handle_t bsh1,	\
6586fc729afSOlivier Houchard 	    bus_size_t offset1, bus_space_handle_t bsh2,		\
6596fc729afSOlivier Houchard 	    bus_size_t offset2, bus_size_t count);
6606fc729afSOlivier Houchard 
6616fc729afSOlivier Houchard #define	bs_c_4_proto(f)							\
6626fc729afSOlivier Houchard void	__bs_c(f,_bs_c_4) (void *t, bus_space_handle_t bsh1,	\
6636fc729afSOlivier Houchard 	    bus_size_t offset1, bus_space_handle_t bsh2,		\
6646fc729afSOlivier Houchard 	    bus_size_t offset2, bus_size_t count);
6656fc729afSOlivier Houchard 
6666fc729afSOlivier Houchard #define	bs_c_8_proto(f)							\
6676fc729afSOlivier Houchard void	__bs_c(f,_bs_c_8) (void *t, bus_space_handle_t bsh1,	\
6686fc729afSOlivier Houchard 	    bus_size_t offset1, bus_space_handle_t bsh2,		\
6696fc729afSOlivier Houchard 	    bus_size_t offset2, bus_size_t count);
6706fc729afSOlivier Houchard 
6716fc729afSOlivier Houchard #define bs_protos(f)		\
6726fc729afSOlivier Houchard bs_map_proto(f);		\
6736fc729afSOlivier Houchard bs_unmap_proto(f);		\
6746fc729afSOlivier Houchard bs_subregion_proto(f);		\
6756fc729afSOlivier Houchard bs_alloc_proto(f);		\
6766fc729afSOlivier Houchard bs_free_proto(f);		\
6776fc729afSOlivier Houchard bs_mmap_proto(f);		\
6786fc729afSOlivier Houchard bs_barrier_proto(f);		\
6796fc729afSOlivier Houchard bs_r_1_proto(f);		\
6806fc729afSOlivier Houchard bs_r_2_proto(f);		\
6816fc729afSOlivier Houchard bs_r_4_proto(f);		\
6826fc729afSOlivier Houchard bs_r_8_proto(f);		\
683588a2322SSam Leffler bs_r_1_s_proto(f);		\
684588a2322SSam Leffler bs_r_2_s_proto(f);		\
685588a2322SSam Leffler bs_r_4_s_proto(f);		\
6866fc729afSOlivier Houchard bs_w_1_proto(f);		\
6876fc729afSOlivier Houchard bs_w_2_proto(f);		\
6886fc729afSOlivier Houchard bs_w_4_proto(f);		\
6896fc729afSOlivier Houchard bs_w_8_proto(f);		\
690588a2322SSam Leffler bs_w_1_s_proto(f);		\
691588a2322SSam Leffler bs_w_2_s_proto(f);		\
692588a2322SSam Leffler bs_w_4_s_proto(f);		\
6936fc729afSOlivier Houchard bs_rm_1_proto(f);		\
6946fc729afSOlivier Houchard bs_rm_2_proto(f);		\
6956fc729afSOlivier Houchard bs_rm_4_proto(f);		\
6966fc729afSOlivier Houchard bs_rm_8_proto(f);		\
6976fc729afSOlivier Houchard bs_wm_1_proto(f);		\
6986fc729afSOlivier Houchard bs_wm_2_proto(f);		\
6996fc729afSOlivier Houchard bs_wm_4_proto(f);		\
7006fc729afSOlivier Houchard bs_wm_8_proto(f);		\
7016fc729afSOlivier Houchard bs_rr_1_proto(f);		\
7026fc729afSOlivier Houchard bs_rr_2_proto(f);		\
7036fc729afSOlivier Houchard bs_rr_4_proto(f);		\
7046fc729afSOlivier Houchard bs_rr_8_proto(f);		\
7056fc729afSOlivier Houchard bs_wr_1_proto(f);		\
7066fc729afSOlivier Houchard bs_wr_2_proto(f);		\
7076fc729afSOlivier Houchard bs_wr_4_proto(f);		\
7086fc729afSOlivier Houchard bs_wr_8_proto(f);		\
7096fc729afSOlivier Houchard bs_sm_1_proto(f);		\
7106fc729afSOlivier Houchard bs_sm_2_proto(f);		\
7116fc729afSOlivier Houchard bs_sm_4_proto(f);		\
7126fc729afSOlivier Houchard bs_sm_8_proto(f);		\
7136fc729afSOlivier Houchard bs_sr_1_proto(f);		\
7146fc729afSOlivier Houchard bs_sr_2_proto(f);		\
7156fc729afSOlivier Houchard bs_sr_4_proto(f);		\
7166fc729afSOlivier Houchard bs_sr_8_proto(f);		\
7176fc729afSOlivier Houchard bs_c_1_proto(f);		\
7186fc729afSOlivier Houchard bs_c_2_proto(f);		\
7196fc729afSOlivier Houchard bs_c_4_proto(f);		\
7206fc729afSOlivier Houchard bs_c_8_proto(f);
7216fc729afSOlivier Houchard 
7226fc729afSOlivier Houchard #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
7236fc729afSOlivier Houchard 
724a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR_24BIT	0xFFFFFF
725a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
726a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR 	0xFFFFFFFF
727a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE_24BIT	0xFFFFFF
728a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFF
729a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE 	0xFFFFFFFF
730a5bb1c85SOlivier Houchard 
7315974e5c7SScott Long #include <machine/bus_dma.h>
7325974e5c7SScott Long 
7336fc729afSOlivier Houchard #endif /* _MACHINE_BUS_H_ */
734