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