bi_mainbus.c revision 1.2
11.2Sragge/*	$NetBSD: bi_mainbus.c,v 1.2 2000/03/26 11:41:25 ragge Exp $	   */
21.1Sragge/*
31.1Sragge * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
41.1Sragge * 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#include <sys/param.h>
341.1Sragge#include <sys/device.h>
351.1Sragge
361.1Sragge#define	_VAX_BUS_DMA_PRIVATE
371.1Sragge#include <machine/bus.h>
381.1Sragge#include <machine/nexus.h>
391.1Sragge#include <machine/sid.h>
401.2Sragge#include <machine/scb.h>
411.2Sragge#include <machine/cpu.h>
421.1Sragge
431.1Sragge#include <dev/bi/bivar.h>
441.1Sragge
451.1Sraggestatic	int bi_mainbus_match __P((struct device *, struct cfdata *, void *));
461.1Sraggestatic	void bi_mainbus_attach __P((struct device *, struct device *, void *));
471.1Sragge
481.1Sraggestruct	cfattach bi_mainbus_ca = {
491.1Sragge	sizeof(struct bi_softc), bi_mainbus_match, bi_mainbus_attach
501.1Sragge};
511.1Sragge
521.1Sraggeextern	struct vax_bus_space vax_mem_bus_space;
531.1Sraggeextern	struct vax_bus_dma_tag vax_bus_dma_tag;
541.1Sragge
551.1Sraggeint
561.1Sraggebi_mainbus_match(parent, vcf, aux)
571.1Sragge	struct device *parent;
581.1Sragge	struct cfdata *vcf;
591.1Sragge	void *aux;
601.1Sragge{
611.1Sragge	if (vax_bustype == VAX_BIBUS)
621.1Sragge		return 1;
631.1Sragge	return 0;
641.1Sragge}
651.1Sragge
661.1Sraggevoid
671.1Sraggebi_mainbus_attach(parent, self, aux)
681.1Sragge	struct device *parent, *self;
691.1Sragge	void *aux;
701.1Sragge{
711.1Sragge	struct bi_softc *sc = (void *)self;
721.1Sragge
731.1Sragge	/*
741.1Sragge	 * Fill in bus specific data.
751.1Sragge	 */
761.2Sragge	sc->sc_addr = (bus_addr_t)0x20000000; /* XXX */
771.1Sragge	sc->sc_iot = &vax_mem_bus_space; /* No special I/O handling */
781.1Sragge	sc->sc_dmat = &vax_bus_dma_tag;	/* No special DMA handling either */
791.2Sragge	sc->sc_intcpu = 1 << mastercpu;
801.1Sragge
811.1Sragge	bi_attach(sc);
821.2Sragge}
831.2Sragge
841.2Sraggevoid
851.2Sraggebi_intr_establish(void *icookie, int vec, void (*func)(void *), void *arg)
861.2Sragge{
871.2Sragge	scb_vecalloc(vec, func, arg, SCB_ISTACK);
881.1Sragge}
89