xref: /freebsd/sys/arm64/include/bus.h (revision 5484c3d6eb31a78f07ed5e66862a1e7d3b5225b6)
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 
66 #ifdef __arm__
67 #include <arm/bus.h>
68 #else /* !__arm__ */
69 
70 #ifndef _MACHINE_BUS_H_
71 #define	_MACHINE_BUS_H_
72 
73 #include <machine/_bus.h>
74 
75 #define	BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
76 
77 #define	BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL
78 #define	BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL
79 #define	BUS_SPACE_MAXADDR_36BIT 0xFFFFFFFFFUL
80 #define	BUS_SPACE_MAXADDR_40BIT	0xFFFFFFFFFFUL
81 #define	BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL
82 #define	BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL
83 #define	BUS_SPACE_MAXSIZE_40BIT	0xFFFFFFFFFFUL
84 
85 #define	BUS_SPACE_MAXADDR	0xFFFFFFFFFFFFFFFFUL
86 #define	BUS_SPACE_MAXSIZE	0xFFFFFFFFFFFFFFFFUL
87 
88 #define	BUS_SPACE_MAP_CACHEABLE		0x01
89 #define	BUS_SPACE_MAP_LINEAR		0x02
90 #define	BUS_SPACE_MAP_PREFETCHABLE	0x04
91 #define	BUS_SPACE_MAP_NONPOSTED		0x08
92 
93 #define	BUS_SPACE_UNRESTRICTED	(~0)
94 
95 #define	BUS_SPACE_BARRIER_READ	0x01
96 #define	BUS_SPACE_BARRIER_WRITE	0x02
97 
98 struct bus_space {
99 	/* cookie */
100 	void		*bs_cookie;
101 
102 	/* mapping/unmapping */
103 	int		(*bs_map) (void *, bus_addr_t, bus_size_t,
104 			    int, bus_space_handle_t *);
105 	void		(*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
106 	int		(*bs_subregion) (void *, bus_space_handle_t,
107 			    bus_size_t, bus_size_t, bus_space_handle_t *);
108 
109 	/* allocation/deallocation */
110 	int		(*bs_alloc) (void *, bus_addr_t, bus_addr_t,
111 			    bus_size_t, bus_size_t, bus_size_t, int,
112 			    bus_addr_t *, bus_space_handle_t *);
113 	void		(*bs_free) (void *, bus_space_handle_t,
114 			    bus_size_t);
115 
116 	/* get kernel virtual address */
117 	/* barrier */
118 	void		(*bs_barrier) (void *, bus_space_handle_t,
119 			    bus_size_t, bus_size_t, int);
120 
121 	/* read single */
122 	u_int8_t	(*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
123 	u_int16_t	(*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
124 	u_int32_t	(*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
125 	u_int64_t	(*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
126 
127 	/* read multiple */
128 	void		(*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
129 	    u_int8_t *, bus_size_t);
130 	void		(*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
131 	    u_int16_t *, bus_size_t);
132 	void		(*bs_rm_4) (void *, bus_space_handle_t,
133 			    bus_size_t, u_int32_t *, bus_size_t);
134 	void		(*bs_rm_8) (void *, bus_space_handle_t,
135 			    bus_size_t, u_int64_t *, bus_size_t);
136 
137 	/* read region */
138 	void		(*bs_rr_1) (void *, bus_space_handle_t,
139 			    bus_size_t, u_int8_t *, bus_size_t);
140 	void		(*bs_rr_2) (void *, bus_space_handle_t,
141 			    bus_size_t, u_int16_t *, bus_size_t);
142 	void		(*bs_rr_4) (void *, bus_space_handle_t,
143 			    bus_size_t, u_int32_t *, bus_size_t);
144 	void		(*bs_rr_8) (void *, bus_space_handle_t,
145 			    bus_size_t, u_int64_t *, bus_size_t);
146 
147 	/* write single */
148 	void		(*bs_w_1) (void *, bus_space_handle_t,
149 			    bus_size_t, u_int8_t);
150 	void		(*bs_w_2) (void *, bus_space_handle_t,
151 			    bus_size_t, u_int16_t);
152 	void		(*bs_w_4) (void *, bus_space_handle_t,
153 			    bus_size_t, u_int32_t);
154 	void		(*bs_w_8) (void *, bus_space_handle_t,
155 			    bus_size_t, u_int64_t);
156 
157 	/* write multiple */
158 	void		(*bs_wm_1) (void *, bus_space_handle_t,
159 			    bus_size_t, const u_int8_t *, bus_size_t);
160 	void		(*bs_wm_2) (void *, bus_space_handle_t,
161 			    bus_size_t, const u_int16_t *, bus_size_t);
162 	void		(*bs_wm_4) (void *, bus_space_handle_t,
163 			    bus_size_t, const u_int32_t *, bus_size_t);
164 	void		(*bs_wm_8) (void *, bus_space_handle_t,
165 			    bus_size_t, const u_int64_t *, bus_size_t);
166 
167 	/* write region */
168 	void		(*bs_wr_1) (void *, bus_space_handle_t,
169 			    bus_size_t, const u_int8_t *, bus_size_t);
170 	void		(*bs_wr_2) (void *, bus_space_handle_t,
171 			    bus_size_t, const u_int16_t *, bus_size_t);
172 	void		(*bs_wr_4) (void *, bus_space_handle_t,
173 			    bus_size_t, const u_int32_t *, bus_size_t);
174 	void		(*bs_wr_8) (void *, bus_space_handle_t,
175 			    bus_size_t, const u_int64_t *, bus_size_t);
176 
177 	/* set multiple */
178 	void		(*bs_sm_1) (void *, bus_space_handle_t,
179 			    bus_size_t, u_int8_t, bus_size_t);
180 	void		(*bs_sm_2) (void *, bus_space_handle_t,
181 			    bus_size_t, u_int16_t, bus_size_t);
182 	void		(*bs_sm_4) (void *, bus_space_handle_t,
183 			    bus_size_t, u_int32_t, bus_size_t);
184 	void		(*bs_sm_8) (void *, bus_space_handle_t,
185 			    bus_size_t, u_int64_t, bus_size_t);
186 
187 	/* set region */
188 	void		(*bs_sr_1) (void *, bus_space_handle_t,
189 			    bus_size_t, u_int8_t, bus_size_t);
190 	void		(*bs_sr_2) (void *, bus_space_handle_t,
191 			    bus_size_t, u_int16_t, bus_size_t);
192 	void		(*bs_sr_4) (void *, bus_space_handle_t,
193 			    bus_size_t, u_int32_t, bus_size_t);
194 	void		(*bs_sr_8) (void *, bus_space_handle_t,
195 			    bus_size_t, u_int64_t, bus_size_t);
196 
197 	/* copy */
198 	void		(*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
199 			    bus_space_handle_t, bus_size_t, bus_size_t);
200 	void		(*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
201 			    bus_space_handle_t, bus_size_t, bus_size_t);
202 	void		(*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
203 			    bus_space_handle_t, bus_size_t, bus_size_t);
204 	void		(*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
205 			    bus_space_handle_t, bus_size_t, bus_size_t);
206 
207 	/* read single stream */
208 	u_int8_t	(*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
209 	u_int16_t	(*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
210 	u_int32_t	(*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
211 	u_int64_t	(*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
212 
213 	/* read multiple stream */
214 	void		(*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
215 	    u_int8_t *, bus_size_t);
216 	void		(*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
217 	    u_int16_t *, bus_size_t);
218 	void		(*bs_rm_4_s) (void *, bus_space_handle_t,
219 			    bus_size_t, u_int32_t *, bus_size_t);
220 	void		(*bs_rm_8_s) (void *, bus_space_handle_t,
221 			    bus_size_t, u_int64_t *, bus_size_t);
222 
223 	/* read region stream */
224 	void		(*bs_rr_1_s) (void *, bus_space_handle_t,
225 			    bus_size_t, u_int8_t *, bus_size_t);
226 	void		(*bs_rr_2_s) (void *, bus_space_handle_t,
227 			    bus_size_t, u_int16_t *, bus_size_t);
228 	void		(*bs_rr_4_s) (void *, bus_space_handle_t,
229 			    bus_size_t, u_int32_t *, bus_size_t);
230 	void		(*bs_rr_8_s) (void *, bus_space_handle_t,
231 			    bus_size_t, u_int64_t *, bus_size_t);
232 
233 	/* write single stream */
234 	void		(*bs_w_1_s) (void *, bus_space_handle_t,
235 			    bus_size_t, u_int8_t);
236 	void		(*bs_w_2_s) (void *, bus_space_handle_t,
237 			    bus_size_t, u_int16_t);
238 	void		(*bs_w_4_s) (void *, bus_space_handle_t,
239 			    bus_size_t, u_int32_t);
240 	void		(*bs_w_8_s) (void *, bus_space_handle_t,
241 			    bus_size_t, u_int64_t);
242 
243 	/* write multiple stream */
244 	void		(*bs_wm_1_s) (void *, bus_space_handle_t,
245 			    bus_size_t, const u_int8_t *, bus_size_t);
246 	void		(*bs_wm_2_s) (void *, bus_space_handle_t,
247 			    bus_size_t, const u_int16_t *, bus_size_t);
248 	void		(*bs_wm_4_s) (void *, bus_space_handle_t,
249 			    bus_size_t, const u_int32_t *, bus_size_t);
250 	void		(*bs_wm_8_s) (void *, bus_space_handle_t,
251 			    bus_size_t, const u_int64_t *, bus_size_t);
252 
253 	/* write region stream */
254 	void		(*bs_wr_1_s) (void *, bus_space_handle_t,
255 			    bus_size_t, const u_int8_t *, bus_size_t);
256 	void		(*bs_wr_2_s) (void *, bus_space_handle_t,
257 			    bus_size_t, const u_int16_t *, bus_size_t);
258 	void		(*bs_wr_4_s) (void *, bus_space_handle_t,
259 			    bus_size_t, const u_int32_t *, bus_size_t);
260 	void		(*bs_wr_8_s) (void *, bus_space_handle_t,
261 			    bus_size_t, const u_int64_t *, bus_size_t);
262 
263 	/* peek */
264 	int		(*bs_peek_1)(void *, bus_space_handle_t,
265 			    bus_size_t , uint8_t *);
266 	int		(*bs_peek_2)(void *, bus_space_handle_t,
267 			    bus_size_t , uint16_t *);
268 	int		(*bs_peek_4)(void *, bus_space_handle_t,
269 			    bus_size_t , uint32_t *);
270 	int		(*bs_peek_8)(void *, bus_space_handle_t,
271 			    bus_size_t , uint64_t *);
272 
273 	/* poke */
274 	int		(*bs_poke_1)(void *, bus_space_handle_t,
275 			   bus_size_t, uint8_t);
276 	int		(*bs_poke_2)(void *, bus_space_handle_t,
277 			   bus_size_t, uint16_t);
278 	int		(*bs_poke_4)(void *, bus_space_handle_t,
279 			   bus_size_t, uint32_t);
280 	int		(*bs_poke_8)(void *, bus_space_handle_t,
281 			   bus_size_t, uint64_t);
282 };
283 
284 #if defined(SAN_NEEDS_INTERCEPTORS) && !defined(SAN_RUNTIME)
285 #include <sys/bus_san.h>
286 #else
287 
288 /*
289  * Utility macros; INTERNAL USE ONLY.
290  */
291 #define	__bs_c(a,b)		__CONCAT(a,b)
292 #define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size)
293 
294 #define	__bs_rs(sz, t, h, o)						\
295 	(*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
296 #define	__bs_ws(sz, t, h, o, v)						\
297 	(*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
298 #define	__bs_nonsingle(type, sz, t, h, o, a, c)				\
299 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
300 #define	__bs_set(type, sz, t, h, o, v, c)				\
301 	(*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
302 #define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\
303 	(*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
304 
305 #define	__bs_opname_s(op,size)	__bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
306 #define	__bs_rs_s(sz, t, h, o)						\
307 	(*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
308 #define	__bs_ws_s(sz, t, h, o, v)					\
309 	(*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
310 #define	__bs_peek(sz, t, h, o, vp)					\
311 	(*(t)->__bs_opname(peek, sz))((t)->bs_cookie, h, o, vp)
312 #define	__bs_poke(sz, t, h, o, v)					\
313 	(*(t)->__bs_opname(poke, sz))((t)->bs_cookie, h, o, v)
314 #define	__bs_nonsingle_s(type, sz, t, h, o, a, c)			\
315 	(*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
316 
317 /*
318  * Mapping and unmapping operations.
319  */
320 #define	bus_space_map(t, a, s, c, hp)					\
321 	(*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
322 #define	bus_space_unmap(t, h, s)					\
323 	(*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
324 #define	bus_space_subregion(t, h, o, s, hp)				\
325 	(*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
326 
327 /*
328  * Allocation and deallocation operations.
329  */
330 #define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)			\
331 	(*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),	\
332 	    (c), (ap), (hp))
333 #define	bus_space_free(t, h, s)						\
334 	(*(t)->bs_free)((t)->bs_cookie, (h), (s))
335 
336 /*
337  * Bus barrier operations.
338  */
339 #define	bus_space_barrier(t, h, o, l, f)				\
340 	(*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
341 
342 /*
343  * Bus read (single) operations.
344  */
345 #define	bus_space_read_1(t, h, o)	__bs_rs(1,(t),(h),(o))
346 #define	bus_space_read_2(t, h, o)	__bs_rs(2,(t),(h),(o))
347 #define	bus_space_read_4(t, h, o)	__bs_rs(4,(t),(h),(o))
348 #define	bus_space_read_8(t, h, o)	__bs_rs(8,(t),(h),(o))
349 
350 #define	bus_space_read_stream_1(t, h, o)	__bs_rs_s(1,(t), (h), (o))
351 #define	bus_space_read_stream_2(t, h, o)	__bs_rs_s(2,(t), (h), (o))
352 #define	bus_space_read_stream_4(t, h, o)	__bs_rs_s(4,(t), (h), (o))
353 #define	bus_space_read_stream_8(t, h, o)	__bs_rs_s(8,(t), (h), (o))
354 
355 /*
356  * Bus read multiple operations.
357  */
358 #define	bus_space_read_multi_1(t, h, o, a, c)				\
359 	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
360 #define	bus_space_read_multi_2(t, h, o, a, c)				\
361 	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
362 #define	bus_space_read_multi_4(t, h, o, a, c)				\
363 	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
364 #define	bus_space_read_multi_8(t, h, o, a, c)				\
365 	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
366 
367 #define	bus_space_read_multi_stream_1(t, h, o, a, c)			\
368 	__bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
369 #define	bus_space_read_multi_stream_2(t, h, o, a, c)			\
370 	__bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
371 #define	bus_space_read_multi_stream_4(t, h, o, a, c)			\
372 	__bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
373 #define	bus_space_read_multi_stream_8(t, h, o, a, c)			\
374 	__bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
375 
376 /*
377  * Bus read region operations.
378  */
379 #define	bus_space_read_region_1(t, h, o, a, c)				\
380 	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
381 #define	bus_space_read_region_2(t, h, o, a, c)				\
382 	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
383 #define	bus_space_read_region_4(t, h, o, a, c)				\
384 	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
385 #define	bus_space_read_region_8(t, h, o, a, c)				\
386 	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
387 
388 #define	bus_space_read_region_stream_1(t, h, o, a, c)			\
389 	__bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
390 #define	bus_space_read_region_stream_2(t, h, o, a, c)			\
391 	__bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
392 #define	bus_space_read_region_stream_4(t, h, o, a, c)			\
393 	__bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
394 #define	bus_space_read_region_stream_8(t, h, o, a, c)			\
395 	__bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
396 
397 /*
398  * Bus write (single) operations.
399  */
400 #define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v))
401 #define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v))
402 #define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v))
403 #define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v))
404 
405 #define	bus_space_write_stream_1(t, h, o, v)	__bs_ws_s(1,(t),(h),(o),(v))
406 #define	bus_space_write_stream_2(t, h, o, v)	__bs_ws_s(2,(t),(h),(o),(v))
407 #define	bus_space_write_stream_4(t, h, o, v)	__bs_ws_s(4,(t),(h),(o),(v))
408 #define	bus_space_write_stream_8(t, h, o, v)	__bs_ws_s(8,(t),(h),(o),(v))
409 
410 /*
411  * Bus write multiple operations.
412  */
413 #define	bus_space_write_multi_1(t, h, o, a, c)				\
414 	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
415 #define	bus_space_write_multi_2(t, h, o, a, c)				\
416 	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
417 #define	bus_space_write_multi_4(t, h, o, a, c)				\
418 	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
419 #define	bus_space_write_multi_8(t, h, o, a, c)				\
420 	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
421 
422 #define	bus_space_write_multi_stream_1(t, h, o, a, c)			\
423 	__bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
424 #define	bus_space_write_multi_stream_2(t, h, o, a, c)			\
425 	__bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
426 #define	bus_space_write_multi_stream_4(t, h, o, a, c)			\
427 	__bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
428 #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\
429 	__bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
430 
431 /*
432  * Bus write region operations.
433  */
434 #define	bus_space_write_region_1(t, h, o, a, c)				\
435 	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
436 #define	bus_space_write_region_2(t, h, o, a, c)				\
437 	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
438 #define	bus_space_write_region_4(t, h, o, a, c)				\
439 	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
440 #define	bus_space_write_region_8(t, h, o, a, c)				\
441 	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
442 
443 #define	bus_space_write_region_stream_1(t, h, o, a, c)			\
444 	__bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
445 #define	bus_space_write_region_stream_2(t, h, o, a, c)			\
446 	__bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
447 #define	bus_space_write_region_stream_4(t, h, o, a, c)			\
448 	__bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
449 #define	bus_space_write_region_stream_8(t, h, o, a, c)			\
450 	__bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
451 
452 /*
453  * Set multiple operations.
454  */
455 #define	bus_space_set_multi_1(t, h, o, v, c)				\
456 	__bs_set(sm,1,(t),(h),(o),(v),(c))
457 #define	bus_space_set_multi_2(t, h, o, v, c)				\
458 	__bs_set(sm,2,(t),(h),(o),(v),(c))
459 #define	bus_space_set_multi_4(t, h, o, v, c)				\
460 	__bs_set(sm,4,(t),(h),(o),(v),(c))
461 #define	bus_space_set_multi_8(t, h, o, v, c)				\
462 	__bs_set(sm,8,(t),(h),(o),(v),(c))
463 
464 #define	bus_space_set_multi_stream_1(t, h, o, v, c)			\
465 	bus_space_set_multi_1((t), (h), (o), (v), (c))
466 #define	bus_space_set_multi_stream_2(t, h, o, v, c)			\
467 	bus_space_set_multi_2((t), (h), (o), (v), (c))
468 #define	bus_space_set_multi_stream_4(t, h, o, v, c)			\
469 	bus_space_set_multi_4((t), (h), (o), (v), (c))
470 #define	bus_space_set_multi_stream_8(t, h, o, v, c)			\
471 	bus_space_set_multi_8((t), (h), (o), (v), (c))
472 
473 /*
474  * Set region operations.
475  */
476 #define	bus_space_set_region_1(t, h, o, v, c)				\
477 	__bs_set(sr,1,(t),(h),(o),(v),(c))
478 #define	bus_space_set_region_2(t, h, o, v, c)				\
479 	__bs_set(sr,2,(t),(h),(o),(v),(c))
480 #define	bus_space_set_region_4(t, h, o, v, c)				\
481 	__bs_set(sr,4,(t),(h),(o),(v),(c))
482 #define	bus_space_set_region_8(t, h, o, v, c)				\
483 	__bs_set(sr,8,(t),(h),(o),(v),(c))
484 
485 #define	bus_space_set_region_stream_1(t, h, o, v, c)			\
486 	bus_space_set_region_1((t), (h), (o), (v), (c))
487 #define	bus_space_set_region_stream_2(t, h, o, v, c)			\
488 	bus_space_set_region_2((t), (h), (o), (v), (c))
489 #define	bus_space_set_region_stream_4(t, h, o, v, c)			\
490 	bus_space_set_region_4((t), (h), (o), (v), (c))
491 #define	bus_space_set_region_stream_8(t, h, o, v, c)			\
492 	bus_space_set_region_8((t), (h), (o), (v), (c))
493 
494 /*
495  * Copy operations.
496  */
497 #define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)				\
498 	__bs_copy(1, t, h1, o1, h2, o2, c)
499 #define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)				\
500 	__bs_copy(2, t, h1, o1, h2, o2, c)
501 #define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)				\
502 	__bs_copy(4, t, h1, o1, h2, o2, c)
503 #define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)				\
504 	__bs_copy(8, t, h1, o1, h2, o2, c)
505 
506 /*
507  * Poke (checked write) operations.
508  */
509 #define	bus_space_poke_1(t, h, o, v)	__bs_poke(1, (t), (h), (o), (v))
510 #define	bus_space_poke_2(t, h, o, v)	__bs_poke(2, (t), (h), (o), (v))
511 #define	bus_space_poke_4(t, h, o, v)	__bs_poke(4, (t), (h), (o), (v))
512 #define	bus_space_poke_8(t, h, o, v)	__bs_poke(8, (t), (h), (o), (v))
513 
514 /*
515  * Peek (checked read) operations.
516  */
517 #define	bus_space_peek_1(t, h, o, vp)	__bs_peek(1, (t), (h), (o), (vp))
518 #define	bus_space_peek_2(t, h, o, vp)	__bs_peek(2, (t), (h), (o), (vp))
519 #define	bus_space_peek_4(t, h, o, vp)	__bs_peek(4, (t), (h), (o), (vp))
520 #define	bus_space_peek_8(t, h, o, vp)	__bs_peek(8, (t), (h), (o), (vp))
521 
522 #endif /* !SAN_NEEDS_INTERCEPTORS */
523 
524 #include <machine/bus_dma.h>
525 
526 #endif /* _MACHINE_BUS_H_ */
527 
528 #endif /* !__arm__ */
529