bi_mainbus.c revision 1.11
11.11Smatt/*	$NetBSD: bi_mainbus.c,v 1.11 2010/12/14 23:38:30 matt 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.8Slukem
331.8Slukem#include <sys/cdefs.h>
341.11Smatt__KERNEL_RCSID(0, "$NetBSD: bi_mainbus.c,v 1.11 2010/12/14 23:38:30 matt Exp $");
351.11Smatt
361.11Smatt#define _VAX_BUS_DMA_PRIVATE
371.1Sragge
381.1Sragge#include <sys/param.h>
391.1Sragge#include <sys/device.h>
401.11Smatt#include <sys/bus.h>
411.11Smatt#include <sys/cpu.h>
421.1Sragge
431.1Sragge#include <machine/nexus.h>
441.1Sragge#include <machine/sid.h>
451.2Sragge#include <machine/scb.h>
461.10Smatt#include <machine/mainbus.h>
471.1Sragge
481.1Sragge#include <dev/bi/bivar.h>
491.4Sragge#include <dev/bi/bireg.h>
501.1Sragge
511.10Smatt#include "ioconf.h"
521.1Sragge
531.10Smattstatic	int bi_mainbus_match(device_t, cfdata_t, void *);
541.10Smattstatic	void bi_mainbus_attach(device_t, device_t, void *);
551.10Smatt
561.10SmattCFATTACH_DECL_NEW(bi_mainbus, sizeof(struct bi_softc),
571.7Sthorpej    bi_mainbus_match, bi_mainbus_attach, NULL, NULL);
581.1Sragge
591.3Smattstatic int
601.10Smattbi_mainbus_match(device_t parent, cfdata_t cf, void *aux)
611.1Sragge{
621.10Smatt	struct mainbus_attach_args * const ma = aux;
631.10Smatt
641.10Smatt	return !strcmp(bi_cd.cd_name, ma->ma_type);
651.1Sragge}
661.1Sragge
671.3Smattstatic void
681.10Smattbi_mainbus_attach(device_t parent, device_t self, void *aux)
691.1Sragge{
701.10Smatt	struct bi_softc * const sc = device_private(self);
711.10Smatt	struct mainbus_attach_args * const ma = aux;
721.1Sragge
731.10Smatt	sc->sc_dev = self;
741.1Sragge	/*
751.1Sragge	 * Fill in bus specific data.
761.1Sragge	 */
771.4Sragge	sc->sc_addr = (bus_addr_t)BI_BASE(0, 0);
781.10Smatt	sc->sc_iot = ma->ma_iot;	/* No special I/O handling */
791.10Smatt	sc->sc_dmat = ma->ma_dmat;	/* No special DMA handling either */
801.4Sragge	sc->sc_intcpu = 1 << mfpr(PR_BINID);
811.4Sragge	sc->sc_lastiv = 256; /* Lowest available vector address */
821.1Sragge
831.1Sragge	bi_attach(sc);
841.1Sragge}
85