uba_cmi.c revision 1.5
11.5Sragge/* $NetBSD: uba_cmi.c,v 1.5 2000/06/04 17:59:50 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.4Smatt#include <vax/uba/uba_common.h> 541.1Sragge 551.5Sragge#include "locators.h" 561.5Sragge 571.1Sragge/* Some CMI-specific defines */ 581.2Sragge#define UBASIZE ((UBAPAGES + UBAIOPAGES) * VAX_NBPG) 591.2Sragge#define UMEM750(i) (0xfc0000 - (i) * UBASIZE) 601.2Sragge#define UIOPAGE(x) (UMEM750(x) + (UBAPAGES * VAX_NBPG)) 611.1Sragge 621.1Sragge/* 631.1Sragge * The DW780 and DW750 are quite similar to their function from 641.1Sragge * a programmers point of view. Differencies are number of BDP's 651.1Sragge * and bus status/command registers, the latter are (partly) IPR's 661.1Sragge * on 750. 671.1Sragge */ 681.5Sraggestatic int dw750_match(struct device *, struct cfdata *, void *); 691.5Sraggestatic void dw750_attach(struct device *, struct device *, void *); 701.5Sraggestatic void dw750_init(struct uba_softc*); 711.1Sragge#ifdef notyet 721.5Sraggestatic void dw750_purge(struct uba_softc *, int); 731.1Sragge#endif 741.1Sragge 751.1Sraggestruct cfattach uba_cmi_ca = { 761.1Sragge sizeof(struct uba_vsoftc), dw750_match, dw750_attach 771.1Sragge}; 781.1Sragge 791.1Sraggeextern struct vax_bus_space vax_mem_bus_space; 801.1Sragge 811.1Sraggeint 821.5Sraggedw750_match(struct device *parent, struct cfdata *cf, void *aux) 831.1Sragge{ 841.1Sragge struct sbi_attach_args *sa = (struct sbi_attach_args *)aux; 851.1Sragge 861.5Sragge if (cf->cf_loc[CMICF_TR] != sa->sa_nexnum && 871.5Sragge cf->cf_loc[CMICF_TR] != CMICF_TR_DEFAULT) 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.5Sragge if ((sa->sa_type & ~3) != NEX_UBA0) 941.1Sragge return 0; 951.1Sragge 961.1Sragge return 1; 971.1Sragge} 981.1Sragge 991.1Sraggevoid 1001.5Sraggedw750_attach(struct device *parent, struct device *self, void *aux) 1011.1Sragge{ 1021.1Sragge struct uba_vsoftc *sc = (void *)self; 1031.1Sragge struct sbi_attach_args *sa = aux; 1041.1Sragge 1051.1Sragge printf(": DW750\n"); 1061.1Sragge /* 1071.1Sragge * Fill in bus specific data. 1081.1Sragge */ 1091.1Sragge sc->uv_sc.uh_ubainit = dw750_init; 1101.1Sragge#ifdef notyet 1111.1Sragge sc->uv_sc.uh_ubapurge = dw750_purge; 1121.1Sragge#endif 1131.1Sragge sc->uv_sc.uh_iot = &vax_mem_bus_space; 1141.1Sragge sc->uv_sc.uh_dmat = &sc->uv_dmat; 1151.1Sragge 1161.1Sragge /* 1171.1Sragge * Fill in variables used by the sgmap system. 1181.1Sragge */ 1191.3Sragge sc->uv_size = UBAPAGES * VAX_NBPG; 1201.5Sragge sc->uv_uba = (void *)sa->sa_ioh; /* Map registers is in adaptor */ 1211.1Sragge 1221.1Sragge uba_dma_init(sc); 1231.5Sragge uba_attach(&sc->uv_sc, UIOPAGE(sa->sa_type == NEX_UBA1)); 1241.1Sragge} 1251.1Sragge 1261.1Sraggevoid 1271.5Sraggedw750_init(struct uba_softc *sc) 1281.1Sragge{ 1291.1Sragge mtpr(0, PR_IUR); 1301.1Sragge DELAY(500000); 1311.1Sragge} 1321.1Sragge 1331.1Sragge#ifdef notyet 1341.1Sraggevoid 1351.5Sraggedw750_purge(struct uba_softc sc, int bdp) 1361.1Sragge{ 1371.1Sragge sc->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE | UBADPR_NXM | UBADPR_UCE; 1381.1Sragge} 1391.1Sragge#endif 140