xref: /netbsd-src/sys/arch/next68k/include/bus_space.h (revision cef8759bd76c1b621f8eab8faa6f208faabc2e15)
1 /*	$NetBSD: bus_space.h,v 1.18 2020/04/02 15:30:27 msaitoh Exp $	*/
2 
3 /*-
4  * Copyright (c) 1996, 1997, 1998 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) 1997 Scott Reynolds.  All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  * 1. Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  * 2. Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in the
43  *    documentation and/or other materials provided with the distribution.
44  * 3. The name of the author may not be used to endorse or promote products
45  *    derived from this software without specific prior written permission
46  *
47  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
48  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
51  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
52  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
56  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57  */
58 
59 #ifndef _NEXT68K_BUS_SPACE_H_
60 #define	_NEXT68K_BUS_SPACE_H_
61 /*
62  * Addresses (in bus space).
63  */
64 typedef u_long bus_addr_t;
65 typedef u_long bus_size_t;
66 
67 #define PRIxBUSADDR	"lx"
68 #define PRIxBUSSIZE	"lx"
69 #define PRIuBUSSIZE	"lu"
70 
71 /*
72  * Access methods for bus resources and address space.
73  */
74 typedef volatile char *  bus_space_tag_t;
75 typedef u_long	bus_space_handle_t;
76 
77 #define PRIxBSH		"lx"
78 
79 /*
80  * Value for the next68k bus space tag, not to be used directly by MI code.
81  */
82 #define NEXT68K_INTIO_BUS_SPACE		((bus_space_tag_t)intiobase)
83 
84 /*
85  * Values for the next68k video bus space tags, not to be used directly
86  * by MI code.
87  */
88 #define NEXT68K_MONO_VIDEO_BUS_SPACE	((bus_space_tag_t)monobase)
89 #define NEXT68K_COLOR_VIDEO_BUS_SPACE	((bus_space_tag_t)colorbase)
90 
91 /*
92  * Mapping and unmapping operations.
93  */
94 #define	bus_space_map(t, a, s, f, hp)					\
95     ((((a)>=INTIOBASE)&&((a)+(s)<INTIOTOP)) ?				\
96      ((*(hp)=(bus_space_handle_t)((t)+((a)-INTIOBASE))),0) :            \
97      ((((a)>=MONOBASE)&&((a)+(s)<MONOTOP)) ?                          \
98       ((*(hp)=(bus_space_handle_t)((t)+((a)-MONOBASE))),0) :           \
99       ((((a)>=COLORBASE)&&((a)+(s)<COLORTOP)) ?                         \
100        ((*(hp)=(bus_space_handle_t)((t)+((a)-COLORBASE))),0) : (-1))))
101 
102 #define	bus_space_unmap(t, h, s)
103 
104 #define	bus_space_subregion(t, h, o, s, hp)				\
105      (*(hp)=(h)+(o))
106 
107 #define	BUS_SPACE_MAP_CACHEABLE		0x01
108 #define	BUS_SPACE_MAP_LINEAR		0x02
109 
110 /*
111  * Allocation and deallocation operations.
112  */
113 #define	bus_space_alloc(t, rs, re, s, a, b, f, ap, hp)  		\
114      (-1)
115 
116 #define	bus_space_free(t, h, s)
117 
118 /*
119  *	paddr_t bus_space_mmap(bus_space_tag_t t, bus_addr_t base,
120  *	    off_t offset, int prot, int flags);
121  *
122  * Mmap an area of bus space.
123  */
124 
125 #define bus_space_mmap(t, a, s, prot, flags)				\
126 	((((a)>=INTIOBASE)&&((a)+(s)<INTIOTOP)) ?			\
127 		m68k_btop((t)+((a)-INTIOBASE)) :			\
128 	 ((((a)>=MONOBASE)&&((a)+(s)<MONOTOP)) ?			\
129 		m68k_btop((t)+((a)-MONOBASE)) :				\
130 	  ((((a)>=COLORBASE)&&((a)+(s)<COLORTOP)) ?			\
131 		m68k_btop((t)+((a)-COLORBASE)) : (-1))))
132 
133 /*
134  *	u_intN_t bus_space_read_N(bus_space_tag_t tag,
135  *	    bus_space_handle_t bsh, bus_size_t offset);
136  *
137  * Read a 1, 2, 4, or 8 byte quantity from bus space
138  * described by tag/handle/offset.
139  */
140 
141 #define	bus_space_read_1(t, h, o)					\
142     ((void) t, (*(volatile u_int8_t *)((h) + (o))))
143 
144 #define	bus_space_read_2(t, h, o)					\
145     ((void) t, (*(volatile u_int16_t *)((h) + (o))))
146 
147 #define	bus_space_read_4(t, h, o)					\
148     ((void) t, (*(volatile u_int32_t *)((h) + (o))))
149 
150 #if 0	/* Cause a link error for bus_space_read_8 */
151 #define	bus_space_read_8(t, h, o)	!!! bus_space_read_8 unimplemented !!!
152 #endif
153 
154 /*
155  *	void bus_space_read_multi_N(bus_space_tag_t tag,
156  *	    bus_space_handle_t bsh, bus_size_t offset,
157  *	    u_intN_t *addr, size_t count);
158  *
159  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
160  * described by tag/handle/offset and copy into buffer provided.
161  */
162 
163 #define	bus_space_read_multi_1(t, h, o, a, c) do {			\
164 	(void) t;							\
165 	__asm volatile ("						\
166 		movl	%0,%%a0					;	\
167 		movl	%1,%%a1					;	\
168 		movl	%2,%%d0					;	\
169 	1:	movb	%%a0@,%%a1@+				;	\
170 		subql	#1,%%d0					;	\
171 		jne	1b"					:	\
172 								:	\
173 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
174 		    "a0","a1","d0");					\
175 } while (0);
176 
177 #define	bus_space_read_multi_2(t, h, o, a, c) do {			\
178 	(void) t;							\
179 	__asm volatile ("						\
180 		movl	%0,%%a0					;	\
181 		movl	%1,%%a1					;	\
182 		movl	%2,%%d0					;	\
183 	1:	movw	%%a0@,%%a1@+				;	\
184 		subql	#1,%%d0					;	\
185 		jne	1b"					:	\
186 								:	\
187 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
188 		    "a0","a1","d0");					\
189 } while (0);
190 
191 #define	bus_space_read_multi_4(t, h, o, a, c) do {			\
192 	(void) t;							\
193 	__asm volatile ("						\
194 		movl	%0,%%a0					;	\
195 		movl	%1,%%a1					;	\
196 		movl	%2,%%d0					;	\
197 	1:	movl	%%a0@,%%a1@+				;	\
198 		subql	#1,%%d0					;	\
199 		jne	1b"					:	\
200 								:	\
201 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
202 		    "a0","a1","d0");					\
203 } while (0);
204 
205 #if 0	/* Cause a link error for bus_space_read_multi_8 */
206 #define	bus_space_read_multi_8	!!! bus_space_read_multi_8 unimplemented !!!
207 #endif
208 
209 /*
210  *	void bus_space_read_region_N(bus_space_tag_t tag,
211  *	    bus_space_handle_t bsh, bus_size_t offset,
212  *	    u_intN_t *addr, size_t count);
213  *
214  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
215  * described by tag/handle and starting at `offset' and copy into
216  * buffer provided.
217  */
218 
219 #define	bus_space_read_region_1(t, h, o, a, c) do {			\
220 	(void) t;							\
221 	__asm volatile ("						\
222 		movl	%0,%%a0					;	\
223 		movl	%1,%%a1					;	\
224 		movl	%2,%%d0					;	\
225 	1:	movb	%%a0@+,%%a1@+				;	\
226 		subql	#1,%%d0					;	\
227 		jne	1b"					:	\
228 								:	\
229 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
230 		    "a0","a1","d0");					\
231 } while (0);
232 
233 #define	bus_space_read_region_2(t, h, o, a, c) do {			\
234 	(void) t;							\
235 	__asm volatile ("						\
236 		movl	%0,%%a0					;	\
237 		movl	%1,%%a1					;	\
238 		movl	%2,%%d0					;	\
239 	1:	movw	%%a0@+,%%a1@+				;	\
240 		subql	#1,%%d0					;	\
241 		jne	1b"					:	\
242 								:	\
243 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
244 		    "a0","a1","d0");					\
245 } while (0);
246 
247 #define	bus_space_read_region_4(t, h, o, a, c) do {			\
248 	(void) t;							\
249 	__asm volatile ("						\
250 		movl	%0,%%a0					;	\
251 		movl	%1,%%a1					;	\
252 		movl	%2,%%d0					;	\
253 	1:	movl	%%a0@+,%%a1@+				;	\
254 		subql	#1,%%d0					;	\
255 		jne	1b"					:	\
256 								:	\
257 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
258 		    "a0","a1","d0");					\
259 } while (0);
260 
261 #if 0	/* Cause a link error for bus_space_read_region_8 */
262 #define	bus_space_read_region_8	!!! bus_space_read_region_8 unimplemented !!!
263 #endif
264 
265 /*
266  *	void bus_space_write_N(bus_space_tag_t tag,
267  *	    bus_space_handle_t bsh, bus_size_t offset,
268  *	    u_intN_t value);
269  *
270  * Write the 1, 2, 4, or 8 byte value `value' to bus space
271  * described by tag/handle/offset.
272  */
273 
274 #define	bus_space_write_1(t, h, o, v)					\
275     ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v))))
276 
277 #define	bus_space_write_2(t, h, o, v)					\
278     ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v))))
279 
280 #define	bus_space_write_4(t, h, o, v)					\
281     ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v))))
282 
283 #if 0	/* Cause a link error for bus_space_write_8 */
284 #define	bus_space_write_8	!!! bus_space_write_8 not implemented !!!
285 #endif
286 
287 /*
288  *	void bus_space_write_multi_N(bus_space_tag_t tag,
289  *	    bus_space_handle_t bsh, bus_size_t offset,
290  *	    const u_intN_t *addr, size_t count);
291  *
292  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
293  * provided to bus space described by tag/handle/offset.
294  */
295 
296 #define	bus_space_write_multi_1(t, h, o, a, c) do {			\
297 	(void) t;							\
298 	__asm volatile ("						\
299 		movl	%0,%%a0					;	\
300 		movl	%1,%%a1					;	\
301 		movl	%2,%%d0					;	\
302 	1:	movb	%%a1@+,%%a0@				;	\
303 		subql	#1,%%d0					;	\
304 		jne	1b"					:	\
305 								:	\
306 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
307 		    "a0","a1","d0");					\
308 } while (0);
309 
310 #define	bus_space_write_multi_2(t, h, o, a, c) do {			\
311 	(void) t;							\
312 	__asm volatile ("						\
313 		movl	%0,%%a0					;	\
314 		movl	%1,%%a1					;	\
315 		movl	%2,%%d0					;	\
316 	1:	movw	%%a1@+,%%a0@				;	\
317 		subql	#1,%%d0					;	\
318 		jne	1b"					:	\
319 								:	\
320 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
321 		    "a0","a1","d0");					\
322 } while (0);
323 
324 #define	bus_space_write_multi_4(t, h, o, a, c) do {			\
325 	(void) t;							\
326 	__asm volatile ("						\
327 		movl	%0,%%a0					;	\
328 		movl	%1,%%a1					;	\
329 		movl	%2,%%d0					;	\
330 	1:	movl	%%a1@+,%%a0@				;	\
331 		subql	#1,%%d0					;	\
332 		jne	1b"					:	\
333 								:	\
334 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
335 		    "a0","a1","d0");					\
336 } while (0);
337 
338 #if 0	/* Cause a link error for bus_space_write_8 */
339 #define	bus_space_write_multi_8(t, h, o, a, c)				\
340 			!!! bus_space_write_multi_8 unimplemented !!!
341 #endif
342 
343 /*
344  *	void bus_space_write_region_N(bus_space_tag_t tag,
345  *	    bus_space_handle_t bsh, bus_size_t offset,
346  *	    const u_intN_t *addr, size_t count);
347  *
348  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
349  * to bus space described by tag/handle starting at `offset'.
350  */
351 
352 #define	bus_space_write_region_1(t, h, o, a, c) do {			\
353 	(void) t;							\
354 	__asm volatile ("						\
355 		movl	%0,%%a0					;	\
356 		movl	%1,%%a1					;	\
357 		movl	%2,%%d0					;	\
358 	1:	movb	%%a1@+,%%a0@+				;	\
359 		subql	#1,%%d0					;	\
360 		jne	1b"					:	\
361 								:	\
362 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
363 		    "a0","a1","d0");					\
364 } while (0);
365 
366 #define	bus_space_write_region_2(t, h, o, a, c) do {			\
367 	(void) t;							\
368 	__asm volatile ("						\
369 		movl	%0,%%a0					;	\
370 		movl	%1,%%a1					;	\
371 		movl	%2,%%d0					;	\
372 	1:	movw	%%a1@+,%%a0@+				;	\
373 		subql	#1,%%d0					;	\
374 		jne	1b"					:	\
375 								:	\
376 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
377 		    "a0","a1","d0");					\
378 } while (0);
379 
380 #define	bus_space_write_region_4(t, h, o, a, c) do {			\
381 	(void) t;							\
382 	__asm volatile ("						\
383 		movl	%0,%%a0					;	\
384 		movl	%1,%%a1					;	\
385 		movl	%2,%%d0					;	\
386 	1:	movl	%%a1@+,%%a0@+				;	\
387 		subql	#1,%%d0					;	\
388 		jne	1b"					:	\
389 								:	\
390 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
391 		    "a0","a1","d0");					\
392 } while (0);
393 
394 #if 0	/* Cause a link error for bus_space_write_region_8 */
395 #define	bus_space_write_region_8					\
396 			!!! bus_space_write_region_8 unimplemented !!!
397 #endif
398 
399 /*
400  *	void bus_space_set_multi_N(bus_space_tag_t tag,
401  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
402  *	    size_t count);
403  *
404  * Write the 1, 2, 4, or 8 byte value `val' to bus space described
405  * by tag/handle/offset `count' times.
406  */
407 
408 #define	bus_space_set_multi_1(t, h, o, val, c) do {			\
409 	(void) t;							\
410 	__asm volatile ("						\
411 		movl	%0,%%a0					;	\
412 		movl	%1,%%d1					;	\
413 		movl	%2,%%d0					;	\
414 	1:	movb	%%d1,%%a0@				;	\
415 		subql	#1,%%d0					;	\
416 		jne	1b"					:	\
417 								:	\
418 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
419 		    "a0","d0","d1");					\
420 } while (0);
421 
422 #define	bus_space_set_multi_2(t, h, o, val, c) do {			\
423 	(void) t;							\
424 	__asm volatile ("						\
425 		movl	%0,%%a0					;	\
426 		movl	%1,%%d1					;	\
427 		movl	%2,%%d0					;	\
428 	1:	movw	%%d1,%%a0@				;	\
429 		subql	#1,%%d0					;	\
430 		jne	1b"					:	\
431 								:	\
432 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
433 		    "a0","d0","d1");					\
434 } while (0);
435 
436 #define	bus_space_set_multi_4(t, h, o, val, c) do {			\
437 	(void) t;							\
438 	__asm volatile ("						\
439 		movl	%0,%%a0					;	\
440 		movl	%1,%%d1					;	\
441 		movl	%2,%%d0					;	\
442 	1:	movl	%%d1,%%a0@				;	\
443 		subql	#1,%%d0					;	\
444 		jne	1b"					:	\
445 								:	\
446 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
447 		    "a0","d0","d1");					\
448 } while (0);
449 
450 #if 0	/* Cause a link error for bus_space_set_multi_8 */
451 #define	bus_space_set_multi_8						\
452 			!!! bus_space_set_multi_8 unimplemented !!!
453 #endif
454 
455 /*
456  *	void bus_space_set_region_N(bus_space_tag_t tag,
457  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
458  *	    size_t count);
459  *
460  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
461  * by tag/handle starting at `offset'.
462  */
463 
464 #define	bus_space_set_region_1(t, h, o, val, c) do {			\
465 	(void) t;							\
466 	__asm volatile ("						\
467 		movl	%0,%%a0					;	\
468 		movl	%1,%%d1					;	\
469 		movl	%2,%%d0					;	\
470 	1:	movb	%%d1,%%a0@+				;	\
471 		subql	#1,%%d0					;	\
472 		jne	1b"					:	\
473 								:	\
474 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
475 		    "a0","d0","d1");					\
476 } while (0);
477 
478 #define	bus_space_set_region_2(t, h, o, val, c) do {			\
479 	(void) t;							\
480 	__asm volatile ("						\
481 		movl	%0,%%a0					;	\
482 		movl	%1,%%d1					;	\
483 		movl	%2,%%d0					;	\
484 	1:	movw	%%d1,%%a0@+				;	\
485 		subql	#1,%%d0					;	\
486 		jne	1b"					:	\
487 								:	\
488 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
489 		    "a0","d0","d1");					\
490 } while (0);
491 
492 #define	bus_space_set_region_4(t, h, o, val, c) do {			\
493 	(void) t;							\
494 	__asm volatile ("						\
495 		movl	%0,%%a0					;	\
496 		movl	%1,%%d1					;	\
497 		movl	%2,%%d0					;	\
498 	1:	movl	%%d1,%%a0@+				;	\
499 		subql	#1,%%d0					;	\
500 		jne	1b"					:	\
501 								:	\
502 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
503 		    "a0","d0","d1");					\
504 } while (0);
505 
506 #if 0	/* Cause a link error for bus_space_set_region_8 */
507 #define	bus_space_set_region_8						\
508 			!!! bus_space_set_region_8 unimplemented !!!
509 #endif
510 
511 /*
512  *	void bus_space_copy_N(bus_space_tag_t tag,
513  *	    bus_space_handle_t bsh1, bus_size_t off1,
514  *	    bus_space_handle_t bsh2, bus_size_t off2,
515  *	    size_t count);
516  *
517  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
518  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
519  */
520 
521 #define	__NEXT68K_copy_region_N(BYTES)					\
522 static __inline void __CONCAT(bus_space_copy_region_,BYTES)		\
523 	(bus_space_tag_t,						\
524 	 bus_space_handle_t, bus_size_t,				\
525 	 bus_space_handle_t, bus_size_t,				\
526 	 bus_size_t);							\
527 									\
528 static __inline void							\
529 __CONCAT(bus_space_copy_region_,BYTES)(					\
530 	bus_space_tag_t t,						\
531 	bus_space_handle_t h1,						\
532 	bus_size_t o1,							\
533 	bus_space_handle_t h2,						\
534 	bus_size_t o2,							\
535 	bus_size_t c)							\
536 {									\
537 	bus_size_t o;							\
538 									\
539 	if ((h1 + o1) >= (h2 + o2)) {					\
540 		/* src after dest: copy forward */			\
541 		for (o = 0; c != 0; c--, o += BYTES)			\
542 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
543 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
544 	} else {							\
545 		/* dest after src: copy backwards */			\
546 		for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES)	\
547 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
548 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
549 	}								\
550 }
551 __NEXT68K_copy_region_N(1)
552 __NEXT68K_copy_region_N(2)
553 __NEXT68K_copy_region_N(4)
554 #if 0	/* Cause a link error for bus_space_copy_8 */
555 #define	bus_space_copy_8						\
556 			!!! bus_space_copy_8 unimplemented !!!
557 #endif
558 
559 #undef __NEXT68K_copy_region_N
560 
561 /*
562  * Bus read/write barrier methods.
563  *
564  *	void bus_space_barrier(bus_space_tag_t tag,
565  *	    bus_space_handle_t bsh, bus_size_t offset,
566  *	    bus_size_t len, int flags);
567  *
568  * Note: the 680x0 does not currently require barriers, but we must
569  * provide the flags to MI code.
570  */
571 #define	bus_space_barrier(t, h, o, l, f)	\
572 	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
573 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */
574 #define	BUS_SPACE_BARRIER_WRITE	0x02		/* force write barrier */
575 
576 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
577 
578 #endif /* _NEXT68K_BUS_SPACE_H_ */
579