[BACK]Return to sbusvar.h CVS log [TXT][DIR] Up to [local] / sys / dev / sbus

Annotation of sys/dev/sbus/sbusvar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: sbusvar.h,v 1.12 2007/05/31 17:23:14 sobrado Exp $    */
                      2: /*     $NetBSD: sbusvar.h,v 1.11 2000/11/01 06:18:45 eeh Exp $ */
                      3:
                      4: /*-
                      5:  * Copyright (c) 1998 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * This code is derived from software contributed to The NetBSD Foundation
                      9:  * by Paul Kranenburg.
                     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: #ifndef _SBUS_VAR_H
                     41: #define _SBUS_VAR_H
                     42:
                     43: struct sbus_softc;
                     44:
                     45: /*
                     46:  * S-bus variables.
                     47:  */
                     48:
                     49: /* Device register space description */
                     50: struct sbus_reg {
                     51:        u_int32_t       sbr_slot;
                     52:        u_int32_t       sbr_offset;
                     53:        u_int32_t       sbr_size;
                     54: };
                     55:
                     56: /* Interrupt information */
                     57: struct sbus_intr {
                     58:        u_int32_t       sbi_pri;        /* priority (IPL) */
                     59:        u_int32_t       sbi_vec;        /* vector (always 0?) */
                     60: };
                     61:
                     62: /* Address translation across busses */
                     63: struct sbus_range {
                     64:        u_int32_t       cspace;         /* Client space */
                     65:        u_int32_t       coffset;        /* Client offset */
                     66:        u_int32_t       pspace;         /* Parent space */
                     67:        u_int32_t       poffset;        /* Parent offset */
                     68:        u_int32_t       size;           /* Size in bytes of this range */
                     69: };
                     70:
                     71: /*
                     72:  * SBus driver attach arguments.
                     73:  */
                     74: struct sbus_attach_args {
                     75:        int             sa_placeholder; /* for obio attach args sharing */
                     76:        bus_space_tag_t sa_bustag;
                     77:        bus_dma_tag_t   sa_dmatag;
                     78:        char            *sa_name;       /* PROM node name */
                     79:        int             sa_node;        /* PROM handle */
                     80:        struct sbus_reg *sa_reg;        /* SBus register space for device */
                     81:        int             sa_nreg;        /* Number of SBus register spaces */
                     82: #define sa_slot                sa_reg[0].sbr_slot
                     83: #define sa_offset      sa_reg[0].sbr_offset
                     84: #define sa_size                sa_reg[0].sbr_size
                     85:
                     86:        struct sbus_intr *sa_intr;      /* SBus interrupts for device */
                     87:        int             sa_nintr;       /* Number of interrupts */
                     88: #define sa_pri         sa_intr[0].sbi_pri
                     89:
                     90:        u_int32_t       *sa_promvaddrs;/* PROM-supplied virtual addresses -- 32-bit */
                     91:        int             sa_npromvaddrs; /* Number of PROM VAs */
                     92: #define sa_promvaddr   sa_promvaddrs[0]
                     93:        int             sa_frequency;   /* SBus clockrate */
                     94: };
                     95:
                     96: int    sbus_print(void *, const char *);
                     97:
                     98: int    sbus_setup_attach_args(
                     99:                struct sbus_softc *,
                    100:                bus_space_tag_t,
                    101:                bus_dma_tag_t,
                    102:                int,                    /*node*/
                    103:                struct sbus_attach_args *);
                    104:
                    105: void   sbus_destroy_attach_args(struct sbus_attach_args *);
                    106:
                    107: #define sbus_bus_map(t, slot, offset, sz, flags, unused, hp) \
                    108:        bus_space_map(t, BUS_ADDR(slot, offset), sz, flags, hp)
                    109:
                    110: #if notyet
                    111: /* variables per SBus */
                    112: struct sbus_softc {
                    113:        struct  device sc_dev;          /* base device */
                    114:        bus_space_tag_t sc_bustag;
                    115:        bus_dma_tag_t   sc_dmatag;
                    116:        int     sc_clockfreq;           /* clock frequency (in Hz) */
                    117:        struct  sbus_range *sc_range;
                    118:        int     sc_nrange;
                    119:        int     sc_burst;               /* burst transfer sizes supported */
                    120:        /* machdep stuff follows here */
                    121:        int     *sc_intr2ipl;           /* Interrupt level translation */
                    122:        int     *sc_intr_compat;        /* `intr' property to sbus compat */
                    123: };
                    124: #endif
                    125:
                    126:
                    127: /*
                    128:  * PROM-reported DMA burst sizes for the SBus
                    129:  */
                    130: #define SBUS_BURST_1   0x1
                    131: #define SBUS_BURST_2   0x2
                    132: #define SBUS_BURST_4   0x4
                    133: #define SBUS_BURST_8   0x8
                    134: #define SBUS_BURST_16  0x10
                    135: #define SBUS_BURST_32  0x20
                    136: #define SBUS_BURST_64  0x40
                    137:
                    138: /* We use #defined(SUN4*) here while the ports are in flux */
                    139: #if defined(__sparc__) && !defined(__sparc64__)
                    140: #include <sparc/dev/sbusvar.h>
                    141: #define        INTLEV(x)       (x)
                    142: #elif defined(__sparc64__)
                    143: #include <sparc64/dev/sbusvar.h>
                    144: #include <sparc64/dev/iommureg.h>
                    145: #endif
                    146:
                    147: #endif /* _SBUS_VAR_H */

CVSweb