[BACK]Return to pcib.c CVS log [TXT][DIR] Up to [local] / sys / arch / mvmeppc / pci

Annotation of sys/arch/mvmeppc/pci/pcib.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: pcib.c,v 1.2 2002/03/14 01:26:41 millert Exp $        */
        !             2: /*     $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
        !             3:
        !             4: /*-
        !             5:  * Copyright (c) 1996 The NetBSD Foundation, Inc.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * This code is derived from software contributed to The NetBSD Foundation
        !             9:  * by Jason R. Thorpe.
        !            10:  *
        !            11:  * Redistribution and use in source and binary forms, with or without
        !            12:  * modification, are permitted provided that the following conditions
        !            13:  * are met:
        !            14:  * 1. Redistributions of source code must retain the above copyright
        !            15:  *    notice, this list of conditions and the following disclaimer.
        !            16:  * 2. Redistributions in binary form must reproduce the above copyright
        !            17:  *    notice, this list of conditions and the following disclaimer in the
        !            18:  *    documentation and/or other materials provided with the distribution.
        !            19:  * 3. All advertising materials mentioning features or use of this software
        !            20:  *    must display the following acknowledgement:
        !            21:  *        This product includes software developed by the NetBSD
        !            22:  *        Foundation, Inc. and its contributors.
        !            23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
        !            24:  *    contributors may be used to endorse or promote products derived
        !            25:  *    from this software without specific prior written permission.
        !            26:  *
        !            27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
        !            31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            37:  * POSSIBILITY OF SUCH DAMAGE.
        !            38:  */
        !            39:
        !            40: #include <sys/types.h>
        !            41: #include <sys/param.h>
        !            42: #include <sys/systm.h>
        !            43: #include <sys/device.h>
        !            44:
        !            45: #include <machine/bus.h>
        !            46: #include <dev/isa/isavar.h>
        !            47:
        !            48: #include <dev/pci/pcivar.h>
        !            49: #include <dev/pci/pcireg.h>
        !            50:
        !            51: #include <dev/pci/pcidevs.h>
        !            52: #include <mvmeppc/dev/ravenreg.h>
        !            53:
        !            54: #include "isa.h"
        !            55:
        !            56: int    pcibmatch(struct device *, void *, void *);
        !            57: void   pcibattach(struct device *, struct device *, void *);
        !            58: void   pcib_callback(struct device *);
        !            59: int    pcib_print(void *, const char *);
        !            60:
        !            61: struct ppc_bus_space ppc_isa_io, ppc_isa_mem;
        !            62:
        !            63: struct cfattach pcib_ca = {
        !            64:        sizeof(struct device), pcibmatch, pcibattach
        !            65: };
        !            66:
        !            67: struct cfdriver pcib_cd = {
        !            68:        NULL, "pcib", DV_DULL
        !            69: };
        !            70:
        !            71: int
        !            72: pcibmatch(parent, match, aux)
        !            73:        struct device *parent;
        !            74:        void *match, *aux;
        !            75: {
        !            76:        struct pci_attach_args *pa = aux;
        !            77:
        !            78:        if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
        !            79:            PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA)
        !            80:                return (1);
        !            81:
        !            82:        switch (PCI_VENDOR(pa->pa_id)) {
        !            83:        case PCI_VENDOR_SYMPHONY:
        !            84:                switch (PCI_PRODUCT(pa->pa_id)) {
        !            85:                case PCI_PRODUCT_SYMPHONY_82C565:
        !            86:                        return (1);
        !            87:                }
        !            88:        }
        !            89:
        !            90:        return (0);
        !            91: }
        !            92:
        !            93: void
        !            94: pcibattach(parent, self, aux)
        !            95:        struct device *parent, *self;
        !            96:        void *aux;
        !            97: {
        !            98:
        !            99:        ppc_isa_io = prep_isa_io_space_tag;
        !           100:        ppc_isa_mem = prep_isa_mem_space_tag;
        !           101:
        !           102:        /*
        !           103:         * Cannot attach isa bus now; must postpone for various reasons
        !           104:         */
        !           105:
        !           106:        printf("\n");
        !           107:
        !           108:        config_defer(self, pcib_callback);
        !           109: }
        !           110:
        !           111: void
        !           112: pcib_callback(self)
        !           113:        struct device *self;
        !           114: {
        !           115:        struct isabus_attach_args iba;
        !           116:
        !           117: #if NPCIBIOS > 0
        !           118:        pci_intr_post_fixup();
        !           119: #endif
        !           120:
        !           121:        /*
        !           122:         * Attach the ISA bus behind this bridge.
        !           123:         */
        !           124:        memset(&iba, 0, sizeof(iba));
        !           125:        iba.iba_busname = "isa";
        !           126:        iba.iba_iot = &ppc_isa_io;
        !           127:        iba.iba_memt = &ppc_isa_mem;
        !           128: #if NISADMA > 0
        !           129:        iba.iba_dmat = &isa_bus_dma_tag;
        !           130: #endif
        !           131:        config_found(self, &iba, pcib_print);
        !           132: }
        !           133:
        !           134: int
        !           135: pcib_print(aux, pnp)
        !           136:        void *aux;
        !           137:        const char *pnp;
        !           138: {
        !           139:        /* Only ISAs can attach to pcib's; easy. */
        !           140:        if (pnp)
        !           141:                printf("isa at %s", pnp);
        !           142:        return (UNCONF);
        !           143: }

CVSweb