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