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