[BACK]Return to uba_cmi.c CVS log [TXT][DIR] Up to [local] / sys / arch / vax / uba

Annotation of sys/arch/vax/uba/uba_cmi.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: uba_cmi.c,v 1.3 2003/06/02 23:27:58 millert Exp $     */
                      2: /*     $NetBSD: uba_cmi.c,v 1.2 1999/08/14 11:31:48 ragge Exp $           */
                      3: /*
                      4:  * Copyright (c) 1996 Jonathan Stone.
                      5:  * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
                      6:  * Copyright (c) 1982, 1986 The Regents of the University of California.
                      7:  * All rights reserved.
                      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. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
                     33:  *     @(#)uba.c       7.10 (Berkeley) 12/16/90
                     34:  *     @(#)autoconf.c  7.20 (Berkeley) 5/9/91
                     35:  */
                     36:
                     37: #include <sys/param.h>
                     38: #include <sys/device.h>
                     39: #include <sys/systm.h>
                     40:
                     41: #define        _VAX_BUS_DMA_PRIVATE
                     42: #include <machine/bus.h>
                     43: #include <machine/mtpr.h>
                     44: #include <machine/nexus.h>
                     45: #include <machine/cpu.h>
                     46: #include <machine/sgmap.h>
                     47:
                     48: #include <arch/vax/qbus/ubavar.h>
                     49:
                     50: #include <arch/vax/uba/uba_common.h>
                     51:
                     52: /* Some CMI-specific defines */
                     53: #define        UBASIZE         ((UBAPAGES + UBAIOPAGES) * VAX_NBPG)
                     54: #define UMEM750(i)             (0xfc0000 - (i) * UBASIZE)
                     55: #define        UIOPAGE(x)      (UMEM750(x) + (UBAPAGES * VAX_NBPG))
                     56:
                     57: /*
                     58:  * The DW780 and DW750 are quite similar to their function from
                     59:  * a programmers point of view. Differencies are number of BDP's
                     60:  * and bus status/command registers, the latter are (partly) IPR's
                     61:  * on 750.
                     62:  */
                     63: static int     dw750_match(struct device *, struct cfdata *, void *);
                     64: static void    dw750_attach(struct device *, struct device *, void *);
                     65: static void    dw750_init(struct uba_softc*);
                     66: #ifdef notyet
                     67: static void    dw750_purge(struct uba_softc *, int);
                     68: #endif
                     69:
                     70: struct cfattach uba_cmi_ca = {
                     71:        sizeof(struct uba_vsoftc), dw750_match, dw750_attach
                     72: };
                     73:
                     74: extern struct vax_bus_space vax_mem_bus_space;
                     75:
                     76: int
                     77: dw750_match(parent, cf, aux)
                     78:        struct device *parent;
                     79:        struct cfdata *cf;
                     80:        void *aux;
                     81: {
                     82:        struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
                     83:
                     84:        if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1 ))
                     85:                return 0;
                     86:        /*
                     87:         * The uba type is actually only telling where the uba
                     88:         * space is in nexus space.
                     89:         */
                     90:        if ((sa->type & ~3) != NEX_UBA0)
                     91:                return 0;
                     92:
                     93:        return 1;
                     94: }
                     95:
                     96: void
                     97: dw750_attach(parent, self, aux)
                     98:        struct device *parent, *self;
                     99:        void *aux;
                    100: {
                    101:        struct uba_vsoftc *sc = (void *)self;
                    102:        struct sbi_attach_args *sa = aux;
                    103:        struct  uba_regs *uh_uba = (void *)sa->nexaddr;
                    104:        int ubaddr = sa->nexinfo & 1;
                    105:
                    106:        printf(": DW750\n");
                    107:        /*
                    108:         * Fill in bus specific data.
                    109:         */
                    110:        sc->uv_sc.uh_ubainit = dw750_init;
                    111: #ifdef notyet
                    112:        sc->uv_sc.uh_ubapurge = dw750_purge;
                    113: #endif
                    114:        sc->uv_sc.uh_iot = &vax_mem_bus_space;
                    115:        sc->uv_sc.uh_dmat = &sc->uv_dmat;
                    116:
                    117:        /*
                    118:         * Fill in variables used by the sgmap system.
                    119:         */
                    120:        sc->uv_size = UBASIZE;          /* Size in bytes of Qbus space */
                    121:        sc->uv_addr = (paddr_t)uh_uba->uba_map; /* Map regs physical address */
                    122:
                    123:        uba_dma_init(sc);
                    124:        uba_attach(&sc->uv_sc, UIOPAGE(ubaddr));
                    125: }
                    126:
                    127: void
                    128: dw750_init(sc)
                    129:        struct uba_softc *sc;
                    130: {
                    131:        mtpr(0, PR_IUR);
                    132:        DELAY(500000);
                    133: }
                    134:
                    135: #ifdef notyet
                    136: void
                    137: dw750_purge(sc, bdp)
                    138:        struct uba_softc *sc;
                    139:        int bdp;
                    140: {
                    141:        sc->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE | UBADPR_NXM | UBADPR_UCE;
                    142: }
                    143: #endif

CVSweb