bi_xmi.c revision 1.1
11.1Sragge/* $NetBSD: bi_xmi.c,v 1.1 2000/07/06 17:45:52 ragge Exp $ */ 21.1Sragge 31.1Sragge/* 41.1Sragge * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. 51.1Sragge * 61.1Sragge * Redistribution and use in source and binary forms, with or without 71.1Sragge * modification, are permitted provided that the following conditions 81.1Sragge * are met: 91.1Sragge * 1. Redistributions of source code must retain the above copyright 101.1Sragge * notice, this list of conditions and the following disclaimer. 111.1Sragge * 2. Redistributions in binary form must reproduce the above copyright 121.1Sragge * notice, this list of conditions and the following disclaimer in the 131.1Sragge * documentation and/or other materials provided with the distribution. 141.1Sragge * 3. All advertising materials mentioning features or use of this software 151.1Sragge * must display the following acknowledgement: 161.1Sragge * This product includes software developed at Ludd, University of 171.1Sragge * Lule}, Sweden and its contributors. 181.1Sragge * 4. The name of the author may not be used to endorse or promote products 191.1Sragge * derived from this software without specific prior written permission 201.1Sragge * 211.1Sragge * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 221.1Sragge * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 231.1Sragge * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 241.1Sragge * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Sragge * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261.1Sragge * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 271.1Sragge * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 281.1Sragge * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291.1Sragge * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 301.1Sragge * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 311.1Sragge */ 321.1Sragge 331.1Sragge 341.1Sragge/* 351.1Sragge * DWMBA XMI-BI adapter. 361.1Sragge */ 371.1Sragge 381.1Sragge#include <sys/param.h> 391.1Sragge#include <sys/device.h> 401.1Sragge 411.1Sragge#include <machine/bus.h> 421.1Sragge 431.1Sragge#include <dev/xmi/xmireg.h> 441.1Sragge#include <dev/xmi/xmivar.h> 451.1Sragge 461.1Sragge#include <dev/bi/bireg.h> 471.1Sragge#include <dev/bi/bivar.h> 481.1Sragge 491.1Sragge#include "locators.h" 501.1Sragge 511.1Sraggestatic int 521.1Sraggebi_xmi_match(struct device *parent, struct cfdata *cf, void *aux) 531.1Sragge{ 541.1Sragge struct xmi_attach_args *xa = aux; 551.1Sragge 561.1Sragge if (bus_space_read_2(xa->xa_iot, xa->xa_ioh, XMI_TYPE) != XMIDT_DWMBA) 571.1Sragge return 0; 581.1Sragge 591.1Sragge if (cf->cf_loc[XMICF_NODE] != XMICF_NODE_DEFAULT && 601.1Sragge cf->cf_loc[XMICF_NODE] != xa->xa_nodenr) 611.1Sragge return 0; 621.1Sragge 631.1Sragge return 1; 641.1Sragge} 651.1Sragge 661.1Sraggestatic void 671.1Sraggebi_xmi_attach(struct device *parent, struct device *self, void *aux) 681.1Sragge{ 691.1Sragge struct bi_softc *sc = (void *)self; 701.1Sragge struct xmi_attach_args *xa = aux; 711.1Sragge 721.1Sragge /* 731.1Sragge * Fill in bus specific data. 741.1Sragge */ 751.1Sragge sc->sc_addr = (bus_addr_t)BI_BASE(xa->xa_nodenr, 0); 761.1Sragge sc->sc_iot = xa->xa_iot; /* No special I/O handling */ 771.1Sragge sc->sc_dmat = xa->xa_dmat; /* No special DMA handling either */ 781.1Sragge sc->sc_intcpu = xa->xa_intcpu; 791.1Sragge 801.1Sragge bi_attach(sc); 811.1Sragge} 821.1Sragge 831.1Sraggestruct cfattach bi_xmi_ca = { 841.1Sragge sizeof(struct bi_softc), bi_xmi_match, bi_xmi_attach 851.1Sragge}; 861.1Sragge 87