Home | History | Annotate | Line # | Download | only in vme
vmevar.h revision 1.3
      1 /*	$NetBSD: vmevar.h,v 1.3 1998/02/04 00:50:44 pk Exp $	*/
      2 /*-
      3  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      4  * All rights reserved.
      5  *
      6  * This code is derived from software contributed to The NetBSD Foundation
      7  * by Paul Kranenburg.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgement:
     19  *        This product includes software developed by the NetBSD
     20  *        Foundation, Inc. and its contributors.
     21  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  *    contributors may be used to endorse or promote products derived
     23  *    from this software without specific prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  * POSSIBILITY OF SUCH DAMAGE.
     36  */
     37 
     38 #include <machine/bus.h>
     39 
     40 /*
     41  * VME address modifiers
     42  */
     43 #define VMEMOD_A32	0x00		/* 32-bit address */
     44 #define VMEMOD_A16	0x20		/* 16-bit address */
     45 #define VMEMOD_A24	0x30		/* 24-bit address */
     46 
     47 #define VMEMOD_BLT64	0x08		/* 64-bit block transfer */
     48 #define VMEMOD_D	0x09		/* data access */
     49 #define VMEMOD_I	0x0a		/* instruction access */
     50 #define VMEMOD_B	0x0b		/* block access */
     51 
     52 #define VMEMOD_S	0x04		/* Supervisor access */
     53 
     54 #define VMEMOD_D32	0x40		/* 32-bit access */
     55 
     56 
     57 typedef u_int32_t	vme_addr_t;
     58 typedef u_int32_t	vme_size_t;
     59 typedef int		vme_mod_t;
     60 
     61 typedef void		*vme_intr_handle_t;
     62 
     63 struct vme_chipset_tag {
     64 	void	*cookie;
     65 	int	(*vct_probe) __P((void *, bus_space_tag_t, vme_addr_t,
     66 				  vme_size_t, vme_mod_t,
     67 				  int (*) __P((void *, void *)), void *));
     68 
     69 	int	(*vct_map) __P((void *, vme_addr_t, vme_size_t, vme_mod_t,
     70 				bus_space_tag_t, bus_space_handle_t *));
     71 	void	(*vct_unmap) __P((void *));
     72 	int	(*vct_mmap_cookie) __P((void *, vme_addr_t, vme_mod_t,
     73 				bus_space_tag_t, int *));
     74 
     75 	int	(*vct_intr_map) __P((void *, int, int, vme_intr_handle_t *));
     76 
     77 	void	*(*vct_intr_establish) __P((void *, vme_intr_handle_t,
     78 					int (*) __P((void *)), void *));
     79 	void	(*vct_intr_disestablish) __P((void *, void *));
     80 	void	(*vct_bus_establish) __P((void *, struct device *));
     81 
     82 };
     83 typedef struct vme_chipset_tag *vme_chipset_tag_t;
     84 
     85 #define vme_bus_probe(ct, bt, addr, size, mod, callback, arg) \
     86 	(*ct->vct_probe)(ct->cookie, bt, addr, size, mod, callback, arg)
     87 #define vme_bus_map(ct, addr, size, mod, bt, bhp) \
     88 	(*ct->vct_map)(ct->cookie, addr, size, mod, bt, bhp)
     89 #define vme_bus_mmap_cookie(ct, addr, mod, bt, hp) \
     90 	(*ct->vct_mmap_cookie)(ct->cookie, addr, mod, bt, hp)
     91 #define vme_intr_map(ct, vec, pri, hp) \
     92 	(*ct->vct_intr_map)(ct->cookie, vec, pri, hp)
     93 #define vme_intr_establish(ct, h, f, a) \
     94 	(*ct->vct_intr_establish)(ct->cookie, h, f, a)
     95 #define vme_bus_establish(ct, d) \
     96 	(*ct->vct_bus_establish)(ct->cookie, d)
     97 
     98 struct vme_busattach_args {
     99 	bus_space_tag_t		vba_bustag;
    100 	bus_dma_tag_t		vba_dmatag;
    101 	vme_chipset_tag_t	vba_chipset_tag;
    102 };
    103 
    104 struct vme_attach_args {
    105 	bus_space_tag_t		vma_bustag;
    106 	bus_dma_tag_t		vma_dmatag;
    107 	vme_chipset_tag_t	vma_chipset_tag;
    108 
    109 #define VMA_MAX_PADDR 1
    110 	int			vma_nreg;	/* # of address locators */
    111 	u_long			vma_reg[VMA_MAX_PADDR];
    112 
    113 	int			vma_vec;	/* VMEbus interrupt vector */
    114 	int			vma_pri;	/* VMEbus interrupt priority */
    115 };
    116 
    117 int	vmesearch __P((struct device *, struct cfdata *, void *));
    118