Home | History | Annotate | Line # | Download | only in ixm1200
      1 /*	$NetBSD: ixp12x0_mainbus.c,v 1.10 2012/10/27 17:17:48 chs Exp $ */
      2 /*
      3  * Copyright (c) 2002
      4  *	Ichiro FUKUHARA <ichiro (at) ichiro.org>.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
     20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #include <sys/cdefs.h>
     30 __KERNEL_RCSID(0, "$NetBSD: ixp12x0_mainbus.c,v 1.10 2012/10/27 17:17:48 chs Exp $");
     31 
     32 /*
     33  * front-end for the ixp12x0 I/O Processor.
     34  */
     35 
     36 #include <sys/param.h>
     37 #include <sys/systm.h>
     38 #include <sys/device.h>
     39 
     40 #include <machine/autoconf.h>
     41 #include <sys/bus.h>
     42 
     43 #include <evbarm/ixm1200/ixm1200reg.h>
     44 #include <evbarm/ixm1200/ixm1200var.h>
     45 
     46 #include <arm/ixp12x0/ixp12x0reg.h>
     47 #include <arm/ixp12x0/ixp12x0var.h>
     48 
     49 #include "locators.h"
     50 
     51 static int	ixp12x0_mainbus_match(device_t, cfdata_t, void *);
     52 static void	ixp12x0_mainbus_attach(device_t, device_t, void *);
     53 
     54 CFATTACH_DECL_NEW(ixpio_mainbus, sizeof(struct ixp12x0_softc),
     55     ixp12x0_mainbus_match, ixp12x0_mainbus_attach, NULL, NULL);
     56 
     57 extern struct bus_space ixp12x0_bs_tag;
     58 
     59 int
     60 ixp12x0_mainbus_match(device_t parent, cfdata_t cf, void *aux)
     61 {
     62 	return (1);
     63 }
     64 
     65 void
     66 ixp12x0_mainbus_attach(device_t parent, device_t self, void *aux)
     67 {
     68 	struct ixp12x0_softc *sc = device_private(self);
     69 
     70 	sc->sc_dev = self;
     71 
     72 	/*
     73 	 * Initialize the interrupt part of our PCI chipset tag
     74 	 */
     75 	ixm1200_pci_init(&sc->ia_pci_chipset, sc);
     76 
     77 	ixp12x0_attach(sc);
     78 }
     79