uba_cmi.c revision 1.3
11.3Sragge/* $NetBSD: uba_cmi.c,v 1.3 2000/05/27 21:44:35 ragge Exp $ */ 21.1Sragge/* 31.1Sragge * Copyright (c) 1996 Jonathan Stone. 41.1Sragge * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. 51.1Sragge * Copyright (c) 1982, 1986 The Regents of the University of California. 61.1Sragge * All rights reserved. 71.1Sragge * 81.1Sragge * Redistribution and use in source and binary forms, with or without 91.1Sragge * modification, are permitted provided that the following conditions 101.1Sragge * are met: 111.1Sragge * 1. Redistributions of source code must retain the above copyright 121.1Sragge * notice, this list of conditions and the following disclaimer. 131.1Sragge * 2. Redistributions in binary form must reproduce the above copyright 141.1Sragge * notice, this list of conditions and the following disclaimer in the 151.1Sragge * documentation and/or other materials provided with the distribution. 161.1Sragge * 3. All advertising materials mentioning features or use of this software 171.1Sragge * must display the following acknowledgement: 181.1Sragge * This product includes software developed by the University of 191.1Sragge * California, Berkeley and its contributors. 201.1Sragge * 4. Neither the name of the University nor the names of its contributors 211.1Sragge * may be used to endorse or promote products derived from this software 221.1Sragge * without specific prior written permission. 231.1Sragge * 241.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271.1Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341.1Sragge * SUCH DAMAGE. 351.1Sragge * 361.1Sragge * @(#)uba.c 7.10 (Berkeley) 12/16/90 371.1Sragge * @(#)autoconf.c 7.20 (Berkeley) 5/9/91 381.1Sragge */ 391.1Sragge 401.1Sragge#include <sys/param.h> 411.1Sragge#include <sys/device.h> 421.1Sragge#include <sys/systm.h> 431.1Sragge 441.1Sragge#define _VAX_BUS_DMA_PRIVATE 451.1Sragge#include <machine/bus.h> 461.1Sragge#include <machine/mtpr.h> 471.1Sragge#include <machine/nexus.h> 481.1Sragge#include <machine/cpu.h> 491.1Sragge#include <machine/sgmap.h> 501.1Sragge 511.1Sragge#include <dev/qbus/ubavar.h> 521.1Sragge 531.1Sragge#include <arch/vax/uba/uba_common.h> 541.1Sragge 551.1Sragge/* Some CMI-specific defines */ 561.2Sragge#define UBASIZE ((UBAPAGES + UBAIOPAGES) * VAX_NBPG) 571.2Sragge#define UMEM750(i) (0xfc0000 - (i) * UBASIZE) 581.2Sragge#define UIOPAGE(x) (UMEM750(x) + (UBAPAGES * VAX_NBPG)) 591.1Sragge 601.1Sragge/* 611.1Sragge * The DW780 and DW750 are quite similar to their function from 621.1Sragge * a programmers point of view. Differencies are number of BDP's 631.1Sragge * and bus status/command registers, the latter are (partly) IPR's 641.1Sragge * on 750. 651.1Sragge */ 661.1Sraggestatic int dw750_match __P((struct device *, struct cfdata *, void *)); 671.1Sraggestatic void dw750_attach __P((struct device *, struct device *, void *)); 681.1Sraggestatic void dw750_init __P((struct uba_softc*)); 691.1Sragge#ifdef notyet 701.1Sraggestatic void dw750_purge __P((struct uba_softc *, int)); 711.1Sragge#endif 721.1Sragge 731.1Sraggestruct cfattach uba_cmi_ca = { 741.1Sragge sizeof(struct uba_vsoftc), dw750_match, dw750_attach 751.1Sragge}; 761.1Sragge 771.1Sraggeextern struct vax_bus_space vax_mem_bus_space; 781.1Sragge 791.1Sraggeint 801.1Sraggedw750_match(parent, cf, aux) 811.1Sragge struct device *parent; 821.1Sragge struct cfdata *cf; 831.1Sragge void *aux; 841.1Sragge{ 851.1Sragge struct sbi_attach_args *sa = (struct sbi_attach_args *)aux; 861.1Sragge 871.1Sragge if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1 )) 881.1Sragge return 0; 891.1Sragge /* 901.1Sragge * The uba type is actually only telling where the uba 911.1Sragge * space is in nexus space. 921.1Sragge */ 931.1Sragge if ((sa->type & ~3) != NEX_UBA0) 941.1Sragge return 0; 951.1Sragge 961.1Sragge return 1; 971.1Sragge} 981.1Sragge 991.1Sraggevoid 1001.1Sraggedw750_attach(parent, self, aux) 1011.1Sragge struct device *parent, *self; 1021.1Sragge void *aux; 1031.1Sragge{ 1041.1Sragge struct uba_vsoftc *sc = (void *)self; 1051.1Sragge struct sbi_attach_args *sa = aux; 1061.1Sragge 1071.1Sragge printf(": DW750\n"); 1081.1Sragge /* 1091.1Sragge * Fill in bus specific data. 1101.1Sragge */ 1111.1Sragge sc->uv_sc.uh_ubainit = dw750_init; 1121.1Sragge#ifdef notyet 1131.1Sragge sc->uv_sc.uh_ubapurge = dw750_purge; 1141.1Sragge#endif 1151.1Sragge sc->uv_sc.uh_iot = &vax_mem_bus_space; 1161.1Sragge sc->uv_sc.uh_dmat = &sc->uv_dmat; 1171.1Sragge 1181.1Sragge /* 1191.1Sragge * Fill in variables used by the sgmap system. 1201.1Sragge */ 1211.3Sragge sc->uv_size = UBAPAGES * VAX_NBPG; 1221.3Sragge sc->uv_uba = (void *)sa->nexaddr; /* Map registers is in adaptor */ 1231.1Sragge 1241.1Sragge uba_dma_init(sc); 1251.3Sragge uba_attach(&sc->uv_sc, UIOPAGE(sa->type == NEX_UBA1)); 1261.1Sragge} 1271.1Sragge 1281.1Sraggevoid 1291.1Sraggedw750_init(sc) 1301.1Sragge struct uba_softc *sc; 1311.1Sragge{ 1321.1Sragge mtpr(0, PR_IUR); 1331.1Sragge DELAY(500000); 1341.1Sragge} 1351.1Sragge 1361.1Sragge#ifdef notyet 1371.1Sraggevoid 1381.1Sraggedw750_purge(sc, bdp) 1391.1Sragge struct uba_softc *sc; 1401.1Sragge int bdp; 1411.1Sragge{ 1421.1Sragge sc->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE | UBADPR_NXM | UBADPR_UCE; 1431.1Sragge} 1441.1Sragge#endif 145