Home | History | Annotate | Line # | Download | only in sbus
sbusvar.h revision 1.11.6.1
      1  1.11.6.1  fvdl /*	$NetBSD: sbusvar.h,v 1.11.6.1 2001/10/01 12:46:20 fvdl Exp $ */
      2       1.1    pk 
      3       1.1    pk /*-
      4       1.1    pk  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5       1.1    pk  * All rights reserved.
      6       1.1    pk  *
      7       1.1    pk  * This code is derived from software contributed to The NetBSD Foundation
      8       1.1    pk  * by Paul Kranenburg.
      9       1.1    pk  *
     10       1.1    pk  * Redistribution and use in source and binary forms, with or without
     11       1.1    pk  * modification, are permitted provided that the following conditions
     12       1.1    pk  * are met:
     13       1.1    pk  * 1. Redistributions of source code must retain the above copyright
     14       1.1    pk  *    notice, this list of conditions and the following disclaimer.
     15       1.1    pk  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1    pk  *    notice, this list of conditions and the following disclaimer in the
     17       1.1    pk  *    documentation and/or other materials provided with the distribution.
     18       1.1    pk  * 3. All advertising materials mentioning features or use of this software
     19       1.1    pk  *    must display the following acknowledgement:
     20       1.1    pk  *        This product includes software developed by the NetBSD
     21       1.1    pk  *        Foundation, Inc. and its contributors.
     22       1.1    pk  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23       1.1    pk  *    contributors may be used to endorse or promote products derived
     24       1.1    pk  *    from this software without specific prior written permission.
     25       1.1    pk  *
     26       1.1    pk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27       1.1    pk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28       1.1    pk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29       1.1    pk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30       1.1    pk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31       1.1    pk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32       1.1    pk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33       1.1    pk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34       1.1    pk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35       1.1    pk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36       1.1    pk  * POSSIBILITY OF SUCH DAMAGE.
     37       1.1    pk  */
     38       1.1    pk 
     39       1.2    pk #ifndef _SBUS_VAR_H
     40       1.2    pk #define _SBUS_VAR_H
     41       1.2    pk 
     42       1.2    pk struct sbus_softc;
     43       1.2    pk 
     44       1.2    pk /*
     45       1.2    pk  * S-bus variables.
     46       1.2    pk  */
     47       1.2    pk struct sbusdev {
     48       1.2    pk 	struct	device *sd_dev;		/* backpointer to generic */
     49       1.2    pk 	struct	sbusdev *sd_bchain;	/* forward link in bus chain */
     50       1.2    pk 	void	(*sd_reset) __P((struct device *));
     51       1.2    pk };
     52       1.2    pk 
     53       1.2    pk 
     54       1.2    pk /* Device register space description */
     55       1.2    pk struct sbus_reg {
     56       1.2    pk 	u_int32_t	sbr_slot;
     57       1.2    pk 	u_int32_t	sbr_offset;
     58       1.2    pk 	u_int32_t	sbr_size;
     59       1.2    pk };
     60       1.2    pk 
     61       1.2    pk /* Interrupt information */
     62       1.2    pk struct sbus_intr {
     63       1.2    pk 	u_int32_t	sbi_pri;	/* priority (IPL) */
     64       1.2    pk 	u_int32_t	sbi_vec;	/* vector (always 0?) */
     65       1.2    pk };
     66       1.2    pk 
     67       1.2    pk /* Address translation accross busses */
     68       1.2    pk struct sbus_range {
     69       1.2    pk 	u_int32_t	cspace;		/* Client space */
     70       1.2    pk 	u_int32_t	coffset;	/* Client offset */
     71       1.2    pk 	u_int32_t	pspace;		/* Parent space */
     72       1.2    pk 	u_int32_t	poffset;	/* Parent offset */
     73       1.2    pk 	u_int32_t	size;		/* Size in bytes of this range */
     74       1.2    pk };
     75       1.2    pk 
     76       1.2    pk /*
     77       1.2    pk  * Sbus driver attach arguments.
     78       1.2    pk  */
     79       1.2    pk struct sbus_attach_args {
     80       1.2    pk 	int		sa_placeholder;	/* for obio attach args sharing */
     81       1.2    pk 	bus_space_tag_t	sa_bustag;
     82       1.2    pk 	bus_dma_tag_t	sa_dmatag;
     83       1.2    pk 	char		*sa_name;	/* PROM node name */
     84       1.2    pk 	int		sa_node;	/* PROM handle */
     85       1.2    pk 	struct sbus_reg	*sa_reg;	/* Sbus register space for device */
     86       1.2    pk 	int		sa_nreg;	/* Number of Sbus register spaces */
     87       1.2    pk #define sa_slot		sa_reg[0].sbr_slot
     88       1.2    pk #define sa_offset	sa_reg[0].sbr_offset
     89       1.2    pk #define sa_size		sa_reg[0].sbr_size
     90       1.2    pk 
     91       1.2    pk 	struct sbus_intr *sa_intr;	/* Sbus interrupts for device */
     92       1.2    pk 	int		sa_nintr;	/* Number of interrupts */
     93       1.2    pk #define sa_pri		sa_intr[0].sbi_pri
     94       1.2    pk 
     95       1.7   eeh 	u_int32_t	*sa_promvaddrs;/* PROM-supplied virtual addresses -- 32-bit */
     96       1.2    pk 	int		sa_npromvaddrs;	/* Number of PROM VAs */
     97       1.9   eeh #define sa_promvaddr	sa_promvaddrs[0]
     98      1.11   eeh 	int		sa_frequency;	/* SBus clockrate */
     99       1.2    pk };
    100       1.2    pk 
    101       1.6   eeh /* sbus_attach_internal() is also used from obio.c */
    102       1.6   eeh void	sbus_attach_common __P((struct sbus_softc *, char *, int,
    103      1.10    pk 				const char * const *));
    104       1.2    pk int	sbus_print __P((void *, const char *));
    105       1.2    pk 
    106       1.2    pk void	sbus_establish __P((struct sbusdev *, struct device *));
    107       1.2    pk 
    108       1.2    pk int	sbus_setup_attach_args __P((
    109       1.2    pk 		struct sbus_softc *,
    110       1.2    pk 		bus_space_tag_t,
    111       1.2    pk 		bus_dma_tag_t,
    112       1.2    pk 		int,			/*node*/
    113       1.2    pk 		struct sbus_attach_args *));
    114       1.2    pk 
    115       1.2    pk void	sbus_destroy_attach_args __P((struct sbus_attach_args *));
    116       1.2    pk 
    117       1.2    pk #define sbus_bus_map(t, bt, a, s, f, v, hp) \
    118       1.2    pk 	bus_space_map2(t, bt, a, s, f, v, hp)
    119  1.11.6.1  fvdl bus_addr_t	sbus_bus_addr __P((bus_space_tag_t, u_int, u_int));
    120       1.2    pk 
    121       1.2    pk #if notyet
    122       1.2    pk /* variables per Sbus */
    123       1.2    pk struct sbus_softc {
    124       1.2    pk 	struct	device sc_dev;		/* base device */
    125       1.2    pk 	bus_space_tag_t	sc_bustag;
    126       1.2    pk 	bus_dma_tag_t	sc_dmatag;
    127       1.2    pk 	int	sc_clockfreq;		/* clock frequency (in Hz) */
    128       1.2    pk 	struct	sbusdev *sc_sbdev;	/* list of all children */
    129       1.2    pk 	struct	sbus_range *sc_range;
    130       1.2    pk 	int	sc_nrange;
    131       1.2    pk 	int	sc_burst;		/* burst transfer sizes supported */
    132       1.3   eeh 	/* machdep stuff follows here */
    133       1.2    pk 	int	*sc_intr2ipl;		/* Interrupt level translation */
    134       1.2    pk 	int	*sc_intr_compat;	/* `intr' property to sbus compat */
    135       1.2    pk };
    136       1.2    pk #endif
    137       1.2    pk 
    138       1.1    pk 
    139       1.1    pk /*
    140       1.1    pk  * PROM-reported DMA burst sizes for the SBus
    141       1.1    pk  */
    142       1.1    pk #define SBUS_BURST_1	0x1
    143       1.1    pk #define SBUS_BURST_2	0x2
    144       1.1    pk #define SBUS_BURST_4	0x4
    145       1.1    pk #define SBUS_BURST_8	0x8
    146       1.1    pk #define SBUS_BURST_16	0x10
    147       1.1    pk #define SBUS_BURST_32	0x20
    148       1.1    pk #define SBUS_BURST_64	0x40
    149       1.5    pk 
    150       1.5    pk /* We use #defined(SUN4*) here while the ports are in flux */
    151       1.5    pk #if defined(SUN4) || defined(SUN4C) || defined(SUN4M)
    152       1.5    pk #include <sparc/dev/sbusvar.h>
    153       1.5    pk #elif defined(SUN4U)
    154       1.5    pk #include <sparc64/dev/sbusvar.h>
    155       1.5    pk #endif
    156       1.2    pk 
    157       1.2    pk #endif /* _SBUS_VAR_H */
    158