Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: bus_defs.h,v 1.2 2019/09/23 16:17:57 skrll Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  * NASA Ames Research Center.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  * POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 /*
     34  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
     35  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
     36  *
     37  * Redistribution and use in source and binary forms, with or without
     38  * modification, are permitted provided that the following conditions
     39  * are met:
     40  * 1. Redistributions of source code must retain the above copyright
     41  *    notice, this list of conditions and the following disclaimer.
     42  * 2. Redistributions in binary form must reproduce the above copyright
     43  *    notice, this list of conditions and the following disclaimer in the
     44  *    documentation and/or other materials provided with the distribution.
     45  * 3. All advertising materials mentioning features or use of this software
     46  *    must display the following acknowledgement:
     47  *      This product includes software developed by Christopher G. Demetriou
     48  *	for the NetBSD Project.
     49  * 4. The name of the author may not be used to endorse or promote products
     50  *    derived from this software without specific prior written permission
     51  *
     52  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     53  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     54  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     55  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     56  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     57  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     58  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     59  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     60  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     61  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     62  */
     63 
     64 #ifndef _SH3_BUS_DEFS_H_
     65 #define	_SH3_BUS_DEFS_H_
     66 
     67 #include <sys/bswap.h>
     68 
     69 #define	__BUS_SPACE_HAS_STREAM_METHODS
     70 
     71 #define	BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
     72 
     73 /*
     74  * Values for the sh3 bus space tag, not to be used directly by MI code.
     75  */
     76 #define	SH3_BUS_SPACE_IO	0	/* space is i/o space */
     77 #define	SH3_BUS_SPACE_MEM	1	/* space is mem space */
     78 #define	SH3_BUS_SPACE_PCMCIA_IO 2	/* PCMCIA IO space */
     79 #define	SH3_BUS_SPACE_PCMCIA_MEM 3	/* PCMCIA Mem space */
     80 #define	SH3_BUS_SPACE_PCMCIA_ATT 4	/* PCMCIA Attr space */
     81 #define	SH3_BUS_SPACE_PCMCIA_8BIT 0x8000 /* PCMCIA BUS 8 BIT WIDTH */
     82 #define	SH3_BUS_SPACE_PCMCIA_IO8 \
     83             (SH3_BUS_SPACE_PCMCIA_IO|SH3_BUS_SPACE_PCMCIA_8BIT)
     84 #define	SH3_BUS_SPACE_PCMCIA_MEM8 \
     85             (SH3_BUS_SPACE_PCMCIA_MEM|SH3_BUS_SPACE_PCMCIA_8BIT)
     86 #define	SH3_BUS_SPACE_PCMCIA_ATT8 \
     87             (SH3_BUS_SPACE_PCMCIA_ATT|SH3_BUS_SPACE_PCMCIA_8BIT)
     88 
     89 /*
     90  * Bus address and size types
     91  */
     92 typedef u_long bus_addr_t;
     93 typedef u_long bus_size_t;
     94 
     95 #define PRIxBUSADDR	"lx"
     96 #define PRIxBUSSIZE	"lx"
     97 #define PRIuBUSSIZE	"lu"
     98 
     99 /*
    100  * Access methods for bus resources and address space.
    101  */
    102 typedef	int bus_space_tag_t;
    103 typedef	u_long bus_space_handle_t;
    104 
    105 #define PRIxBSH		"lx"
    106 
    107 /*
    108  *	int bus_space_map (bus_space_tag_t t, bus_addr_t addr,
    109  *	    bus_size_t size, int flags, bus_space_handle_t *bshp);
    110  *
    111  * Map a region of bus space.
    112  */
    113 #define	BUS_SPACE_MAP_CACHEABLE		0x01
    114 #define	BUS_SPACE_MAP_LINEAR		0x02
    115 
    116 #define	BUS_SPACE_BARRIER_READ	0x01		/* force read barrier */
    117 #define	BUS_SPACE_BARRIER_WRITE	0x02		/* force write barrier */
    118 
    119 #endif /* _SH3_BUS_DEFS_H_ */
    120