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

Annotation of sys/arch/vax/vax/ibus.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: ibus.c,v 1.8 2006/07/20 19:55:20 miod Exp $   */
        !             2: /*     $NetBSD: ibus.c,v 1.7 2001/02/04 20:36:32 ragge Exp $ */
        !             3: /*
        !             4:  * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
        !             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 at Ludd, University of
        !            18:  *     Lule}, Sweden and its contributors.
        !            19:  * 4. The name of the author may not be used to endorse or promote products
        !            20:  *    derived from this software without specific prior written permission
        !            21:  *
        !            22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            25:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            31:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            32:  */
        !            33:
        !            34: #include <sys/param.h>
        !            35: #include <sys/device.h>
        !            36: #include <sys/systm.h>
        !            37:
        !            38: #include <machine/nexus.h>
        !            39: #include <machine/cpu.h>
        !            40: #include <machine/sid.h>
        !            41:
        !            42: static int ibus_print(void *, const char *);
        !            43: static int ibus_match(struct device *, struct cfdata *, void *);
        !            44: static void ibus_attach(struct device *, struct device *, void *);
        !            45:
        !            46: struct cfdriver ibus_cd = {
        !            47:        NULL, "ibus", DV_DULL
        !            48: };
        !            49:
        !            50: struct cfattach ibus_ca = {
        !            51:        sizeof(struct device), (cfmatch_t)ibus_match, ibus_attach
        !            52: };
        !            53:
        !            54: int
        !            55: ibus_print(void *aux, const char *name)
        !            56: {
        !            57:        struct bp_conf *bp = aux;
        !            58:
        !            59:        if (name)
        !            60:                printf("%s at %s", bp->type, name);
        !            61:
        !            62:        return (UNCONF);
        !            63: }
        !            64:
        !            65:
        !            66: int
        !            67: ibus_match(struct device *parent, struct cfdata *cf, void *aux)
        !            68: {
        !            69:        struct mainbus_attach_args *maa = aux;
        !            70:
        !            71:        if (maa->maa_bustype == VAX_IBUS)
        !            72:                return 1;
        !            73:        return 0;
        !            74: }
        !            75:
        !            76: #define        MVNIADDR        0x20084400
        !            77: #define        SGECADDR        0x20008000
        !            78: #define        SHACADDR        0x20004200
        !            79: #define        SHAC1303ADDR    0x20008200
        !            80:
        !            81: void
        !            82: ibus_attach(parent, self, aux)
        !            83:        struct  device  *parent, *self;
        !            84:        void    *aux;
        !            85: {
        !            86:        struct bp_conf bp;
        !            87:        vaddr_t va;
        !            88:
        !            89:        printf("\n");
        !            90:
        !            91:        /*
        !            92:         * There may be a SGEC. Is badaddr() enough here?
        !            93:         */
        !            94:        bp.type = "sgec";
        !            95:        va = vax_map_physmem(SGECADDR, 1);
        !            96:        if (badaddr((caddr_t)va, 4) == 0)
        !            97:                config_found(self, &bp, ibus_print);
        !            98:        vax_unmap_physmem(va, 1);
        !            99:
        !           100:        /*
        !           101:         * There may be a LANCE.
        !           102:         */
        !           103:        bp.type = "lance";
        !           104:        va = vax_map_physmem(MVNIADDR, 1);
        !           105:        if (badaddr((caddr_t)va, 2) == 0)
        !           106:                config_found(self, &bp, ibus_print);
        !           107:        vax_unmap_physmem(va, 1);
        !           108:
        !           109:        /*
        !           110:         * The same procedure for SHAC.
        !           111:         */
        !           112:        bp.type = "shac";
        !           113:        /*
        !           114:         * XXX Clearly the address on Cheetah machines varies between models,
        !           115:         * XXX but I could only check the address on a 4000 105A so far. -- miod
        !           116:         */
        !           117:        if (vax_boardtype == VAX_BTYP_1303 &&
        !           118:            ((vax_siedata >> 8) & 0xFF) != VAX_STYP_53)
        !           119:                va = vax_map_physmem(SHAC1303ADDR, 1);
        !           120:        else
        !           121:                va = vax_map_physmem(SHACADDR, 1);
        !           122:        if (badaddr((caddr_t)va + 0x48, 4) == 0)
        !           123:                config_found(self, &bp, ibus_print);
        !           124:        vax_unmap_physmem(va, 1);
        !           125:
        !           126:        /*
        !           127:         * All MV's have a Qbus.
        !           128:         */
        !           129:        bp.type = "uba";
        !           130:        config_found(self, &bp, ibus_print);
        !           131:
        !           132: }

CVSweb