[BACK]Return to mainbus.c CVS log [TXT][DIR] Up to [local] / sys / arch / landisk / landisk

Annotation of sys/arch/landisk/landisk/mainbus.c, Revision 1.1

1.1     ! nbrk        1: /*     $NetBSD: mainbus.c,v 1.1 2006/09/01 21:26:18 uwe Exp $  */
        !             2:
        !             3: /*-
        !             4:  * Copyright (c) 2002 The NetBSD Foundation, Inc.
        !             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:  * 3. All advertising materials mentioning features or use of this software
        !            16:  *    must display the following acknowledgement:
        !            17:  *        This product includes software developed by the NetBSD
        !            18:  *        Foundation, Inc. and its contributors.
        !            19:  * 4. Neither the name of The NetBSD Foundation nor the names of its
        !            20:  *    contributors may be used to endorse or promote products derived
        !            21:  *    from this software without specific prior written permission.
        !            22:  *
        !            23:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            24:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            25:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            26:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
        !            27:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            28:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            29:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            30:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            31:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            32:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            33:  * POSSIBILITY OF SUCH DAMAGE.
        !            34:  */
        !            35:
        !            36: #include "obio.h"
        !            37: #include "pci.h"
        !            38:
        !            39: #include <sys/param.h>
        !            40: #include <sys/systm.h>
        !            41: #include <sys/device.h>
        !            42:
        !            43: #include <machine/autoconf.h>
        !            44: #include <machine/bus.h>
        !            45:
        !            46: #include <landisk/dev/obiovar.h>
        !            47:
        !            48: int mainbus_match(struct device *, void *, void *);
        !            49: void mainbus_attach(struct device *, struct device *, void *);
        !            50:
        !            51: struct cfattach mainbus_ca = {
        !            52:        sizeof(struct device), mainbus_match, mainbus_attach
        !            53: };
        !            54:
        !            55: struct cfdriver mainbus_cd = {
        !            56:        NULL, "mainbus", DV_DULL
        !            57: };
        !            58:
        !            59: int mainbus_print(void *, const char *);
        !            60:
        !            61: /* There can be only one. */
        !            62: int mainbus_found = 0;
        !            63:
        !            64: int
        !            65: mainbus_match(struct device *parent, void *cf, void *aux)
        !            66: {
        !            67:
        !            68:        if (mainbus_found)
        !            69:                return (0);
        !            70:
        !            71:        return (1);
        !            72: }
        !            73:
        !            74: void
        !            75: mainbus_attach(struct device *parent, struct device *self, void *aux)
        !            76: {
        !            77:        union {
        !            78:                struct mainbus_attach_args mba_mba;
        !            79:                struct confargs mba_ca;
        !            80:                struct obiobus_attach_args mba_oba;
        !            81:        } mba;
        !            82:
        !            83:        mainbus_found = 1;
        !            84:
        !            85:        printf("\n");
        !            86:
        !            87:        /* CPU */
        !            88:        memset(&mba, 0, sizeof(mba));
        !            89:        mba.mba_ca.ca_name = "cpu";
        !            90:        mba.mba_ca.ca_node = 0;
        !            91:        config_found(self, &mba, mainbus_print);
        !            92:
        !            93:        /* SH bus */
        !            94:        memset(&mba, 0, sizeof(mba));
        !            95:        mba.mba_mba.ma_name = "shb";
        !            96:        config_found(self, &mba, mainbus_print);
        !            97:
        !            98: #if NPCI > 0
        !            99:        /* SH PCIC */
        !           100:        memset(&mba, 0, sizeof(mba));
        !           101:        mba.mba_mba.ma_name = "shpcic";
        !           102:        config_found(self, &mba, mainbus_print);
        !           103: #endif
        !           104:
        !           105: #if NOBIO > 0
        !           106:        /* on-board I/O */
        !           107:        memset(&mba, 0, sizeof(mba));
        !           108:        mba.mba_oba.oba_busname = "obio";
        !           109:        mba.mba_oba.oba_iot = &obio_bus_io;
        !           110:        mba.mba_oba.oba_memt = &obio_bus_mem;
        !           111:        config_found(self, &mba, mainbus_print);
        !           112: #endif
        !           113: }
        !           114:
        !           115: int
        !           116: mainbus_print(void *aux, const char *pnp)
        !           117: {
        !           118:
        !           119:        return (pnp ? QUIET : UNCONF);
        !           120: }

CVSweb