xref: /freebsd/sys/arm64/include/bus.h (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
1 /*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/
2 
3 /*-
4  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
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.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
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.
19  *
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.
31  */
32 
33 /*-
34  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
35  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  * 1. Redistributions of source code must retain the above copyright
41  *    notice, this list of conditions and the following disclaimer.
42  * 2. Redistributions in binary form must reproduce the above copyright
43  *    notice, this list of conditions and the following disclaimer in the
44  *    documentation and/or other materials provided with the distribution.
45  * 3. All advertising materials mentioning features or use of this software
46  *    must display the following acknowledgement:
47  *      This product includes software developed by Christopher G. Demetriou
48  *	for the NetBSD Project.
49  * 4. The name of the author may not be used to endorse or promote products
50  *    derived from this software without specific prior written permission
51  *
52  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
53  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
54  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
56  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
57  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
61  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62  *
63  * From: sys/arm/include/bus.h
64  *
65  * $FreeBSD$
66  */
67 
68 #ifdef __arm__
69 #include <arm/bus.h>
70 #else /* !__arm__ */
71 
72 #ifndef _MACHINE_BUS_H_
73 #define	_MACHINE_BUS_H_
74 
75 #include <machine/_bus.h>
76 
77 #define	BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
78 
79 #define	BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL
80 #define	BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL
81 #define	BUS_SPACE_MAXADDR_40BIT	0xFFFFFFFFFFUL
82 #define	BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL
83 #define	BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL
84 #define	BUS_SPACE_MAXSIZE_40BIT	0xFFFFFFFFFFUL
85 
86 #define	BUS_SPACE_MAXADDR	0xFFFFFFFFFFFFFFFFUL
87 #define	BUS_SPACE_MAXSIZE	0xFFFFFFFFFFFFFFFFUL
88 
89 #define	BUS_SPACE_MAP_CACHEABLE		0x01
90 #define	BUS_SPACE_MAP_LINEAR		0x02
91 #define	BUS_SPACE_MAP_PREFETCHABLE	0x04
92 #define	BUS_SPACE_MAP_NONPOSTED		0x08
93 
94 #define	BUS_SPACE_UNRESTRICTED	(~0)
95 
96 #define	BUS_SPACE_BARRIER_READ	0x01
97 #define	BUS_SPACE_BARRIER_WRITE	0x02
98 
99 struct bus_space {
100 	/* cookie */
101 	void		*bs_cookie;
102 
103 	/* mapping/unmapping */
104 	int		(*bs_map) (void *, bus_addr_t, bus_size_t,
105 			    int, bus_space_handle_t *);
106 	void		(*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
107 	int		(*bs_subregion) (void *, bus_space_handle_t,
108 			    bus_size_t, bus_size_t, bus_space_handle_t *);
109 
110 	/* allocation/deallocation */
111 	int		(*bs_alloc) (void *, bus_addr_t, bus_addr_t,
112 			    bus_size_t, bus_size_t, bus_size_t, int,
113 			    bus_addr_t *, bus_space_handle_t *);
114 	void		(*bs_free) (void *, bus_space_handle_t,
115 			    bus_size_t);
116 
117 	/* get kernel virtual address */
118 	/* barrier */
119 	void		(*bs_barrier) (void *, bus_space_handle_t,
120 			    bus_size_t, bus_size_t, int);
121 
122 	/* read single */
123 	u_int8_t	(*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
124 	u_int16_t	(*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
125 	u_int32_t	(*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
126 	u_int64_t	(*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
127 
128 	/* read multiple */
129 	void		(*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
130 	    u_int8_t *, bus_size_t);
131 	void		(*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
132 	    u_int16_t *, bus_size_t);
133 	void		(*bs_rm_4) (void *, bus_space_handle_t,
134 			    bus_size_t, u_int32_t *, bus_size_t);
135 	void		(*bs_rm_8) (void *, bus_space_handle_t,
136 			    bus_size_t, u_int64_t *, bus_size_t);
137 
138 	/* read region */
139 	void		(*bs_rr_1) (void *, bus_space_handle_t,
140 			    bus_size_t, u_int8_t *, bus_size_t);
141 	void		(*bs_rr_2) (void *, bus_space_handle_t,
142 			    bus_size_t, u_int16_t *, bus_size_t);
143 	void		(*bs_rr_4) (void *, bus_space_handle_t,
144 			    bus_size_t, u_int32_t *, bus_size_t);
145 	void		(*bs_rr_8) (void *, bus_space_handle_t,
146 			    bus_size_t, u_int64_t *, bus_size_t);
147 
148 	/* write single */
149 	void		(*bs_w_1) (void *, bus_space_handle_t,
150 			    bus_size_t, u_int8_t);
151 	void		(*bs_w_2) (void *, bus_space_handle_t,
152 			    bus_size_t, u_int16_t);
153 	void		(*bs_w_4) (void *, bus_space_handle_t,
154 			    bus_size_t, u_int32_t);
155 	void		(*bs_w_8) (void *, bus_space_handle_t,
156 			    bus_size_t, u_int64_t);
157 
158 	/* write multiple */
159 	void		(*bs_wm_1) (void *, bus_space_handle_t,
160 			    bus_size_t, const u_int8_t *, bus_size_t);
161 	void		(*bs_wm_2) (void *, bus_space_handle_t,
162 			    bus_size_t, const u_int16_t *, bus_size_t);
163 	void		(*bs_wm_4) (void *, bus_space_handle_t,
164 			    bus_size_t, const u_int32_t *, bus_size_t);
165 	void		(*bs_wm_8) (void *, bus_space_handle_t,
166 			    bus_size_t, const u_int64_t *, bus_size_t);
167 
168 	/* write region */
169 	void		(*bs_wr_1) (void *, bus_space_handle_t,
170 			    bus_size_t, const u_int8_t *, bus_size_t);
171 	void		(*bs_wr_2) (void *, bus_space_handle_t,
172 			    bus_size_t, const u_int16_t *, bus_size_t);
173 	void		(*bs_wr_4) (void *, bus_space_handle_t,
174 			    bus_size_t, const u_int32_t *, bus_size_t);
175 	void		(*bs_wr_8) (void *, bus_space_handle_t,
176 			    bus_size_t, const u_int64_t *, bus_size_t);
177 
178 	/* set multiple */
179 	void		(*bs_sm_1) (void *, bus_space_handle_t,
180 			    bus_size_t, u_int8_t, bus_size_t);
181 	void		(*bs_sm_2) (void *, bus_space_handle_t,
182 			    bus_size_t, u_int16_t, bus_size_t);
183 	void		(*bs_sm_4) (void *, bus_space_handle_t,
184 			    bus_size_t, u_int32_t, bus_size_t);
185 	void		(*bs_sm_8) (void *, bus_space_handle_t,
186 			    bus_size_t, u_int64_t, bus_size_t);
187 
188 	/* set region */
189 	void		(*bs_sr_1) (void *, bus_space_handle_t,
190 			    bus_size_t, u_int8_t, bus_size_t);
191 	void		(*bs_sr_2) (void *, bus_space_handle_t,
192 			    bus_size_t, u_int16_t, bus_size_t);
193 	void		(*bs_sr_4) (void *, bus_space_handle_t,
194 			    bus_size_t, u_int32_t, bus_size_t);
195 	void		(*bs_sr_8) (void *, bus_space_handle_t,
196 			    bus_size_t, u_int64_t, bus_size_t);
197 
198 	/* copy */
199 	void		(*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
200 			    bus_space_handle_t, bus_size_t, bus_size_t);
201 	void		(*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
202 			    bus_space_handle_t, bus_size_t, bus_size_t);
203 	void		(*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
204 			    bus_space_handle_t, bus_size_t, bus_size_t);
205 	void		(*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
206 			    bus_space_handle_t, bus_size_t, bus_size_t);
207 
208 	/* read single stream */
209 	u_int8_t	(*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
210 	u_int16_t	(*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
211 	u_int32_t	(*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
212 	u_int64_t	(*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
213 
214 	/* read multiple stream */
215 	void		(*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
216 	    u_int8_t *, bus_size_t);
217 	void		(*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
218 	    u_int16_t *, bus_size_t);
219 	void		(*bs_rm_4_s) (void *, bus_space_handle_t,
220 			    bus_size_t, u_int32_t *, bus_size_t);
221 	void		(*bs_rm_8_s) (void *, bus_space_handle_t,
222 			    bus_size_t, u_int64_t *, bus_size_t);
223 
224 	/* read region stream */
225 	void		(*bs_rr_1_s) (void *, bus_space_handle_t,
226 			    bus_size_t, u_int8_t *, bus_size_t);
227 	void		(*bs_rr_2_s) (void *, bus_space_handle_t,
228 			    bus_size_t, u_int16_t *, bus_size_t);
229 	void		(*bs_rr_4_s) (void *, bus_space_handle_t,
230 			    bus_size_t, u_int32_t *, bus_size_t);
231 	void		(*bs_rr_8_s) (void *, bus_space_handle_t,
232 			    bus_size_t, u_int64_t *, bus_size_t);
233 
234 	/* write single stream */
235 	void		(*bs_w_1_s) (void *, bus_space_handle_t,
236 			    bus_size_t, u_int8_t);
237 	void		(*bs_w_2_s) (void *, bus_space_handle_t,
238 			    bus_size_t, u_int16_t);
239 	void		(*bs_w_4_s) (void *, bus_space_handle_t,
240 			    bus_size_t, u_int32_t);
241 	void		(*bs_w_8_s) (void *, bus_space_handle_t,
242 			    bus_size_t, u_int64_t);
243 
244 	/* write multiple stream */
245 	void		(*bs_wm_1_s) (void *, bus_space_handle_t,
246 			    bus_size_t, const u_int8_t *, bus_size_t);
247 	void		(*bs_wm_2_s) (void *, bus_space_handle_t,
248 			    bus_size_t, const u_int16_t *, bus_size_t);
249 	void		(*bs_wm_4_s) (void *, bus_space_handle_t,
250 			    bus_size_t, const u_int32_t *, bus_size_t);
251 	void		(*bs_wm_8_s) (void *, bus_space_handle_t,
252 			    bus_size_t, const u_int64_t *, bus_size_t);
253 
254 	/* write region stream */
255 	void		(*bs_wr_1_s) (void *, bus_space_handle_t,
256 			    bus_size_t, const u_int8_t *, bus_size_t);
257 	void		(*bs_wr_2_s) (void *, bus_space_handle_t,
258 			    bus_size_t, const u_int16_t *, bus_size_t);
259 	void		(*bs_wr_4_s) (void *, bus_space_handle_t,
260 			    bus_size_t, const u_int32_t *, bus_size_t);
261 	void		(*bs_wr_8_s) (void *, bus_space_handle_t,
262 			    bus_size_t, const u_int64_t *, bus_size_t);
263 
264 	/* peek */
265 	int		(*bs_peek_1)(void *, bus_space_handle_t,
266 			    bus_size_t , uint8_t *);
267 	int		(*bs_peek_2)(void *, bus_space_handle_t,
268 			    bus_size_t , uint16_t *);
269 	int		(*bs_peek_4)(void *, bus_space_handle_t,
270 			    bus_size_t , uint32_t *);
271 	int		(*bs_peek_8)(void *, bus_space_handle_t,
272 			    bus_size_t , uint64_t *);
273 
274 	/* poke */
275 	int		(*bs_poke_1)(void *, bus_space_handle_t,
276 			   bus_size_t, uint8_t);
277 	int		(*bs_poke_2)(void *, bus_space_handle_t,
278 			   bus_size_t, uint16_t);
279 	int		(*bs_poke_4)(void *, bus_space_handle_t,
280 			   bus_size_t, uint32_t);
281 	int		(*bs_poke_8)(void *, bus_space_handle_t,
282 			   bus_size_t, uint64_t);
283 };
284 
285 #if defined(SAN_NEEDS_INTERCEPTORS) && !defined(SAN_RUNTIME)
286 #include <sys/bus_san.h>
287 #else
288 
289 /*
290  * Utility macros; INTERNAL USE ONLY.
291  */
292 #define	__bs_c(a,b)		__CONCAT(a,b)
293 #define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size)
294 
295 #define	__bs_rs(sz, t, h, o)						\
296 	(*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
297 #define	__bs_ws(sz, t, h, o, v)						\
298 	(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
299 #define	__bs_nonsingle(type, sz, t, h, o, a, c)				\
300 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
301 #define	__bs_set(type, sz, t, h, o, v, c)				\
302 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
303 #define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\
304 	(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
305 
306 #define	__bs_opname_s(op,size)	__bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
307 #define	__bs_rs_s(sz, t, h, o)						\
308 	(*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
309 #define	__bs_ws_s(sz, t, h, o, v)					\
310 	(*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
311 #define	__bs_peek(sz, t, h, o, vp)					\
312 	(*(t)->__bs_opname(peek, sz))((t)->bs_cookie, h, o, vp)
313 #define	__bs_poke(sz, t, h, o, v)					\
314 	(*(t)->__bs_opname(poke, sz))((t)->bs_cookie, h, o, v)
315 #define	__bs_nonsingle_s(type, sz, t, h, o, a, c)			\
316 	(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
317 
318 /*
319  * Mapping and unmapping operations.
320  */
321 #define	bus_space_map(t, a, s, c, hp)					\
322 	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
323 #define	bus_space_unmap(t, h, s)					\
324 	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
325 #define	bus_space_subregion(t, h, o, s, hp)				\
326 	(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
327 
328 /*
329  * Allocation and deallocation operations.
330  */
331 #define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)			\
332 	(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),	\
333 	    (c), (ap), (hp))
334 #define	bus_space_free(t, h, s)						\
335 	(*(t)->bs_free)((t)->bs_cookie, (h), (s))
336 
337 /*
338  * Bus barrier operations.
339  */
340 #define	bus_space_barrier(t, h, o, l, f)				\
341 	(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
342 
343 /*
344  * Bus read (single) operations.
345  */
346 #define	bus_space_read_1(t, h, o)	__bs_rs(1,(t),(h),(o))
347 #define	bus_space_read_2(t, h, o)	__bs_rs(2,(t),(h),(o))
348 #define	bus_space_read_4(t, h, o)	__bs_rs(4,(t),(h),(o))
349 #define	bus_space_read_8(t, h, o)	__bs_rs(8,(t),(h),(o))
350 
351 #define	bus_space_read_stream_1(t, h, o)	__bs_rs_s(1,(t), (h), (o))
352 #define	bus_space_read_stream_2(t, h, o)	__bs_rs_s(2,(t), (h), (o))
353 #define	bus_space_read_stream_4(t, h, o)	__bs_rs_s(4,(t), (h), (o))
354 #define	bus_space_read_stream_8(t, h, o)	__bs_rs_s(8,(t), (h), (o))
355 
356 /*
357  * Bus read multiple operations.
358  */
359 #define	bus_space_read_multi_1(t, h, o, a, c)				\
360 	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
361 #define	bus_space_read_multi_2(t, h, o, a, c)				\
362 	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
363 #define	bus_space_read_multi_4(t, h, o, a, c)				\
364 	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
365 #define	bus_space_read_multi_8(t, h, o, a, c)				\
366 	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
367 
368 #define	bus_space_read_multi_stream_1(t, h, o, a, c)			\
369 	__bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
370 #define	bus_space_read_multi_stream_2(t, h, o, a, c)			\
371 	__bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
372 #define	bus_space_read_multi_stream_4(t, h, o, a, c)			\
373 	__bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
374 #define	bus_space_read_multi_stream_8(t, h, o, a, c)			\
375 	__bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
376 
377 /*
378  * Bus read region operations.
379  */
380 #define	bus_space_read_region_1(t, h, o, a, c)				\
381 	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
382 #define	bus_space_read_region_2(t, h, o, a, c)				\
383 	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
384 #define	bus_space_read_region_4(t, h, o, a, c)				\
385 	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
386 #define	bus_space_read_region_8(t, h, o, a, c)				\
387 	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
388 
389 #define	bus_space_read_region_stream_1(t, h, o, a, c)			\
390 	__bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
391 #define	bus_space_read_region_stream_2(t, h, o, a, c)			\
392 	__bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
393 #define	bus_space_read_region_stream_4(t, h, o, a, c)			\
394 	__bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
395 #define	bus_space_read_region_stream_8(t, h, o, a, c)			\
396 	__bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
397 
398 /*
399  * Bus write (single) operations.
400  */
401 #define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v))
402 #define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v))
403 #define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v))
404 #define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v))
405 
406 #define	bus_space_write_stream_1(t, h, o, v)	__bs_ws_s(1,(t),(h),(o),(v))
407 #define	bus_space_write_stream_2(t, h, o, v)	__bs_ws_s(2,(t),(h),(o),(v))
408 #define	bus_space_write_stream_4(t, h, o, v)	__bs_ws_s(4,(t),(h),(o),(v))
409 #define	bus_space_write_stream_8(t, h, o, v)	__bs_ws_s(8,(t),(h),(o),(v))
410 
411 /*
412  * Bus write multiple operations.
413  */
414 #define	bus_space_write_multi_1(t, h, o, a, c)				\
415 	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
416 #define	bus_space_write_multi_2(t, h, o, a, c)				\
417 	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
418 #define	bus_space_write_multi_4(t, h, o, a, c)				\
419 	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
420 #define	bus_space_write_multi_8(t, h, o, a, c)				\
421 	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
422 
423 #define	bus_space_write_multi_stream_1(t, h, o, a, c)			\
424 	__bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
425 #define	bus_space_write_multi_stream_2(t, h, o, a, c)			\
426 	__bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
427 #define	bus_space_write_multi_stream_4(t, h, o, a, c)			\
428 	__bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
429 #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\
430 	__bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
431 
432 /*
433  * Bus write region operations.
434  */
435 #define	bus_space_write_region_1(t, h, o, a, c)				\
436 	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
437 #define	bus_space_write_region_2(t, h, o, a, c)				\
438 	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
439 #define	bus_space_write_region_4(t, h, o, a, c)				\
440 	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
441 #define	bus_space_write_region_8(t, h, o, a, c)				\
442 	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
443 
444 #define	bus_space_write_region_stream_1(t, h, o, a, c)			\
445 	__bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
446 #define	bus_space_write_region_stream_2(t, h, o, a, c)			\
447 	__bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
448 #define	bus_space_write_region_stream_4(t, h, o, a, c)			\
449 	__bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
450 #define	bus_space_write_region_stream_8(t, h, o, a, c)			\
451 	__bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
452 
453 /*
454  * Set multiple operations.
455  */
456 #define	bus_space_set_multi_1(t, h, o, v, c)				\
457 	__bs_set(sm,1,(t),(h),(o),(v),(c))
458 #define	bus_space_set_multi_2(t, h, o, v, c)				\
459 	__bs_set(sm,2,(t),(h),(o),(v),(c))
460 #define	bus_space_set_multi_4(t, h, o, v, c)				\
461 	__bs_set(sm,4,(t),(h),(o),(v),(c))
462 #define	bus_space_set_multi_8(t, h, o, v, c)				\
463 	__bs_set(sm,8,(t),(h),(o),(v),(c))
464 
465 #define	bus_space_set_multi_stream_1(t, h, o, v, c)			\
466 	bus_space_set_multi_1((t), (h), (o), (v), (c))
467 #define	bus_space_set_multi_stream_2(t, h, o, v, c)			\
468 	bus_space_set_multi_2((t), (h), (o), (v), (c))
469 #define	bus_space_set_multi_stream_4(t, h, o, v, c)			\
470 	bus_space_set_multi_4((t), (h), (o), (v), (c))
471 #define	bus_space_set_multi_stream_8(t, h, o, v, c)			\
472 	bus_space_set_multi_8((t), (h), (o), (v), (c))
473 
474 /*
475  * Set region operations.
476  */
477 #define	bus_space_set_region_1(t, h, o, v, c)				\
478 	__bs_set(sr,1,(t),(h),(o),(v),(c))
479 #define	bus_space_set_region_2(t, h, o, v, c)				\
480 	__bs_set(sr,2,(t),(h),(o),(v),(c))
481 #define	bus_space_set_region_4(t, h, o, v, c)				\
482 	__bs_set(sr,4,(t),(h),(o),(v),(c))
483 #define	bus_space_set_region_8(t, h, o, v, c)				\
484 	__bs_set(sr,8,(t),(h),(o),(v),(c))
485 
486 #define	bus_space_set_region_stream_1(t, h, o, v, c)			\
487 	bus_space_set_region_1((t), (h), (o), (v), (c))
488 #define	bus_space_set_region_stream_2(t, h, o, v, c)			\
489 	bus_space_set_region_2((t), (h), (o), (v), (c))
490 #define	bus_space_set_region_stream_4(t, h, o, v, c)			\
491 	bus_space_set_region_4((t), (h), (o), (v), (c))
492 #define	bus_space_set_region_stream_8(t, h, o, v, c)			\
493 	bus_space_set_region_8((t), (h), (o), (v), (c))
494 
495 /*
496  * Copy operations.
497  */
498 #define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)				\
499 	__bs_copy(1, t, h1, o1, h2, o2, c)
500 #define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)				\
501 	__bs_copy(2, t, h1, o1, h2, o2, c)
502 #define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)				\
503 	__bs_copy(4, t, h1, o1, h2, o2, c)
504 #define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)				\
505 	__bs_copy(8, t, h1, o1, h2, o2, c)
506 
507 /*
508  * Poke (checked write) operations.
509  */
510 #define	bus_space_poke_1(t, h, o, v)	__bs_poke(1, (t), (h), (o), (v))
511 #define	bus_space_poke_2(t, h, o, v)	__bs_poke(2, (t), (h), (o), (v))
512 #define	bus_space_poke_4(t, h, o, v)	__bs_poke(4, (t), (h), (o), (v))
513 #define	bus_space_poke_8(t, h, o, v)	__bs_poke(8, (t), (h), (o), (v))
514 
515 /*
516  * Peek (checked read) operations.
517  */
518 #define	bus_space_peek_1(t, h, o, vp)	__bs_peek(1, (t), (h), (o), (vp))
519 #define	bus_space_peek_2(t, h, o, vp)	__bs_peek(2, (t), (h), (o), (vp))
520 #define	bus_space_peek_4(t, h, o, vp)	__bs_peek(4, (t), (h), (o), (vp))
521 #define	bus_space_peek_8(t, h, o, vp)	__bs_peek(8, (t), (h), (o), (vp))
522 
523 #endif /* !SAN_NEEDS_INTERCEPTORS */
524 
525 #include <machine/bus_dma.h>
526 
527 #endif /* _MACHINE_BUS_H_ */
528 
529 #endif /* !__arm__ */
530