ixp12x0_mainbus.c revision 1.5
11.5Sigy/*	$NetBSD: ixp12x0_mainbus.c,v 1.5 2003/03/25 06:53:16 igy Exp $ */
21.1Sichiro/*
31.1Sichiro * Copyright (c) 2002
41.1Sichiro *	Ichiro FUKUHARA <ichiro@ichiro.org>.
51.1Sichiro * All rights reserved.
61.1Sichiro *
71.1Sichiro * Redistribution and use in source and binary forms, with or without
81.1Sichiro * modification, are permitted provided that the following conditions
91.1Sichiro * are met:
101.1Sichiro * 1. Redistributions of source code must retain the above copyright
111.1Sichiro *    notice, this list of conditions and the following disclaimer.
121.1Sichiro * 2. Redistributions in binary form must reproduce the above copyright
131.1Sichiro *    notice, this list of conditions and the following disclaimer in the
141.1Sichiro *    documentation and/or other materials provided with the distribution.
151.1Sichiro * 3. All advertising materials mentioning features or use of this software
161.1Sichiro *    must display the following acknowledgement:
171.1Sichiro *	This product includes software developed by Ichiro FUKUHARA.
181.1Sichiro * 4. The name of the company nor the name of the author may be used to
191.1Sichiro *    endorse or promote products derived from this software without specific
201.1Sichiro *    prior written permission.
211.1Sichiro *
221.1Sichiro * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
231.1Sichiro * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
241.1Sichiro * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
251.1Sichiro * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
261.1Sichiro * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Sichiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Sichiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Sichiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Sichiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Sichiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Sichiro * SUCH DAMAGE.
331.1Sichiro */
341.5Sigy
351.5Sigy#include <sys/cdefs.h>
361.5Sigy__KERNEL_RCSID(0, "$NetBSD: ixp12x0_mainbus.c,v 1.5 2003/03/25 06:53:16 igy Exp $");
371.1Sichiro
381.1Sichiro/*
391.1Sichiro * front-end for the ixp12x0 I/O Processor.
401.1Sichiro */
411.1Sichiro
421.1Sichiro#include <sys/param.h>
431.1Sichiro#include <sys/systm.h>
441.1Sichiro#include <sys/device.h>
451.1Sichiro
461.1Sichiro#include <machine/autoconf.h>
471.1Sichiro#include <machine/bus.h>
481.1Sichiro
491.1Sichiro#include <evbarm/ixm1200/ixm1200reg.h>
501.1Sichiro#include <evbarm/ixm1200/ixm1200var.h>
511.1Sichiro
521.1Sichiro#include <arm/ixp12x0/ixp12x0reg.h>
531.1Sichiro#include <arm/ixp12x0/ixp12x0var.h>
541.1Sichiro
551.1Sichiro#include "locators.h"
561.1Sichiro
571.1Sichirostatic int	ixp12x0_mainbus_match(struct device *, struct cfdata *, void *);
581.1Sichirostatic void	ixp12x0_mainbus_attach(struct device *, struct device *, void *);
591.1Sichiro
601.3SthorpejCFATTACH_DECL(ixpio_mainbus, sizeof(struct ixp12x0_softc),
611.3Sthorpej    ixp12x0_mainbus_match, ixp12x0_mainbus_attach, NULL, NULL);
621.1Sichiro
631.1Sichiroextern struct bus_space ixp12x0_bs_tag;
641.1Sichiro
651.1Sichiroint
661.1Sichiroixp12x0_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
671.1Sichiro{
681.1Sichiro	return (1);
691.1Sichiro}
701.1Sichiro
711.1Sichirovoid
721.1Sichiroixp12x0_mainbus_attach(struct device *parent, struct device *self, void *aux)
731.1Sichiro{
741.1Sichiro	struct ixp12x0_softc *sc = (void *) self;
751.1Sichiro
761.1Sichiro	ixp12x0_bs_init(&ixp12x0_bs_tag, sc);
771.1Sichiro	sc->sc_iot = &ixp12x0_bs_tag;
781.4Sichiro	sc->sc_ioh = IXP12X0_IO_VBASE;
791.1Sichiro
801.1Sichiro	/*
811.1Sichiro	 * Initialize the interrupt part of our PCI chipset tag
821.1Sichiro	 */
831.1Sichiro	ixm1200_pci_init(&sc->ia_pci_chipset, sc);
841.1Sichiro
851.1Sichiro	ixp12x0_attach(sc);
861.1Sichiro}
87