1281494Sandrew/*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/
2281494Sandrew
3281494Sandrew/*-
4281494Sandrew * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
5281494Sandrew * All rights reserved.
6281494Sandrew *
7281494Sandrew * This code is derived from software contributed to The NetBSD Foundation
8281494Sandrew * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9281494Sandrew * NASA Ames Research Center.
10281494Sandrew *
11281494Sandrew * Redistribution and use in source and binary forms, with or without
12281494Sandrew * modification, are permitted provided that the following conditions
13281494Sandrew * are met:
14281494Sandrew * 1. Redistributions of source code must retain the above copyright
15281494Sandrew *    notice, this list of conditions and the following disclaimer.
16281494Sandrew * 2. Redistributions in binary form must reproduce the above copyright
17281494Sandrew *    notice, this list of conditions and the following disclaimer in the
18281494Sandrew *    documentation and/or other materials provided with the distribution.
19281494Sandrew *
20281494Sandrew * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21281494Sandrew * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22281494Sandrew * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23281494Sandrew * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24281494Sandrew * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25281494Sandrew * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26281494Sandrew * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27281494Sandrew * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28281494Sandrew * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29281494Sandrew * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30281494Sandrew * POSSIBILITY OF SUCH DAMAGE.
31281494Sandrew */
32281494Sandrew
33281494Sandrew/*-
34281494Sandrew * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
35281494Sandrew * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
36281494Sandrew *
37281494Sandrew * Redistribution and use in source and binary forms, with or without
38281494Sandrew * modification, are permitted provided that the following conditions
39281494Sandrew * are met:
40281494Sandrew * 1. Redistributions of source code must retain the above copyright
41281494Sandrew *    notice, this list of conditions and the following disclaimer.
42281494Sandrew * 2. Redistributions in binary form must reproduce the above copyright
43281494Sandrew *    notice, this list of conditions and the following disclaimer in the
44281494Sandrew *    documentation and/or other materials provided with the distribution.
45281494Sandrew * 3. All advertising materials mentioning features or use of this software
46281494Sandrew *    must display the following acknowledgement:
47281494Sandrew *      This product includes software developed by Christopher G. Demetriou
48281494Sandrew *	for the NetBSD Project.
49281494Sandrew * 4. The name of the author may not be used to endorse or promote products
50281494Sandrew *    derived from this software without specific prior written permission
51281494Sandrew *
52281494Sandrew * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
53281494Sandrew * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
54281494Sandrew * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55281494Sandrew * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
56281494Sandrew * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
57281494Sandrew * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58281494Sandrew * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59281494Sandrew * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60281494Sandrew * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
61281494Sandrew * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62281494Sandrew *
63281494Sandrew * From: sys/arm/include/bus.h
64281494Sandrew *
65281494Sandrew * $FreeBSD$
66281494Sandrew */
67281494Sandrew
68281494Sandrew#ifndef _MACHINE_BUS_H_
69281494Sandrew#define	_MACHINE_BUS_H_
70281494Sandrew
71281494Sandrew#include <machine/_bus.h>
72281494Sandrew
73281494Sandrew#define	BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
74281494Sandrew
75281494Sandrew#define	BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL
76281494Sandrew#define	BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL
77281494Sandrew#define	BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL
78281494Sandrew#define	BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL
79281494Sandrew
80281494Sandrew#define	BUS_SPACE_MAXADDR 	0xFFFFFFFFFFFFFFFFUL
81281494Sandrew#define	BUS_SPACE_MAXSIZE 	0xFFFFFFFFFFFFFFFFUL
82281494Sandrew
83281494Sandrew#define	BUS_SPACE_MAP_CACHEABLE		0x01
84281494Sandrew#define	BUS_SPACE_MAP_LINEAR		0x02
85281494Sandrew#define	BUS_SPACE_MAP_PREFETCHABLE     	0x04
86281494Sandrew
87281494Sandrew#define	BUS_SPACE_UNRESTRICTED	(~0)
88281494Sandrew
89281494Sandrew#define	BUS_SPACE_BARRIER_READ	0x01
90281494Sandrew#define	BUS_SPACE_BARRIER_WRITE	0x02
91281494Sandrew
92281494Sandrew
93281494Sandrewstruct bus_space {
94281494Sandrew	/* cookie */
95281494Sandrew	void		*bs_cookie;
96281494Sandrew
97281494Sandrew	/* mapping/unmapping */
98281494Sandrew	int		(*bs_map) (void *, bus_addr_t, bus_size_t,
99281494Sandrew			    int, bus_space_handle_t *);
100281494Sandrew	void		(*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
101281494Sandrew	int		(*bs_subregion) (void *, bus_space_handle_t,
102281494Sandrew			    bus_size_t, bus_size_t, bus_space_handle_t *);
103281494Sandrew
104281494Sandrew	/* allocation/deallocation */
105281494Sandrew	int		(*bs_alloc) (void *, bus_addr_t, bus_addr_t,
106281494Sandrew			    bus_size_t, bus_size_t, bus_size_t, int,
107281494Sandrew			    bus_addr_t *, bus_space_handle_t *);
108281494Sandrew	void		(*bs_free) (void *, bus_space_handle_t,
109281494Sandrew			    bus_size_t);
110281494Sandrew
111281494Sandrew	/* get kernel virtual address */
112281494Sandrew	/* barrier */
113281494Sandrew	void		(*bs_barrier) (void *, bus_space_handle_t,
114281494Sandrew			    bus_size_t, bus_size_t, int);
115281494Sandrew
116281494Sandrew	/* read single */
117281494Sandrew	u_int8_t	(*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
118281494Sandrew	u_int16_t	(*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
119281494Sandrew	u_int32_t	(*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
120281494Sandrew	u_int64_t	(*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
121281494Sandrew
122281494Sandrew	/* read multiple */
123281494Sandrew	void		(*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
124281494Sandrew	    u_int8_t *, bus_size_t);
125281494Sandrew	void		(*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
126281494Sandrew	    u_int16_t *, bus_size_t);
127281494Sandrew	void		(*bs_rm_4) (void *, bus_space_handle_t,
128281494Sandrew			    bus_size_t, u_int32_t *, bus_size_t);
129281494Sandrew	void		(*bs_rm_8) (void *, bus_space_handle_t,
130281494Sandrew			    bus_size_t, u_int64_t *, bus_size_t);
131281494Sandrew
132281494Sandrew	/* read region */
133281494Sandrew	void		(*bs_rr_1) (void *, bus_space_handle_t,
134281494Sandrew			    bus_size_t, u_int8_t *, bus_size_t);
135281494Sandrew	void		(*bs_rr_2) (void *, bus_space_handle_t,
136281494Sandrew			    bus_size_t, u_int16_t *, bus_size_t);
137281494Sandrew	void		(*bs_rr_4) (void *, bus_space_handle_t,
138281494Sandrew			    bus_size_t, u_int32_t *, bus_size_t);
139281494Sandrew	void		(*bs_rr_8) (void *, bus_space_handle_t,
140281494Sandrew			    bus_size_t, u_int64_t *, bus_size_t);
141281494Sandrew
142281494Sandrew	/* write single */
143281494Sandrew	void		(*bs_w_1) (void *, bus_space_handle_t,
144281494Sandrew			    bus_size_t, u_int8_t);
145281494Sandrew	void		(*bs_w_2) (void *, bus_space_handle_t,
146281494Sandrew			    bus_size_t, u_int16_t);
147281494Sandrew	void		(*bs_w_4) (void *, bus_space_handle_t,
148281494Sandrew			    bus_size_t, u_int32_t);
149281494Sandrew	void		(*bs_w_8) (void *, bus_space_handle_t,
150281494Sandrew			    bus_size_t, u_int64_t);
151281494Sandrew
152281494Sandrew	/* write multiple */
153281494Sandrew	void		(*bs_wm_1) (void *, bus_space_handle_t,
154281494Sandrew			    bus_size_t, const u_int8_t *, bus_size_t);
155281494Sandrew	void		(*bs_wm_2) (void *, bus_space_handle_t,
156281494Sandrew			    bus_size_t, const u_int16_t *, bus_size_t);
157281494Sandrew	void		(*bs_wm_4) (void *, bus_space_handle_t,
158281494Sandrew			    bus_size_t, const u_int32_t *, bus_size_t);
159281494Sandrew	void		(*bs_wm_8) (void *, bus_space_handle_t,
160281494Sandrew			    bus_size_t, const u_int64_t *, bus_size_t);
161281494Sandrew
162281494Sandrew	/* write region */
163281494Sandrew	void		(*bs_wr_1) (void *, bus_space_handle_t,
164281494Sandrew			    bus_size_t, const u_int8_t *, bus_size_t);
165281494Sandrew	void		(*bs_wr_2) (void *, bus_space_handle_t,
166281494Sandrew			    bus_size_t, const u_int16_t *, bus_size_t);
167281494Sandrew	void		(*bs_wr_4) (void *, bus_space_handle_t,
168281494Sandrew			    bus_size_t, const u_int32_t *, bus_size_t);
169281494Sandrew	void		(*bs_wr_8) (void *, bus_space_handle_t,
170281494Sandrew			    bus_size_t, const u_int64_t *, bus_size_t);
171281494Sandrew
172281494Sandrew	/* set multiple */
173281494Sandrew	void		(*bs_sm_1) (void *, bus_space_handle_t,
174281494Sandrew			    bus_size_t, u_int8_t, bus_size_t);
175281494Sandrew	void		(*bs_sm_2) (void *, bus_space_handle_t,
176281494Sandrew			    bus_size_t, u_int16_t, bus_size_t);
177281494Sandrew	void		(*bs_sm_4) (void *, bus_space_handle_t,
178281494Sandrew			    bus_size_t, u_int32_t, bus_size_t);
179281494Sandrew	void		(*bs_sm_8) (void *, bus_space_handle_t,
180281494Sandrew			    bus_size_t, u_int64_t, bus_size_t);
181281494Sandrew
182281494Sandrew	/* set region */
183281494Sandrew	void		(*bs_sr_1) (void *, bus_space_handle_t,
184281494Sandrew			    bus_size_t, u_int8_t, bus_size_t);
185281494Sandrew	void		(*bs_sr_2) (void *, bus_space_handle_t,
186281494Sandrew			    bus_size_t, u_int16_t, bus_size_t);
187281494Sandrew	void		(*bs_sr_4) (void *, bus_space_handle_t,
188281494Sandrew			    bus_size_t, u_int32_t, bus_size_t);
189281494Sandrew	void		(*bs_sr_8) (void *, bus_space_handle_t,
190281494Sandrew			    bus_size_t, u_int64_t, bus_size_t);
191281494Sandrew
192281494Sandrew	/* copy */
193281494Sandrew	void		(*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
194281494Sandrew			    bus_space_handle_t, bus_size_t, bus_size_t);
195281494Sandrew	void		(*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
196281494Sandrew			    bus_space_handle_t, bus_size_t, bus_size_t);
197281494Sandrew	void		(*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
198281494Sandrew			    bus_space_handle_t, bus_size_t, bus_size_t);
199281494Sandrew	void		(*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
200281494Sandrew			    bus_space_handle_t, bus_size_t, bus_size_t);
201281494Sandrew
202281494Sandrew	/* read single stream */
203281494Sandrew	u_int8_t	(*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
204281494Sandrew	u_int16_t	(*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
205281494Sandrew	u_int32_t	(*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
206281494Sandrew	u_int64_t	(*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
207281494Sandrew
208281494Sandrew	/* read multiple stream */
209281494Sandrew	void		(*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
210281494Sandrew	    u_int8_t *, bus_size_t);
211281494Sandrew	void		(*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
212281494Sandrew	    u_int16_t *, bus_size_t);
213281494Sandrew	void		(*bs_rm_4_s) (void *, bus_space_handle_t,
214281494Sandrew			    bus_size_t, u_int32_t *, bus_size_t);
215281494Sandrew	void		(*bs_rm_8_s) (void *, bus_space_handle_t,
216281494Sandrew			    bus_size_t, u_int64_t *, bus_size_t);
217281494Sandrew
218281494Sandrew	/* read region stream */
219281494Sandrew	void		(*bs_rr_1_s) (void *, bus_space_handle_t,
220281494Sandrew			    bus_size_t, u_int8_t *, bus_size_t);
221281494Sandrew	void		(*bs_rr_2_s) (void *, bus_space_handle_t,
222281494Sandrew			    bus_size_t, u_int16_t *, bus_size_t);
223281494Sandrew	void		(*bs_rr_4_s) (void *, bus_space_handle_t,
224281494Sandrew			    bus_size_t, u_int32_t *, bus_size_t);
225281494Sandrew	void		(*bs_rr_8_s) (void *, bus_space_handle_t,
226281494Sandrew			    bus_size_t, u_int64_t *, bus_size_t);
227281494Sandrew
228281494Sandrew	/* write single stream */
229281494Sandrew	void		(*bs_w_1_s) (void *, bus_space_handle_t,
230281494Sandrew			    bus_size_t, u_int8_t);
231281494Sandrew	void		(*bs_w_2_s) (void *, bus_space_handle_t,
232281494Sandrew			    bus_size_t, u_int16_t);
233281494Sandrew	void		(*bs_w_4_s) (void *, bus_space_handle_t,
234281494Sandrew			    bus_size_t, u_int32_t);
235281494Sandrew	void		(*bs_w_8_s) (void *, bus_space_handle_t,
236281494Sandrew			    bus_size_t, u_int64_t);
237281494Sandrew
238281494Sandrew	/* write multiple stream */
239281494Sandrew	void		(*bs_wm_1_s) (void *, bus_space_handle_t,
240281494Sandrew			    bus_size_t, const u_int8_t *, bus_size_t);
241281494Sandrew	void		(*bs_wm_2_s) (void *, bus_space_handle_t,
242281494Sandrew			    bus_size_t, const u_int16_t *, bus_size_t);
243281494Sandrew	void		(*bs_wm_4_s) (void *, bus_space_handle_t,
244281494Sandrew			    bus_size_t, const u_int32_t *, bus_size_t);
245281494Sandrew	void		(*bs_wm_8_s) (void *, bus_space_handle_t,
246281494Sandrew			    bus_size_t, const u_int64_t *, bus_size_t);
247281494Sandrew
248281494Sandrew	/* write region stream */
249281494Sandrew	void		(*bs_wr_1_s) (void *, bus_space_handle_t,
250281494Sandrew			    bus_size_t, const u_int8_t *, bus_size_t);
251281494Sandrew	void		(*bs_wr_2_s) (void *, bus_space_handle_t,
252281494Sandrew			    bus_size_t, const u_int16_t *, bus_size_t);
253281494Sandrew	void		(*bs_wr_4_s) (void *, bus_space_handle_t,
254281494Sandrew			    bus_size_t, const u_int32_t *, bus_size_t);
255281494Sandrew	void		(*bs_wr_8_s) (void *, bus_space_handle_t,
256281494Sandrew			    bus_size_t, const u_int64_t *, bus_size_t);
257281494Sandrew};
258281494Sandrew
259281494Sandrew
260281494Sandrew/*
261281494Sandrew * Utility macros; INTERNAL USE ONLY.
262281494Sandrew */
263281494Sandrew#define	__bs_c(a,b)		__CONCAT(a,b)
264281494Sandrew#define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size)
265281494Sandrew
266281494Sandrew#define	__bs_rs(sz, t, h, o)						\
267281494Sandrew	(*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
268281494Sandrew#define	__bs_ws(sz, t, h, o, v)						\
269281494Sandrew	(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
270281494Sandrew#define	__bs_nonsingle(type, sz, t, h, o, a, c)				\
271281494Sandrew	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
272281494Sandrew#define	__bs_set(type, sz, t, h, o, v, c)				\
273281494Sandrew	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
274281494Sandrew#define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\
275281494Sandrew	(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
276281494Sandrew
277281494Sandrew#define	__bs_opname_s(op,size)	__bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
278281494Sandrew#define	__bs_rs_s(sz, t, h, o)						\
279281494Sandrew	(*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
280281494Sandrew#define	__bs_ws_s(sz, t, h, o, v)					\
281281494Sandrew	(*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
282281494Sandrew#define	__bs_nonsingle_s(type, sz, t, h, o, a, c)			\
283281494Sandrew	(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
284281494Sandrew
285281494Sandrew
286281494Sandrew/*
287281494Sandrew * Mapping and unmapping operations.
288281494Sandrew */
289281494Sandrew#define	bus_space_map(t, a, s, c, hp)					\
290281494Sandrew	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
291281494Sandrew#define	bus_space_unmap(t, h, s)					\
292281494Sandrew	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
293281494Sandrew#define	bus_space_subregion(t, h, o, s, hp)				\
294281494Sandrew	(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
295281494Sandrew
296281494Sandrew
297281494Sandrew/*
298281494Sandrew * Allocation and deallocation operations.
299281494Sandrew */
300281494Sandrew#define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)			\
301281494Sandrew	(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),	\
302281494Sandrew	    (c), (ap), (hp))
303281494Sandrew#define	bus_space_free(t, h, s)						\
304281494Sandrew	(*(t)->bs_free)((t)->bs_cookie, (h), (s))
305281494Sandrew
306281494Sandrew/*
307281494Sandrew * Bus barrier operations.
308281494Sandrew */
309281494Sandrew#define	bus_space_barrier(t, h, o, l, f)				\
310281494Sandrew	(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
311281494Sandrew
312281494Sandrew
313281494Sandrew
314281494Sandrew/*
315281494Sandrew * Bus read (single) operations.
316281494Sandrew */
317281494Sandrew#define	bus_space_read_1(t, h, o)	__bs_rs(1,(t),(h),(o))
318281494Sandrew#define	bus_space_read_2(t, h, o)	__bs_rs(2,(t),(h),(o))
319281494Sandrew#define	bus_space_read_4(t, h, o)	__bs_rs(4,(t),(h),(o))
320281494Sandrew#define	bus_space_read_8(t, h, o)	__bs_rs(8,(t),(h),(o))
321281494Sandrew
322281494Sandrew#define	bus_space_read_stream_1(t, h, o)        __bs_rs_s(1,(t), (h), (o))
323281494Sandrew#define	bus_space_read_stream_2(t, h, o)        __bs_rs_s(2,(t), (h), (o))
324281494Sandrew#define	bus_space_read_stream_4(t, h, o)        __bs_rs_s(4,(t), (h), (o))
325281494Sandrew#define	bus_space_read_stream_8(t, h, o)	__bs_rs_s(8,8,(t),(h),(o))
326281494Sandrew
327281494Sandrew/*
328281494Sandrew * Bus read multiple operations.
329281494Sandrew */
330281494Sandrew#define	bus_space_read_multi_1(t, h, o, a, c)				\
331281494Sandrew	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
332281494Sandrew#define	bus_space_read_multi_2(t, h, o, a, c)				\
333281494Sandrew	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
334281494Sandrew#define	bus_space_read_multi_4(t, h, o, a, c)				\
335281494Sandrew	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
336281494Sandrew#define	bus_space_read_multi_8(t, h, o, a, c)				\
337281494Sandrew	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
338281494Sandrew
339281494Sandrew#define	bus_space_read_multi_stream_1(t, h, o, a, c)			\
340281494Sandrew	__bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
341281494Sandrew#define	bus_space_read_multi_stream_2(t, h, o, a, c)			\
342281494Sandrew	__bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
343281494Sandrew#define	bus_space_read_multi_stream_4(t, h, o, a, c)			\
344281494Sandrew	__bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
345281494Sandrew#define	bus_space_read_multi_stream_8(t, h, o, a, c)			\
346281494Sandrew	__bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
347281494Sandrew
348281494Sandrew
349281494Sandrew/*
350281494Sandrew * Bus read region operations.
351281494Sandrew */
352281494Sandrew#define	bus_space_read_region_1(t, h, o, a, c)				\
353281494Sandrew	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
354281494Sandrew#define	bus_space_read_region_2(t, h, o, a, c)				\
355281494Sandrew	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
356281494Sandrew#define	bus_space_read_region_4(t, h, o, a, c)				\
357281494Sandrew	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
358281494Sandrew#define	bus_space_read_region_8(t, h, o, a, c)				\
359281494Sandrew	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
360281494Sandrew
361281494Sandrew#define	bus_space_read_region_stream_1(t, h, o, a, c)			\
362281494Sandrew	__bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
363281494Sandrew#define	bus_space_read_region_stream_2(t, h, o, a, c)			\
364281494Sandrew	__bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
365281494Sandrew#define	bus_space_read_region_stream_4(t, h, o, a, c)			\
366281494Sandrew	__bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
367281494Sandrew#define	bus_space_read_region_stream_8(t, h, o, a, c)			\
368281494Sandrew	__bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
369281494Sandrew
370281494Sandrew
371281494Sandrew/*
372281494Sandrew * Bus write (single) operations.
373281494Sandrew */
374281494Sandrew#define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v))
375281494Sandrew#define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v))
376281494Sandrew#define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v))
377281494Sandrew#define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v))
378281494Sandrew
379281494Sandrew#define	bus_space_write_stream_1(t, h, o, v)	__bs_ws_s(1,(t),(h),(o),(v))
380281494Sandrew#define	bus_space_write_stream_2(t, h, o, v)	__bs_ws_s(2,(t),(h),(o),(v))
381281494Sandrew#define	bus_space_write_stream_4(t, h, o, v)	__bs_ws_s(4,(t),(h),(o),(v))
382281494Sandrew#define	bus_space_write_stream_8(t, h, o, v)	__bs_ws_s(8,(t),(h),(o),(v))
383281494Sandrew
384281494Sandrew
385281494Sandrew/*
386281494Sandrew * Bus write multiple operations.
387281494Sandrew */
388281494Sandrew#define	bus_space_write_multi_1(t, h, o, a, c)				\
389281494Sandrew	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
390281494Sandrew#define	bus_space_write_multi_2(t, h, o, a, c)				\
391281494Sandrew	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
392281494Sandrew#define	bus_space_write_multi_4(t, h, o, a, c)				\
393281494Sandrew	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
394281494Sandrew#define	bus_space_write_multi_8(t, h, o, a, c)				\
395281494Sandrew	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
396281494Sandrew
397281494Sandrew#define	bus_space_write_multi_stream_1(t, h, o, a, c)			\
398281494Sandrew	__bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
399281494Sandrew#define	bus_space_write_multi_stream_2(t, h, o, a, c)			\
400281494Sandrew	__bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
401281494Sandrew#define	bus_space_write_multi_stream_4(t, h, o, a, c)			\
402281494Sandrew	__bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
403281494Sandrew#define	bus_space_write_multi_stream_8(t, h, o, a, c)			\
404281494Sandrew	__bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
405281494Sandrew
406281494Sandrew
407281494Sandrew/*
408281494Sandrew * Bus write region operations.
409281494Sandrew */
410281494Sandrew#define	bus_space_write_region_1(t, h, o, a, c)				\
411281494Sandrew	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
412281494Sandrew#define	bus_space_write_region_2(t, h, o, a, c)				\
413281494Sandrew	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
414281494Sandrew#define	bus_space_write_region_4(t, h, o, a, c)				\
415281494Sandrew	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
416281494Sandrew#define	bus_space_write_region_8(t, h, o, a, c)				\
417281494Sandrew	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
418281494Sandrew
419281494Sandrew#define	bus_space_write_region_stream_1(t, h, o, a, c)			\
420281494Sandrew	__bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
421281494Sandrew#define	bus_space_write_region_stream_2(t, h, o, a, c)			\
422281494Sandrew	__bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
423281494Sandrew#define	bus_space_write_region_stream_4(t, h, o, a, c)			\
424281494Sandrew	__bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
425281494Sandrew#define	bus_space_write_region_stream_8(t, h, o, a, c)			\
426281494Sandrew	__bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
427281494Sandrew
428281494Sandrew
429281494Sandrew/*
430281494Sandrew * Set multiple operations.
431281494Sandrew */
432