Home | History | Annotate | Line # | Download | only in include
bus.h revision 1.20.16.1
      1 /*	$NetBSD: bus.h,v 1.20.16.1 2006/09/12 10:56:46 tron 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 _MAC68K_BUS_H_
     67 #define _MAC68K_BUS_H_
     68 
     69 /*
     70  * Value for the mac68k bus space tag, not to be used directly by MI code.
     71  */
     72 #define MAC68K_BUS_SPACE_MEM	0	/* space is mem space */
     73 
     74 #define __BUS_SPACE_HAS_STREAM_METHODS 1
     75 
     76 /*
     77  * Bus address and size types
     78  */
     79 typedef u_long bus_addr_t;
     80 typedef u_long bus_size_t;
     81 
     82 /*
     83  * Access methods for bus resources and address space.
     84  */
     85 #define BSH_T	struct bus_space_handle_s
     86 typedef int	bus_space_tag_t;
     87 typedef struct bus_space_handle_s {
     88 	u_long	base;
     89 	int	swapped;
     90 	int	stride;
     91 
     92 	u_int8_t	(*bsr1) __P((bus_space_tag_t t,
     93 					BSH_T *h, bus_size_t o));
     94 	u_int16_t	(*bsr2) __P((bus_space_tag_t t,
     95 					BSH_T *h, bus_size_t o));
     96 	u_int32_t	(*bsr4) __P((bus_space_tag_t t,
     97 					BSH_T *h, bus_size_t o));
     98 	u_int8_t	(*bsrs1) __P((bus_space_tag_t t,
     99 					BSH_T *h, bus_size_t o));
    100 	u_int16_t	(*bsrs2) __P((bus_space_tag_t t,
    101 					BSH_T *h, bus_size_t o));
    102 	u_int32_t	(*bsrs4) __P((bus_space_tag_t t,
    103 					BSH_T *h, bus_size_t o));
    104 	void		(*bsrm1) __P((bus_space_tag_t t, BSH_T *h,
    105 				   bus_size_t o, u_int8_t *a, size_t c));
    106 	void		(*bsrm2) __P((bus_space_tag_t t, BSH_T *h,
    107 				   bus_size_t o, u_int16_t *a, size_t c));
    108 	void		(*bsrm4) __P((bus_space_tag_t t, BSH_T *h,
    109 				   bus_size_t o, u_int32_t *a, size_t c));
    110 	void		(*bsrms1) __P((bus_space_tag_t t, BSH_T *h,
    111 				   bus_size_t o, u_int8_t *a, size_t c));
    112 	void		(*bsrms2) __P((bus_space_tag_t t, BSH_T *h,
    113 				   bus_size_t o, u_int16_t *a, size_t c));
    114 	void		(*bsrms4) __P((bus_space_tag_t t, BSH_T *h,
    115 				   bus_size_t o, u_int32_t *a, size_t c));
    116 	void		(*bsrr1) __P((bus_space_tag_t t, BSH_T *h,
    117 				   bus_size_t o, u_int8_t *a, size_t c));
    118 	void		(*bsrr2) __P((bus_space_tag_t t, BSH_T *h,
    119 				   bus_size_t o, u_int16_t *a, size_t c));
    120 	void		(*bsrr4) __P((bus_space_tag_t t, BSH_T *h,
    121 				   bus_size_t o, u_int32_t *a, size_t c));
    122 	void		(*bsrrs1) __P((bus_space_tag_t t, BSH_T *h,
    123 				   bus_size_t o, u_int8_t *a, size_t c));
    124 	void		(*bsrrs2) __P((bus_space_tag_t t, BSH_T *h,
    125 				   bus_size_t o, u_int16_t *a, size_t c));
    126 	void		(*bsrrs4) __P((bus_space_tag_t t, BSH_T *h,
    127 				   bus_size_t o, u_int32_t *a, size_t c));
    128 	void		(*bsw1) __P((bus_space_tag_t t, BSH_T *h,
    129 				  bus_size_t o, u_int8_t v));
    130 	void		(*bsw2) __P((bus_space_tag_t t, BSH_T *h,
    131 				  bus_size_t o, u_int16_t v));
    132 	void		(*bsw4) __P((bus_space_tag_t t, BSH_T *h,
    133 				  bus_size_t o, u_int32_t v));
    134 	void		(*bsws1) __P((bus_space_tag_t t, BSH_T *h,
    135 				  bus_size_t o, u_int8_t v));
    136 	void		(*bsws2) __P((bus_space_tag_t t, BSH_T *h,
    137 				  bus_size_t o, u_int16_t v));
    138 	void		(*bsws4) __P((bus_space_tag_t t, BSH_T *h,
    139 				  bus_size_t o, u_int32_t v));
    140 	void		(*bswm1) __P((bus_space_tag_t t, BSH_T *h,
    141 				   bus_size_t o, const u_int8_t *a, size_t c));
    142 	void		(*bswm2) __P((bus_space_tag_t t, BSH_T *h,
    143 				   bus_size_t o, const u_int16_t *a, size_t c));
    144 	void		(*bswm4) __P((bus_space_tag_t t, BSH_T *h,
    145 				   bus_size_t o, const u_int32_t *a, size_t c));
    146 	void		(*bswms1) __P((bus_space_tag_t t, BSH_T *h,
    147 				   bus_size_t o, const u_int8_t *a, size_t c));
    148 	void		(*bswms2) __P((bus_space_tag_t t, BSH_T *h,
    149 				   bus_size_t o, const u_int16_t *a, size_t c));
    150 	void		(*bswms4) __P((bus_space_tag_t t, BSH_T *h,
    151 				   bus_size_t o, const u_int32_t *a, size_t c));
    152 	void		(*bswr1) __P((bus_space_tag_t t, BSH_T *h,
    153 				   bus_size_t o, const u_int8_t *a, size_t c));
    154 	void		(*bswr2) __P((bus_space_tag_t t, BSH_T *h,
    155 				   bus_size_t o, const u_int16_t *a, size_t c));
    156 	void		(*bswr4) __P((bus_space_tag_t t, BSH_T *h,
    157 				   bus_size_t o, const u_int32_t *a, size_t c));
    158 	void		(*bswrs1) __P((bus_space_tag_t t, BSH_T *h,
    159 				   bus_size_t o, const u_int8_t *a, size_t c));
    160 	void		(*bswrs2) __P((bus_space_tag_t t, BSH_T *h,
    161 				   bus_size_t o, const u_int16_t *a, size_t c));
    162 	void		(*bswrs4) __P((bus_space_tag_t t, BSH_T *h,
    163 				   bus_size_t o, const u_int32_t *a, size_t c));
    164 	void		(*bssm1) __P((bus_space_tag_t t, BSH_T *h,
    165 				   bus_size_t o, u_int8_t v, size_t c));
    166 	void		(*bssm2) __P((bus_space_tag_t t, BSH_T *h,
    167 				   bus_size_t o, u_int16_t v, size_t c));
    168 	void		(*bssm4) __P((bus_space_tag_t t, BSH_T *h,
    169 				   bus_size_t o, u_int32_t v, size_t c));
    170 	void		(*bssr1) __P((bus_space_tag_t t, BSH_T *h,
    171 				   bus_size_t o, u_int8_t v, size_t c));
    172 	void		(*bssr2) __P((bus_space_tag_t t, BSH_T *h,
    173 				   bus_size_t o, u_int16_t v, size_t c));
    174 	void		(*bssr4) __P((bus_space_tag_t t, BSH_T *h,
    175 				   bus_size_t o, u_int32_t v, size_t c));
    176 } bus_space_handle_t;
    177 #undef BSH_T
    178 
    179 void	mac68k_bus_space_handle_swapped __P((bus_space_tag_t t,
    180 		bus_space_handle_t *h));
    181 void	mac68k_bus_space_handle_set_stride __P((bus_space_tag_t t,
    182 		bus_space_handle_t *h, int stride));
    183 
    184 /*
    185  *	int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr,
    186  *	    bus_size_t size, int flags, bus_space_handle_t *bshp));
    187  *
    188  * Map a region of bus space.
    189  */
    190 
    191 #define	BUS_SPACE_MAP_CACHEABLE		0x01
    192 #define	BUS_SPACE_MAP_LINEAR		0x02
    193 #define	BUS_SPACE_MAP_PREFETCHABLE	0x04
    194 
    195 int	bus_space_map __P((bus_space_tag_t, bus_addr_t, bus_size_t,
    196 	    int, bus_space_handle_t *));
    197 
    198 /*
    199  *	void bus_space_unmap __P((bus_space_tag_t t,
    200  *	    bus_space_handle_t bsh, bus_size_t size));
    201  *
    202  * Unmap a region of bus space.
    203  */
    204 
    205 void	bus_space_unmap __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
    206 
    207 /*
    208  *	int bus_space_subregion __P((bus_space_tag_t t,
    209  *	    bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
    210  *	    bus_space_handle_t *nbshp));
    211  *
    212  * Get a new handle for a subregion of an already-mapped area of bus space.
    213  */
    214 
    215 int	bus_space_subregion __P((bus_space_tag_t t, bus_space_handle_t bsh,
    216 	    bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp));
    217 
    218 /*
    219  *	int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t, rstart,
    220  *	    bus_addr_t rend, bus_size_t size, bus_size_t align,
    221  *	    bus_size_t boundary, int flags, bus_addr_t *addrp,
    222  *	    bus_space_handle_t *bshp));
    223  *
    224  * Allocate a region of bus space.
    225  */
    226 
    227 int	bus_space_alloc __P((bus_space_tag_t t, bus_addr_t rstart,
    228 	    bus_addr_t rend, bus_size_t size, bus_size_t align,
    229 	    bus_size_t boundary, int cacheable, bus_addr_t *addrp,
    230 	    bus_space_handle_t *bshp));
    231 
    232 /*
    233  *	int bus_space_free __P((bus_space_tag_t t,
    234  *	    bus_space_handle_t bsh, bus_size_t size));
    235  *
    236  * Free a region of bus space.
    237  */
    238 
    239 void	bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
    240 	    bus_size_t size));
    241 
    242 /*
    243  *	int mac68k_bus_space_probe __P((bus_space_tag_t t,
    244  *	    bus_space_handle_t bsh, bus_size_t offset, int sz));
    245  *
    246  * Probe the bus at t/bsh/offset, using sz as the size of the load.
    247  *
    248  * This is a machine-dependent extension, and is not to be used by
    249  * machine-independent code.
    250  */
    251 
    252 int	mac68k_bus_space_probe __P((bus_space_tag_t t,
    253 	    bus_space_handle_t bsh, bus_size_t offset, int sz));
    254 
    255 /*
    256  *	u_intN_t bus_space_read_N __P((bus_space_tag_t tag,
    257  *	    bus_space_handle_t bsh, bus_size_t offset));
    258  *
    259  * Read a 1, 2, 4, or 8 byte quantity from bus space
    260  * described by tag/handle/offset.
    261  */
    262 
    263 u_int8_t mac68k_bsr1 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    264 			   bus_size_t offset));
    265 u_int8_t mac68k_bsr1_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    266 			   bus_size_t offset));
    267 u_int16_t mac68k_bsr2 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    268 			   bus_size_t offset));
    269 u_int16_t mac68k_bsr2_swap __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    270 				bus_size_t offset));
    271 u_int16_t mac68k_bsr2_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    272 				bus_size_t offset));
    273 u_int16_t mac68k_bsrs2_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    274 				bus_size_t offset));
    275 u_int32_t mac68k_bsr4 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    276 			   bus_size_t offset));
    277 u_int32_t mac68k_bsr4_swap __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    278 				bus_size_t offset));
    279 u_int32_t mac68k_bsr4_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    280 				bus_size_t offset));
    281 u_int32_t mac68k_bsrs4_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    282 				bus_size_t offset));
    283 
    284 #define	bus_space_read_1(t,h,o)	(h).bsr1((t), &(h), (o))
    285 #define	bus_space_read_2(t,h,o)	(h).bsr2((t), &(h), (o))
    286 #define	bus_space_read_4(t,h,o)	(h).bsr4((t), &(h), (o))
    287 #define	bus_space_read_stream_1(t,h,o)	(h).bsrs1((t), &(h), (o))
    288 #define	bus_space_read_stream_2(t,h,o)	(h).bsrs2((t), &(h), (o))
    289 #define	bus_space_read_stream_4(t,h,o)	(h).bsrs4((t), &(h), (o))
    290 
    291 #if 0	/* Cause a link error for bus_space_read_8 */
    292 #define	bus_space_read_8(t, h, o)	!!! bus_space_read_8 unimplemented !!!
    293 #define	bus_space_read_stream_8(t, h, o) \
    294 				!!! bus_space_read_stream_8 unimplemented !!!
    295 #endif
    296 
    297 /*
    298  *	void bus_space_read_multi_N __P((bus_space_tag_t tag,
    299  *	    bus_space_handle_t bsh, bus_size_t offset,
    300  *	    u_intN_t *addr, size_t count));
    301  *
    302  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
    303  * described by tag/handle/offset and copy into buffer provided.
    304  */
    305 
    306 void mac68k_bsrm1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    307 				   bus_size_t o, u_int8_t *a, size_t c));
    308 void mac68k_bsrm1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    309 				   bus_size_t o, u_int8_t *a, size_t c));
    310 void mac68k_bsrm2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    311 				   bus_size_t o, u_int16_t *a, size_t c));
    312 void mac68k_bsrm2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    313 				   bus_size_t o, u_int16_t *a, size_t c));
    314 void mac68k_bsrm2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    315 				   bus_size_t o, u_int16_t *a, size_t c));
    316 void mac68k_bsrms2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    317 				   bus_size_t o, u_int16_t *a, size_t c));
    318 void mac68k_bsrm4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    319 				   bus_size_t o, u_int32_t *a, size_t c));
    320 void mac68k_bsrms4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    321 				   bus_size_t o, u_int32_t *a, size_t c));
    322 void mac68k_bsrm4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    323 				   bus_size_t o, u_int32_t *a, size_t c));
    324 void mac68k_bsrm4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    325 				   bus_size_t o, u_int32_t *a, size_t c));
    326 void mac68k_bsrms4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    327 				   bus_size_t o, u_int32_t *a, size_t c));
    328 
    329 #if defined(DIAGNOSTIC)
    330 #define	bus_space_read_multi_1(t, h, o, a, c) do {			 \
    331 	if ((c) == 0)							 \
    332 		panic("bus_space_read_multi_1 called with zero count."); \
    333 	(h).bsrm1(t,&(h),o,a,c); } while (0)
    334 #define	bus_space_read_multi_2(t, h, o, a, c) do {			 \
    335 	if ((c) == 0)							 \
    336 		panic("bus_space_read_multi_2 called with zero count."); \
    337 	(h).bsrm2(t,&(h),o,a,c); } while (0)
    338 #define	bus_space_read_multi_4(t, h, o, a, c) do {			 \
    339 	if ((c) == 0)							 \
    340 		panic("bus_space_read_multi_4 called with zero count."); \
    341 	(h).bsrm4(t,&(h),o,a,c); } while (0)
    342 #define	bus_space_read_multi_stream_1(t, h, o, a, c) do {		 \
    343 	if ((c) == 0)							 \
    344 		panic("bus_space_read_multi_stream_1 called with count=0."); \
    345 	(h).bsrms1(t,&(h),o,a,c); } while (0)
    346 #define	bus_space_read_multi_stream_2(t, h, o, a, c) do {		 \
    347 	if ((c) == 0)							 \
    348 		panic("bus_space_read_multi_stream_2 called with count=0."); \
    349 	(h).bsrms2(t,&(h),o,a,c); } while (0)
    350 #define	bus_space_read_multi_stream_4(t, h, o, a, c) do {		 \
    351 	if ((c) == 0)							 \
    352 		panic("bus_space_read_multi_stream_4 called with count=0."); \
    353 	(h).bsrms4(t,&(h),o,a,c); } while (0)
    354 #else
    355 #define	bus_space_read_multi_1(t, h, o, a, c) \
    356 	do { if (c) (h).bsrm1(t, &(h), o, a, c); } while (0)
    357 #define	bus_space_read_multi_2(t, h, o, a, c) \
    358 	do { if (c) (h).bsrm2(t, &(h), o, a, c); } while (0)
    359 #define	bus_space_read_multi_4(t, h, o, a, c) \
    360 	do { if (c) (h).bsrm4(t, &(h), o, a, c); } while (0)
    361 #define	bus_space_read_multi_stream_1(t, h, o, a, c) \
    362 	do { if (c) (h).bsrms1(t, &(h), o, a, c); } while (0)
    363 #define	bus_space_read_multi_stream_2(t, h, o, a, c) \
    364 	do { if (c) (h).bsrms2(t, &(h), o, a, c); } while (0)
    365 #define	bus_space_read_multi_stream_4(t, h, o, a, c) \
    366 	do { if (c) (h).bsrms4(t, &(h), o, a, c); } while (0)
    367 #endif
    368 
    369 #if 0	/* Cause a link error for bus_space_read_multi_8 */
    370 #define	bus_space_read_multi_8	!!! bus_space_read_multi_8 unimplemented !!!
    371 #define	bus_space_read_multi_stream_8	\
    372 			!!! bus_space_read_multi_stream_8 unimplemented !!!
    373 #endif
    374 
    375 /*
    376  *	void bus_space_read_region_N __P((bus_space_tag_t tag,
    377  *	    bus_space_handle_t bsh, bus_size_t offset,
    378  *	    u_intN_t *addr, size_t count));
    379  *
    380  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
    381  * described by tag/handle and starting at `offset' and copy into
    382  * buffer provided.
    383  */
    384 
    385 void mac68k_bsrr1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    386 				   bus_size_t o, u_int8_t *a, size_t c));
    387 void mac68k_bsrr1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    388 				   bus_size_t o, u_int8_t *a, size_t c));
    389 void mac68k_bsrr2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    390 				   bus_size_t o, u_int16_t *a, size_t c));
    391 void mac68k_bsrr2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    392 				   bus_size_t o, u_int16_t *a, size_t c));
    393 void mac68k_bsrr2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    394 				   bus_size_t o, u_int16_t *a, size_t c));
    395 void mac68k_bsrrs2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    396 				   bus_size_t o, u_int16_t *a, size_t c));
    397 void mac68k_bsrr4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    398 				   bus_size_t o, u_int32_t *a, size_t c));
    399 void mac68k_bsrr4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    400 				   bus_size_t o, u_int32_t *a, size_t c));
    401 void mac68k_bsrr4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    402 				   bus_size_t o, u_int32_t *a, size_t c));
    403 void mac68k_bsrrs4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    404 				   bus_size_t o, u_int32_t *a, size_t c));
    405 
    406 #if defined(DIAGNOSTIC)
    407 #define	bus_space_read_region_1(t, h, o, a, c) do {			  \
    408 	if ((c) == 0)							  \
    409 		panic("bus_space_read_region_1 called with zero count."); \
    410 	(h).bsrr1(t,&(h),o,a,c); } while (0)
    411 #define	bus_space_read_region_2(t, h, o, a, c) do {			  \
    412 	if ((c) == 0)							  \
    413 		panic("bus_space_read_region_2 called with zero count."); \
    414 	(h).bsrr2(t,&(h),o,a,c); } while (0)
    415 #define	bus_space_read_region_4(t, h, o, a, c) do {			  \
    416 	if ((c) == 0)							  \
    417 		panic("bus_space_read_region_4 called with zero count."); \
    418 	(h).bsrr4(t,&(h),o,a,c); } while (0)
    419 #define	bus_space_read_region_stream_1(t, h, o, a, c) do {		  \
    420 	if ((c) == 0)							  \
    421 		panic("bus_space_read_region_stream_1 called with count=0."); \
    422 	(h).bsrrs1(t,&(h),o,a,c); } while (0)
    423 #define	bus_space_read_region_stream_2(t, h, o, a, c) do {		  \
    424 	if ((c) == 0)							  \
    425 		 panic("bus_space_read_region_stream_2 called with count=0."); \
    426 	(h).bsrrs2(t,&(h),o,a,c); } while (0)
    427 #define	bus_space_read_region_stream_4(t, h, o, a, c) do {		  \
    428 	if ((c) == 0)							  \
    429 		panic("bus_space_read_region_stream_4 called with count=0."); \
    430 	(h).bsrrs4(t,&(h),o,a,c); } while (0)
    431 #else
    432 #define	bus_space_read_region_1(t, h, o, a, c) \
    433 	do { if (c) (h).bsrr1(t,&(h),o,a,c); } while (0)
    434 #define	bus_space_read_region_2(t, h, o, a, c) \
    435 	do { if (c) (h).bsrr2(t,&(h),o,a,c); } while (0)
    436 #define	bus_space_read_region_4(t, h, o, a, c) \
    437 	do { if (c) (h).bsrr4(t,&(h),o,a,c); } while (0)
    438 #define	bus_space_read_region_stream_1(t, h, o, a, c) \
    439 	do { if (c) (h).bsrrs1(t,&(h),o,a,c); } while (0)
    440 #define	bus_space_read_region_stream_2(t, h, o, a, c) \
    441 	do { if (c) (h).bsrrs2(t,&(h),o,a,c); } while (0)
    442 #define	bus_space_read_region_stream_4(t, h, o, a, c) \
    443 	do { if (c) (h).bsrrs4(t,&(h),o,a,c); } while (0)
    444 #endif
    445 
    446 #if 0	/* Cause a link error for bus_space_read_region_8 */
    447 #define	bus_space_read_region_8	!!! bus_space_read_region_8 unimplemented !!!
    448 #define	bus_space_read_region_stream_8	\
    449 			!!! bus_space_read_region_stream_8 unimplemented !!!
    450 #endif
    451 
    452 /*
    453  *	void bus_space_write_N __P((bus_space_tag_t tag,
    454  *	    bus_space_handle_t bsh, bus_size_t offset,
    455  *	    u_intN_t value));
    456  *
    457  * Write the 1, 2, 4, or 8 byte value `value' to bus space
    458  * described by tag/handle/offset.
    459  */
    460 
    461 void mac68k_bsw1 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    462 			   bus_size_t offset, u_int8_t v));
    463 void mac68k_bsw1_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    464 			   bus_size_t offset, u_int8_t v));
    465 void mac68k_bsw2 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    466 			   bus_size_t offset, u_int16_t v));
    467 void mac68k_bsw2_swap __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    468 				bus_size_t offset, u_int16_t v));
    469 void mac68k_bsw2_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    470 				bus_size_t offset, u_int16_t v));
    471 void mac68k_bsws2_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    472 				bus_size_t offset, u_int16_t v));
    473 void mac68k_bsw4 __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    474 			   bus_size_t offset, u_int32_t v));
    475 void mac68k_bsw4_swap __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    476 				bus_size_t offset, u_int32_t v));
    477 void mac68k_bsw4_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    478 				bus_size_t offset, u_int32_t v));
    479 void mac68k_bsws4_gen __P((bus_space_tag_t tag, bus_space_handle_t *bsh,
    480 				bus_size_t offset, u_int32_t v));
    481 
    482 #define	bus_space_write_1(t, h, o, v) (h).bsw1(t, &(h), o, v)
    483 #define	bus_space_write_2(t, h, o, v) (h).bsw2(t, &(h), o, v)
    484 #define	bus_space_write_4(t, h, o, v) (h).bsw4(t, &(h), o, v)
    485 #define	bus_space_write_stream_1(t, h, o, v) (h).bsws1(t, &(h), o, v)
    486 #define	bus_space_write_stream_2(t, h, o, v) (h).bsws2(t, &(h), o, v)
    487 #define	bus_space_write_stream_4(t, h, o, v) (h).bsws4(t, &(h), o, v)
    488 
    489 #if 0	/* Cause a link error for bus_space_write_8 */
    490 #define	bus_space_write_8	!!! bus_space_write_8 not implemented !!!
    491 #define	bus_space_write_stream_8 \
    492 			!!! bus_space_write_stream_8 not implemented !!!
    493 #endif
    494 
    495 /*
    496  *	void bus_space_write_multi_N __P((bus_space_tag_t tag,
    497  *	    bus_space_handle_t bsh, bus_size_t offset,
    498  *	    const u_intN_t *addr, size_t count));
    499  *
    500  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
    501  * provided to bus space described by tag/handle/offset.
    502  */
    503 
    504 void mac68k_bswm1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    505 			   bus_size_t o, const u_int8_t *a, size_t c));
    506 void mac68k_bswm1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    507 			   bus_size_t o, const u_int8_t *a, size_t c));
    508 void mac68k_bswm2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    509 			   bus_size_t o, const u_int16_t *a, size_t c));
    510 void mac68k_bswm2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    511 			   bus_size_t o, const u_int16_t *a, size_t c));
    512 void mac68k_bswm2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    513 			   bus_size_t o, const u_int16_t *a, size_t c));
    514 void mac68k_bswms2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    515 			   bus_size_t o, const u_int16_t *a, size_t c));
    516 void mac68k_bswm4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    517 			   bus_size_t o, const u_int32_t *a, size_t c));
    518 void mac68k_bswm4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    519 			   bus_size_t o, const u_int32_t *a, size_t c));
    520 void mac68k_bswm4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    521 			   bus_size_t o, const u_int32_t *a, size_t c));
    522 void mac68k_bswms4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    523 			   bus_size_t o, const u_int32_t *a, size_t c));
    524 
    525 #if defined(DIAGNOSTIC)
    526 #define	bus_space_write_multi_1(t, h, o, a, c) do {			  \
    527 	if ((c) == 0)							  \
    528 		panic("bus_space_write_multi_1 called with zero count."); \
    529 	(h).bswm1(t,&(h),o,a,c); } while (0)
    530 #define	bus_space_write_multi_2(t, h, o, a, c) do {			  \
    531 	if ((c) == 0)							  \
    532 		panic("bus_space_write_multi_2 called with zero count."); \
    533 	(h).bswm2(t,&(h),o,a,c); } while (0)
    534 #define	bus_space_write_multi_4(t, h, o, a, c) do {			  \
    535 	if ((c) == 0)							  \
    536 		panic("bus_space_write_multi_4 called with zero count."); \
    537 	(h).bswm4(t,&(h),o,a,c); } while (0)
    538 #define	bus_space_write_multi_stream_1(t, h, o, a, c) do {		  \
    539 	if ((c) == 0)							  \
    540 		panic("bus_space_write_multi_stream_1 called with count=0."); \
    541 	(h).bswms1(t,&(h),o,a,c); } while (0)
    542 #define	bus_space_write_multi_stream_2(t, h, o, a, c) do {		  \
    543 	if ((c) == 0)							  \
    544 		panic("bus_space_write_multi_stream_2 called with count=0."); \
    545 	(h).bswms2(t,&(h),o,a,c); } while (0)
    546 #define	bus_space_write_multi_stream_4(t, h, o, a, c) do {		  \
    547 	if ((c) == 0)							  \
    548 		panic("bus_space_write_multi_stream_4 called with count=0."); \
    549 	(h).bswms4(t,&(h),o,a,c); } while (0)
    550 #else
    551 #define	bus_space_write_multi_1(t, h, o, a, c) \
    552 	do { if (c) (h).bswm1(t, &(h), o, a, c); } while (0)
    553 #define	bus_space_write_multi_2(t, h, o, a, c) \
    554 	do { if (c) (h).bswm2(t, &(h), o, a, c); } while (0)
    555 #define	bus_space_write_multi_4(t, h, o, a, c) \
    556 	do { if (c) (h).bswm4(t, &(h), o, a, c); } while (0)
    557 #define	bus_space_write_multi_stream_1(t, h, o, a, c) \
    558 	do { if (c) (h).bswms1(t, &(h), o, a, c); } while (0)
    559 #define	bus_space_write_multi_stream_2(t, h, o, a, c) \
    560 	do { if (c) (h).bswms2(t, &(h), o, a, c); } while (0)
    561 #define	bus_space_write_multi_stream_4(t, h, o, a, c) \
    562 	do { if (c) (h).bswms4(t, &(h), o, a, c); } while (0)
    563 #endif
    564 
    565 #if 0	/* Cause a link error for bus_space_write_8 */
    566 #define	bus_space_write_multi_8(t, h, o, a, c)				\
    567 			!!! bus_space_write_multi_8 unimplimented !!!
    568 #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\
    569 			!!! bus_space_write_multi_stream_8 unimplimented !!!
    570 #endif
    571 
    572 /*
    573  *	void bus_space_write_region_N __P((bus_space_tag_t tag,
    574  *	    bus_space_handle_t bsh, bus_size_t offset,
    575  *	    const u_intN_t *addr, size_t count));
    576  *
    577  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
    578  * to bus space described by tag/handle starting at `offset'.
    579  */
    580 
    581 void mac68k_bswr1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    582 			   bus_size_t o, const u_int8_t *a, size_t c));
    583 void mac68k_bswr1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    584 			   bus_size_t o, const u_int8_t *a, size_t c));
    585 void mac68k_bswr2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    586 			   bus_size_t o, const u_int16_t *a, size_t c));
    587 void mac68k_bswr2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    588 			   bus_size_t o, const u_int16_t *a, size_t c));
    589 void mac68k_bswr2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    590 			   bus_size_t o, const u_int16_t *a, size_t c));
    591 void mac68k_bswrs2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    592 			   bus_size_t o, const u_int16_t *a, size_t c));
    593 void mac68k_bswr4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    594 			   bus_size_t o, const u_int32_t *a, size_t c));
    595 void mac68k_bswr4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    596 			   bus_size_t o, const u_int32_t *a, size_t c));
    597 void mac68k_bswr4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    598 			   bus_size_t o, const u_int32_t *a, size_t c));
    599 void mac68k_bswrs4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    600 			   bus_size_t o, const u_int32_t *a, size_t c));
    601 
    602 #if defined(DIAGNOSTIC)
    603 #define	bus_space_write_region_1(t, h, o, a, c) do {			   \
    604 	if ((c) == 0)							   \
    605 		panic("bus_space_write_region_1 called with zero count."); \
    606 	(h).bswr1(t,&(h),o,a,c); } while (0)
    607 #define	bus_space_write_region_2(t, h, o, a, c) do {			   \
    608 	if ((c) == 0)							   \
    609 		panic("bus_space_write_region_2 called with zero count."); \
    610 	(h).bswr2(t,&(h),o,a,c); } while (0)
    611 #define	bus_space_write_region_4(t, h, o, a, c) do {			   \
    612 	if ((c) == 0)							   \
    613 		panic("bus_space_write_region_4 called with zero count."); \
    614 	(h).bswr4(t,&(h),o,a,c); } while (0)
    615 #define	bus_space_write_region_stream_1(t, h, o, a, c) do {		   \
    616 	if ((c) == 0)							   \
    617 		panic("bus_space_write_region_stream_1 called with count=0."); \
    618 	(h).bswrs1(t,&(h),o,a,c); } while (0)
    619 #define	bus_space_write_region_stream_2(t, h, o, a, c) do {		   \
    620 	if ((c) == 0)							   \
    621 		panic("bus_space_write_region_stream_2 called with count=0."); \
    622 	(h).bswrs2(t,&(h),o,a,c); } while (0)
    623 #define	bus_space_write_region_stream_4(t, h, o, a, c) do {		   \
    624 	if ((c) == 0)							   \
    625 		panic("bus_space_write_region_stream_4 called with count=0."); \
    626 	(h).bswrs4(t,&(h),o,a,c); } while (0)
    627 #else
    628 #define	bus_space_write_region_1(t, h, o, a, c) \
    629 	do { if (c) (h).bswr1(t,&(h),o,a,c); } while (0)
    630 #define	bus_space_write_region_2(t, h, o, a, c) \
    631 	do { if (c) (h).bswr2(t,&(h),o,a,c); } while (0)
    632 #define	bus_space_write_region_4(t, h, o, a, c) \
    633 	do { if (c) (h).bswr4(t,&(h),o,a,c); } while (0)
    634 #define	bus_space_write_region_stream_1(t, h, o, a, c) \
    635 	do { if (c) (h).bswrs1(t,&(h),o,a,c); } while (0)
    636 #define	bus_space_write_region_stream_2(t, h, o, a, c) \
    637 	do { if (c) (h).bswrs2(t,&(h),o,a,c); } while (0)
    638 #define	bus_space_write_region_stream_4(t, h, o, a, c) \
    639 	do { if (c) (h).bswrs4(t,&(h),o,a,c); } while (0)
    640 #endif
    641 
    642 #if 0	/* Cause a link error for bus_space_write_region_8 */
    643 #define	bus_space_write_region_8					\
    644 			!!! bus_space_write_region_8 unimplemented !!!
    645 #define	bus_space_write_region_stream_8				\
    646 			!!! bus_space_write_region_stream_8 unimplemented !!!
    647 #endif
    648 
    649 /*
    650  *	void bus_space_set_multi_N __P((bus_space_tag_t tag,
    651  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
    652  *	    size_t count));
    653  *
    654  * Write the 1, 2, 4, or 8 byte value `val' to bus space described
    655  * by tag/handle/offset `count' times.
    656  */
    657 
    658 void mac68k_bssm1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    659 			   bus_size_t o, u_int8_t v, size_t c));
    660 void mac68k_bssm1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    661 			   bus_size_t o, u_int8_t v, size_t c));
    662 void mac68k_bssm2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    663 			   bus_size_t o, u_int16_t v, size_t c));
    664 void mac68k_bssm2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    665 			   bus_size_t o, u_int16_t v, size_t c));
    666 void mac68k_bssm2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    667 			   bus_size_t o, u_int16_t v, size_t c));
    668 void mac68k_bssm4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    669 			   bus_size_t o, u_int32_t v, size_t c));
    670 void mac68k_bssm4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    671 			   bus_size_t o, u_int32_t v, size_t c));
    672 void mac68k_bssm4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    673 			   bus_size_t o, u_int32_t v, size_t c));
    674 
    675 #if defined(DIAGNOSTIC)
    676 #define	bus_space_set_multi_1(t, h, o, val, c) do {			\
    677 	if ((c) == 0)							\
    678 		 panic("bus_space_set_multi_1 called with zero count."); \
    679 	(h).bssm1(t,&(h),o,val,c); } while (0)
    680 #define	bus_space_set_multi_2(t, h, o, val, c) do {			\
    681 	if ((c) == 0)							\
    682 		panic("bus_space_set_multi_2 called with zero count."); \
    683 	(h).bssm2(t,&(h),o,val,c); } while (0)
    684 #define	bus_space_set_multi_4(t, h, o, val, c) do {			\
    685 	if ((c) == 0)							\
    686 		panic("bus_space_set_multi_4 called with zero count."); \
    687 	(h).bssm4(t,&(h),o,val,c); } while (0)
    688 #else
    689 #define	bus_space_set_multi_1(t, h, o, val, c) \
    690 	do { if (c) (h).bssm1(t,&(h),o,val,c); } while (0)
    691 #define	bus_space_set_multi_2(t, h, o, val, c) \
    692 	do { if (c) (h).bssm2(t,&(h),o,val,c); } while (0)
    693 #define	bus_space_set_multi_4(t, h, o, val, c) \
    694 	do { if (c) (h).bssm4(t,&(h),o,val,c); } while (0)
    695 #endif
    696 
    697 #if 0	/* Cause a link error for bus_space_set_multi_8 */
    698 #define	bus_space_set_multi_8						\
    699 			!!! bus_space_set_multi_8 unimplemented !!!
    700 #endif
    701 
    702 /*
    703  *	void bus_space_set_region_N __P((bus_space_tag_t tag,
    704  *	    bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
    705  *	    size_t count));
    706  *
    707  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
    708  * by tag/handle starting at `offset'.
    709  */
    710 
    711 void mac68k_bssr1 __P((bus_space_tag_t t, bus_space_handle_t *h,
    712 			   bus_size_t o, u_int8_t v, size_t c));
    713 void mac68k_bssr1_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    714 			   bus_size_t o, u_int8_t v, size_t c));
    715 void mac68k_bssr2 __P((bus_space_tag_t t, bus_space_handle_t *h,
    716 			   bus_size_t o, u_int16_t v, size_t c));
    717 void mac68k_bssr2_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    718 			   bus_size_t o, u_int16_t v, size_t c));
    719 void mac68k_bssr2_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    720 			   bus_size_t o, u_int16_t v, size_t c));
    721 void mac68k_bssr4 __P((bus_space_tag_t t, bus_space_handle_t *h,
    722 			   bus_size_t o, u_int32_t v, size_t c));
    723 void mac68k_bssr4_swap __P((bus_space_tag_t t, bus_space_handle_t *h,
    724 			   bus_size_t o, u_int32_t v, size_t c));
    725 void mac68k_bssr4_gen __P((bus_space_tag_t t, bus_space_handle_t *h,
    726 			   bus_size_t o, u_int32_t v, size_t c));
    727 
    728 #if defined(DIAGNOSTIC)
    729 #define	bus_space_set_region_1(t, h, o, val, c) do {			 \
    730 	if ((c) == 0)							 \
    731 		panic("bus_space_set_region_1 called with zero count."); \
    732 	(h).bssr1(t,&(h),o,val,c); } while (0)
    733 #define	bus_space_set_region_2(t, h, o, val, c) do {			 \
    734 	if ((c) == 0)							 \
    735 		panic("bus_space_set_region_2 called with zero count."); \
    736 	(h).bssr2(t,&(h),o,val,c); } while (0)
    737 #define	bus_space_set_region_4(t, h, o, val, c) do {			 \
    738 	if ((c) == 0)							 \
    739 		panic("bus_space_set_region_4 called with zero count."); \
    740 	(h).bssr4(t,&(h),o,val,c); } while (0)
    741 #else
    742 #define	bus_space_set_region_1(t, h, o, val, c) \
    743 	do { if (c) (h).bssr1(t,&(h),o,val,c); } while (0)
    744 #define	bus_space_set_region_2(t, h, o, val, c) \
    745 	do { if (c) (h).bssr2(t,&(h),o,val,c); } while (0)
    746 #define	bus_space_set_region_4(t, h, o, val, c) \
    747 	do { if (c) (h).bssr4(t,&(h),o,val,c); } while (0)
    748 #endif
    749 
    750 #if 0	/* Cause a link error for bus_space_set_region_8 */
    751 #define	bus_space_set_region_8						\
    752 			!!! bus_space_set_region_8 unimplemented !!!
    753 #endif
    754 
    755 /*
    756  *	void bus_space_copy_N __P((bus_space_tag_t tag,
    757  *	    bus_space_handle_t bsh1, bus_size_t off1,
    758  *	    bus_space_handle_t bsh2, bus_size_t off2,
    759  *	    size_t count));
    760  *
    761  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
    762  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
    763  */
    764 
    765 #define	__MAC68K_copy_region_N(BYTES)					\
    766 static __inline void __CONCAT(bus_space_copy_region_,BYTES)		\
    767 	__P((bus_space_tag_t,						\
    768 	    bus_space_handle_t bsh1, bus_size_t off1,			\
    769 	    bus_space_handle_t bsh2, bus_size_t off2,			\
    770 	    bus_size_t count));						\
    771 									\
    772 static __inline void							\
    773 __CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c)		\
    774 	bus_space_tag_t t;						\
    775 	bus_space_handle_t h1, h2;					\
    776 	bus_size_t o1, o2, c;						\
    777 {									\
    778 	bus_size_t o;							\
    779 									\
    780 	if ((h1.base + o1) >= (h2.base + o2)) {				\
    781 		/* src after dest: copy forward */			\
    782 		for (o = 0; c != 0; c--, o += BYTES)			\
    783 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
    784 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
    785 	} else {							\
    786 		/* dest after src: copy backwards */			\
    787 		for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES)	\
    788 			__CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o,	\
    789 			    __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \
    790 	}								\
    791 }
    792 __MAC68K_copy_region_N(1)
    793 __MAC68K_copy_region_N(2)
    794 __MAC68K_copy_region_N(4)
    795 #if 0	/* Cause a link error for bus_space_copy_8 */
    796 #define	bus_space_copy_8						\
    797 			!!! bus_space_copy_8 unimplemented !!!
    798 #endif
    799 
    800 #undef __MAC68K_copy_region_N
    801 
    802 /*
    803  * Bus read/write barrier methods.
    804  *
    805  *	void bus_space_barrier __P((bus_space_tag_t tag,
    806  *	    bus_space_handle_t bsh, bus_size_t offset,
    807  *	    bus_size_t len, int flags));
    808  *
    809  * Note: the 680x0 does not currently require barriers, but we must
    810  * provide the flags to MI code.
    811  */
    812 #define	bus_space_barrier(t, h, o, l, f)	\
    813 	((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
    814 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */
    815 #define	BUS_SPACE_BARRIER_WRITE	0x02		/* force write barrier */
    816 
    817 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
    818 
    819 #include <m68k/bus_dma.h>
    820 
    821 #endif /* _MAC68K_BUS_H_ */
    822