xref: /netbsd/sys/arch/news68k/include/bus.h (revision 6550d01e)
1 /*	$NetBSD: bus.h,v 1.8 2008/04/28 20:23:30 martin 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 /* bus_space(9) functions for news68k. Just taken from hp300. */
60 
61 #ifndef _NEWS68K_BUS_H_
62 #define _NEWS68K_BUS_H_
63 
64 /*
65  * Values for the news68k bus space tag, not to be used directly by MI code.
66  */
67 #define	NEWS68K_BUS_SPACE_INTIO	0	/* space is intio space */
68 #define	NEWS68K_BUS_SPACE_EIO	1	/* space is eio space */
69 
70 /*
71  * Bus address and size types
72  */
73 typedef u_long bus_addr_t;
74 typedef u_long bus_size_t;
75 
76 /*
77  * Access methods for bus resources and address space.
78  */
79 typedef int	bus_space_tag_t;
80 typedef u_long	bus_space_handle_t;
81 
82 /*
83  *	int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
84  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
85  *
86  * Map a region of bus space.
87  */
88 
89 #define	BUS_SPACE_MAP_CACHEABLE		0x01
90 #define	BUS_SPACE_MAP_LINEAR		0x02
91 #define	BUS_SPACE_MAP_PREFETCHABLE	0x04
92 
93 int	bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t,
94 	    int, bus_space_handle_t *);
95 
96 /*
97  *	void bus_space_unmap(bus_space_tag_t t,
98  *	    bus_space_handle_t bsh, bus_size_t size);
99  *
100  * Unmap a region of bus space.
101  */
102 
103 void	bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
104 
105 /*
106  *	int bus_space_subregion(bus_space_tag_t t,
107  *	    bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
108  *	    bus_space_handle_t *nbshp);
109  *
110  * Get a new handle for a subregion of an already-mapped area of bus space.
111  */
112 
113 int	bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
114 	    bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp);
115 
116 /*
117  *	int bus_space_alloc(bus_space_tag_t t, bus_addr_t, rstart,
118  *	    bus_addr_t rend, bus_size_t size, bus_size_t align,
119  *	    bus_size_t boundary, int flags, bus_addr_t *addrp,
120  *	    bus_space_handle_t *bshp);
121  *
122  * Allocate a region of bus space.
123  */
124 
125 int	bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
126 	    bus_addr_t rend, bus_size_t size, bus_size_t align,
127 	    bus_size_t boundary, int cacheable, bus_addr_t *addrp,
128 	    bus_space_handle_t *bshp);
129 
130 /*
131  *	int bus_space_free(bus_space_tag_t t,
132  *	    bus_space_handle_t bsh, bus_size_t size);
133  *
134  * Free a region of bus space.
135  */
136 
137 void	bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
138 	    bus_size_t size);
139 
140 /*
141  *	int news68k_bus_space_probe(bus_space_tag_t t,
142  *	    bus_space_handle_t bsh, bus_size_t offset, int sz);
143  *
144  * Probe the bus at t/bsh/offset, using sz as the size of the load.
145  *
146  * This is a machine-dependent extension, and is not to be used by
147  * machine-independent code.
148  */
149 
150 int	news68k_bus_space_probe(bus_space_tag_t t,
151 	    bus_space_handle_t bsh, bus_size_t offset, int sz);
152 
153 /*
154  *	uintN_t bus_space_read_N(bus_space_tag_t tag,
155  *	    bus_space_handle_t bsh, bus_size_t offset);
156  *
157  * Read a 1, 2, 4, or 8 byte quantity from bus space
158  * described by tag/handle/offset.
159  */
160 
161 #define	bus_space_read_1(t, h, o)					\
162     ((void) t, (*(volatile uint8_t *)((h) + (o))))
163 
164 #define	bus_space_read_2(t, h, o)					\
165     ((void) t, (*(volatile uint16_t *)((h) + (o))))
166 
167 #define	bus_space_read_4(t, h, o)					\
168     ((void) t, (*(volatile uint32_t *)((h) + (o))))
169 
170 #if 0	/* Cause a link error for bus_space_read_8 */
171 #define	bus_space_read_8(t, h, o)	!!! bus_space_read_8 unimplemented !!!
172 #endif
173 
174 /*
175  *	void bus_space_read_multi_N(bus_space_tag_t tag,
176  *	    bus_space_handle_t bsh, bus_size_t offset,
177  *	    uintN_t *addr, size_t count);
178  *
179  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
180  * described by tag/handle/offset and copy into buffer provided.
181  */
182 
183 #define	bus_space_read_multi_1(t, h, o, a, c) do {			\
184 	(void) t;							\
185 	__asm volatile ("						\
186 		movl	%0,%%a0					;	\
187 		movl	%1,%%a1					;	\
188 		movl	%2,%%d0					;	\
189 	1:	movb	%%a0@,%%a1@+				;	\
190 		subql	#1,%%d0					;	\
191 		jne	1b"					:	\
192 								:	\
193 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
194 		    "%a0","%a1","%d0");					\
195 } while (0)
196 
197 #define	bus_space_read_multi_2(t, h, o, a, c) do {			\
198 	(void) t;							\
199 	__asm volatile ("						\
200 		movl	%0,%%a0					;	\
201 		movl	%1,%%a1					;	\
202 		movl	%2,%%d0					;	\
203 	1:	movw	%%a0@,%%a1@+				;	\
204 		subql	#1,%%d0					;	\
205 		jne	1b"					:	\
206 								:	\
207 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
208 		    "%a0","%a1","%d0");					\
209 } while (0)
210 
211 #define	bus_space_read_multi_4(t, h, o, a, c) do {			\
212 	(void) t;							\
213 	__asm volatile ("						\
214 		movl	%0,%%a0					;	\
215 		movl	%1,%%a1					;	\
216 		movl	%2,%%d0					;	\
217 	1:	movl	%%a0@,%%a1@+				;	\
218 		subql	#1,%%d0					;	\
219 		jne	1b"					:	\
220 								:	\
221 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
222 		    "%a0","%a1","%d0");					\
223 } while (0)
224 
225 #if 0	/* Cause a link error for bus_space_read_multi_8 */
226 #define	bus_space_read_multi_8	!!! bus_space_read_multi_8 unimplemented !!!
227 #endif
228 
229 /*
230  *	void bus_space_read_region_N(bus_space_tag_t tag,
231  *	    bus_space_handle_t bsh, bus_size_t offset,
232  *	    uintN_t *addr, size_t count);
233  *
234  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
235  * described by tag/handle and starting at `offset' and copy into
236  * buffer provided.
237  */
238 
239 #define	bus_space_read_region_1(t, h, o, a, c) do {			\
240 	(void) t;							\
241 	__asm volatile ("						\
242 		movl	%0,%%a0					;	\
243 		movl	%1,%%a1					;	\
244 		movl	%2,%%d0					;	\
245 	1:	movb	%%a0@+,%%a1@+				;	\
246 		subql	#1,%%d0					;	\
247 		jne	1b"					:	\
248 								:	\
249 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
250 		    "%a0","%a1","%d0");					\
251 } while (0)
252 
253 #define	bus_space_read_region_2(t, h, o, a, c) do {			\
254 	(void) t;							\
255 	__asm volatile ("						\
256 		movl	%0,%%a0					;	\
257 		movl	%1,%%a1					;	\
258 		movl	%2,%%d0					;	\
259 	1:	movw	%%a0@+,%%a1@+				;	\
260 		subql	#1,%%d0					;	\
261 		jne	1b"					:	\
262 								:	\
263 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
264 		    "%a0","%a1","%d0");					\
265 } while (0)
266 
267 #define	bus_space_read_region_4(t, h, o, a, c) do {			\
268 	(void) t;							\
269 	__asm volatile ("						\
270 		movl	%0,%%a0					;	\
271 		movl	%1,%%a1					;	\
272 		movl	%2,%%d0					;	\
273 	1:	movl	%%a0@+,%%a1@+				;	\
274 		subql	#1,%%d0					;	\
275 		jne	1b"					:	\
276 								:	\
277 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
278 		    "%a0","%a1","%d0");					\
279 } while (0)
280 
281 #if 0	/* Cause a link error for bus_space_read_region_8 */
282 #define	bus_space_read_region_8	!!! bus_space_read_region_8 unimplemented !!!
283 #endif
284 
285 /*
286  *	void bus_space_write_N(bus_space_tag_t tag,
287  *	    bus_space_handle_t bsh, bus_size_t offset,
288  *	    uintN_t value);
289  *
290  * Write the 1, 2, 4, or 8 byte value `value' to bus space
291  * described by tag/handle/offset.
292  */
293 
294 #define	bus_space_write_1(t, h, o, v)					\
295     ((void) t, ((void)(*(volatile uint8_t *)((h) + (o)) = (v))))
296 
297 #define	bus_space_write_2(t, h, o, v)					\
298     ((void) t, ((void)(*(volatile uint16_t *)((h) + (o)) = (v))))
299 
300 #define	bus_space_write_4(t, h, o, v)					\
301     ((void) t, ((void)(*(volatile uint32_t *)((h) + (o)) = (v))))
302 
303 #if 0	/* Cause a link error for bus_space_write_8 */
304 #define	bus_space_write_8	!!! bus_space_write_8 not implemented !!!
305 #endif
306 
307 /*
308  *	void bus_space_write_multi_N(bus_space_tag_t tag,
309  *	    bus_space_handle_t bsh, bus_size_t offset,
310  *	    const uintN_t *addr, size_t count);
311  *
312  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
313  * provided to bus space described by tag/handle/offset.
314  */
315 
316 #define	bus_space_write_multi_1(t, h, o, a, c) do {			\
317 	(void) t;							\
318 	__asm volatile ("						\
319 		movl	%0,%%a0					;	\
320 		movl	%1,%%a1					;	\
321 		movl	%2,%%d0					;	\
322 	1:	movb	%%a1@+,%%a0@				;	\
323 		subql	#1,%%d0					;	\
324 		jne	1b"					:	\
325 								:	\
326 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
327 		    "%a0","%a1","%d0");					\
328 } while (0)
329 
330 #define	bus_space_write_multi_2(t, h, o, a, c) do {			\
331 	(void) t;							\
332 	__asm volatile ("						\
333 		movl	%0,%%a0					;	\
334 		movl	%1,%%a1					;	\
335 		movl	%2,%%d0					;	\
336 	1:	movw	%%a1@+,%%a0@				;	\
337 		subql	#1,%%d0					;	\
338 		jne	1b"					:	\
339 								:	\
340 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
341 		    "%a0","%a1","%d0");					\
342 } while (0)
343 
344 #define	bus_space_write_multi_4(t, h, o, a, c) do {			\
345 	(void) t;							\
346 	__asm volatile ("						\
347 		movl	%0,%%a0					;	\
348 		movl	%1,%%a1					;	\
349 		movl	%2,%%d0					;	\
350 	1:	movl	%%a1@+,%%a0@				;	\
351 		subql	#1,%%d0					;	\
352 		jne	1b"					:	\
353 								:	\
354 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
355 		    "%a0","%a1","%d0");					\
356 } while (0)
357 
358 #if 0	/* Cause a link error for bus_space_write_8 */
359 #define	bus_space_write_multi_8(t, h, o, a, c)				\
360 			!!! bus_space_write_multi_8 unimplimented !!!
361 #endif
362 
363 /*
364  *	void bus_space_write_region_N(bus_space_tag_t tag,
365  *	    bus_space_handle_t bsh, bus_size_t offset,
366  *	    const uintN_t *addr, size_t count);
367  *
368  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
369  * to bus space described by tag/handle starting at `offset'.
370  */
371 
372 #define	bus_space_write_region_1(t, h, o, a, c) do {			\
373 	(void) t;							\
374 	__asm volatile ("						\
375 		movl	%0,%%a0					;	\
376 		movl	%1,%%a1					;	\
377 		movl	%2,%%d0					;	\
378 	1:	movb	%%a1@+,%%a0@+				;	\
379 		subql	#1,%%d0					;	\
380 		jne	1b"					:	\
381 								:	\
382 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
383 		    "%a0","%a1","%d0");					\
384 } while (0)
385 
386 #define	bus_space_write_region_2(t, h, o, a, c) do {			\
387 	(void) t;							\
388 	__asm volatile ("						\
389 		movl	%0,%%a0					;	\
390 		movl	%1,%%a1					;	\
391 		movl	%2,%%d0					;	\
392 	1:	movw	%%a1@+,%%a0@+				;	\
393 		subql	#1,%%d0					;	\
394 		jne	1b"					:	\
395 								:	\
396 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
397 		    "%a0","%a1","%d0");					\
398 } while (0)
399 
400 #define	bus_space_write_region_4(t, h, o, a, c) do {			\
401 	(void) t;							\
402 	__asm volatile ("						\
403 		movl	%0,%%a0					;	\
404 		movl	%1,%%a1					;	\
405 		movl	%2,%%d0					;	\
406 	1:	movl	%%a1@+,%%a0@+				;	\
407 		subql	#1,%%d0					;	\
408 		jne	1b"					:	\
409 								:	\
410 		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
411 		    "%a0","%a1","%d0");					\
412 } while (0)
413 
414 #if 0	/* Cause a link error for bus_space_write_region_8 */
415 #define	bus_space_write_region_8					\
416 			!!! bus_space_write_region_8 unimplemented !!!
417 #endif
418 
419 /*
420  *	void bus_space_set_multi_N(bus_space_tag_t tag,
421  *	    bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
422  *	    size_t count);
423  *
424  * Write the 1, 2, 4, or 8 byte value `val' to bus space described
425  * by tag/handle/offset `count' times.
426  */
427 
428 #define	bus_space_set_multi_1(t, h, o, val, c) do {			\
429 	(void) t;							\
430 	__asm volatile ("						\
431 		movl	%0,%%a0					;	\
432 		movl	%1,%%d1					;	\
433 		movl	%2,%%d0					;	\
434 	1:	movb	%%d1,%%a0@				;	\
435 		subql	#1,%%d0					;	\
436 		jne	1b"					:	\
437 								:	\
438 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
439 		    "%a0","%d0","%d1");					\
440 } while (0)
441 
442 #define	bus_space_set_multi_2(t, h, o, val, c) do {			\
443 	(void) t;							\
444 	__asm volatile ("						\
445 		movl	%0,%%a0					;	\
446 		movl	%1,%%d1					;	\
447 		movl	%2,%%d0					;	\
448 	1:	movw	%%d1,%%a0@				;	\
449 		subql	#1,%%d0					;	\
450 		jne	1b"					:	\
451 								:	\
452 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
453 		    "%a0","%d0","%d1");					\
454 } while (0)
455 
456 #define	bus_space_set_multi_4(t, h, o, val, c) do {			\
457 	(void) t;							\
458 	__asm volatile ("						\
459 		movl	%0,%%a0					;	\
460 		movl	%1,%%d1					;	\
461 		movl	%2,%%d0					;	\
462 	1:	movl	%%d1,%%a0@				;	\
463 		subql	#1,%%d0					;	\
464 		jne	1b"					:	\
465 								:	\
466 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
467 		    "%a0","%d0","%d1");					\
468 } while (0)
469 
470 #if 0	/* Cause a link error for bus_space_set_multi_8 */
471 #define	bus_space_set_multi_8						\
472 			!!! bus_space_set_multi_8 unimplemented !!!
473 #endif
474 
475 /*
476  *	void bus_space_set_region_N(bus_space_tag_t tag,
477  *	    bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
478  *	    size_t count);
479  *
480  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
481  * by tag/handle starting at `offset'.
482  */
483 
484 #define	bus_space_set_region_1(t, h, o, val, c) do {			\
485 	(void) t;							\
486 	__asm volatile ("						\
487 		movl	%0,%%a0					;	\
488 		movl	%1,%%d1					;	\
489 		movl	%2,%%d0					;	\
490 	1:	movb	%%d1,%%a0@+				;	\
491 		subql	#1,%%d0					;	\
492 		jne	1b"					:	\
493 								:	\
494 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
495 		    "%a0","%d0","%d1");					\
496 } while (0)
497 
498 #define	bus_space_set_region_2(t, h, o, val, c) do {			\
499 	(void) t;							\
500 	__asm volatile ("						\
501 		movl	%0,%%a0					;	\
502 		movl	%1,%%d1					;	\
503 		movl	%2,%%d0					;	\
504 	1:	movw	%%d1,%%a0@+				;	\
505 		subql	#1,%%d0					;	\
506 		jne	1b"					:	\
507 								:	\
508 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
509 		    "%a0","%d0","%d1");					\
510 } while (0)
511 
512 #define	bus_space_set_region_4(t, h, o, val, c) do {			\
513 	(void) t;							\
514 	__asm volatile ("						\
515 		movl	%0,%%a0					;	\
516 		movl	%1,%%d1					;	\
517 		movl	%2,%%d0					;	\
518 	1:	movl	%%d1,%%a0@+				;	\
519 		subql	#1,%%d0					;	\
520 		jne	1b"					:	\
521 								:	\
522 		    "r" ((h) + (o)), "g" (val), "g" (c)		:	\
523 		    "%a0","%d0","%d1");					\
524 } while (0)
525 
526 #if 0	/* Cause a link error for bus_space_set_region_8 */
527 #define	bus_space_set_region_8						\
528 			!!! bus_space_set_region_8 unimplemented !!!
529 #endif
530 
531 /*
532  *	void bus_space_copy_region_N(bus_space_tag_t tag,
533  *	    bus_space_handle_t bsh1, bus_size_t off1,
534  *	    bus_space_handle_t bsh2, bus_size_t off2,
535  *	    bus_size_t count);
536  *
537  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
538  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
539  */
540 
541 #define	__NEWS68K_copy_region_N(BYTES)					\
542 static __inline void __CONCAT(bus_space_copy_region_,BYTES)		\
543 	(bus_space_tag_t,						\
544 	 bus_space_handle_t bsh1, bus_size_t off1,			\
545 	 bus_space_handle_t bsh2, bus_size_t off2,			\
546 	 bus_size_t count);						\
547 									\
548 static __inline void							\
549 __CONCAT(bus_space_copy_region_,BYTES)(bus_space_tag_t t,		\
550     bus_space_handle_t h1, bus_space_handle_t h2,			\
551     bus_size_t o1, bus_size_t o2, bus_size_t c)				\
552 {									\
553 	bus_size_t o;							\
554 									\
555 	if ((h1 + o1) >= (h2 + o2)) {					\
556 		/* src after dest: copy forward */			\
557 		for (o = 0; c != 0; c--, o += BYTES)			\
558 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
559 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
560 	} else {							\
561 		/* dest after src: copy backwards */			\
562 		for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES)	\
563 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
564 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
565 	}								\
566 }
567 __NEWS68K_copy_region_N(1)
568 __NEWS68K_copy_region_N(2)
569 __NEWS68K_copy_region_N(4)
570 #if 0	/* Cause a link error for bus_space_copy_region_8 */
571 #define	bus_space_copy_region_8						\
572 			!!! bus_space_copy_region_8 unimplemented !!!
573 #endif
574 
575 #undef __NEWS68K_copy_region_N
576 
577 /*
578  * Bus read/write barrier methods.
579  *
580  *	void bus_space_barrier(bus_space_tag_t tag,
581  *	    bus_space_handle_t bsh, bus_size_t offset,
582  *	    bus_size_t len, int flags);
583  *
584  * Note: the 680x0 does not currently require barriers, but we must
585  * provide the flags to MI code.
586  */
587 #define	bus_space_barrier(t, h, o, l, f)	\
588 	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
589 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */
590 #define	BUS_SPACE_BARRIER_WRITE	0x02		/* force write barrier */
591 
592 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
593 
594 #endif /* _NEWS68K_BUS_H_ */
595