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

Annotation of sys/arch/vax/if/if_ze.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: if_ze.c,v 1.7 2006/08/30 19:28:11 miod Exp $  */
        !             2: /*      $NetBSD: if_ze.c,v 1.3 2000/01/24 02:54:03 matt Exp $ */
        !             3: /*
        !             4:  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
        !             5:  *
        !             6:  * Redistribution and use in source and binary forms, with or without
        !             7:  * modification, are permitted provided that the following conditions
        !             8:  * are met:
        !             9:  * 1. Redistributions of source code must retain the above copyright
        !            10:  *    notice, this list of conditions and the following disclaimer.
        !            11:  * 2. Redistributions in binary form must reproduce the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer in the
        !            13:  *    documentation and/or other materials provided with the distribution.
        !            14:  * 3. All advertising materials mentioning features or use of this software
        !            15:  *    must display the following acknowledgement:
        !            16:  *      This product includes software developed at Ludd, University of
        !            17:  *      Lule}, Sweden and its contributors.
        !            18:  * 4. The name of the author may not be used to endorse or promote products
        !            19:  *    derived from this software without specific prior written permission
        !            20:  *
        !            21:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            22:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            23:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            24:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            25:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            26:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            27:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            28:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            29:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            30:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            31:  */
        !            32:
        !            33: #include <sys/param.h>
        !            34: #include <sys/socket.h>
        !            35: #include <sys/device.h>
        !            36: #include <sys/systm.h>
        !            37: #include <sys/sockio.h>
        !            38:
        !            39: #include <net/if.h>
        !            40: #include <net/if_dl.h>
        !            41: #include <netinet/in.h>
        !            42: #include <netinet/if_ether.h>
        !            43:
        !            44: #if NBPFILTER > 0
        !            45: #include <net/bpf.h>
        !            46: #include <net/bpfdesc.h>
        !            47: #endif
        !            48:
        !            49: #include <machine/bus.h>
        !            50: #include <machine/nexus.h>
        !            51: #include <machine/cpu.h>
        !            52: #include <machine/scb.h>
        !            53: #include <machine/sid.h>
        !            54:
        !            55: #include <arch/vax/if/sgecreg.h>
        !            56: #include <arch/vax/if/sgecvar.h>
        !            57:
        !            58: /*
        !            59:  * Addresses.
        !            60:  */
        !            61: #define SGECADDR        0x20008000
        !            62: #define NISA_ROM        0x20084000
        !            63: #define        SGECVEC         0x108
        !            64:
        !            65: static int     zematch(struct device *, struct cfdata *, void *);
        !            66: static void    zeattach(struct device *, struct device *, void *);
        !            67:
        !            68: struct cfattach ze_ibus_ca = {
        !            69:        sizeof(struct ze_softc), (cfmatch_t)zematch, zeattach
        !            70: };
        !            71:
        !            72: /*
        !            73:  * Check for present SGEC.
        !            74:  */
        !            75: int
        !            76: zematch(parent, cf, aux)
        !            77:        struct  device *parent;
        !            78:        struct  cfdata *cf;
        !            79:        void    *aux;
        !            80: {
        !            81:        struct bp_conf *bp = aux;
        !            82:
        !            83:        /*
        !            84:         * Should some more intelligent checking be done???
        !            85:         */
        !            86:        if (strcmp(bp->type, "sgec") == 0)
        !            87:                return 1;
        !            88:        return 0;
        !            89: }
        !            90:
        !            91: /*
        !            92:  * Interface exists: make available by filling in network interface
        !            93:  * record.  System will initialize the interface when it is ready
        !            94:  * to accept packets.
        !            95:  */
        !            96: void
        !            97: zeattach(parent, self, aux)
        !            98:        struct  device *parent, *self;
        !            99:        void    *aux;
        !           100: {
        !           101:        extern struct vax_bus_dma_tag vax_bus_dma_tag;
        !           102:        struct  ze_softc *sc = (struct ze_softc *)self;
        !           103:        int *ea, i;
        !           104:
        !           105:        /*
        !           106:         * Map in SGEC registers.
        !           107:         */
        !           108:        sc->sc_ioh = vax_map_physmem(SGECADDR, 1);
        !           109:        sc->sc_iot = 0; /* :-) */
        !           110:        sc->sc_dmat = &vax_bus_dma_tag;
        !           111:
        !           112:        sc->sc_intvec = SGECVEC;
        !           113:
        !           114:        /*
        !           115:         * Map in, read and release ethernet rom address.
        !           116:         */
        !           117:        ea = (int *)vax_map_physmem(NISA_ROM, 1);
        !           118:        for (i = 0; i < ETHER_ADDR_LEN; i++)
        !           119:                if (vax_boardtype == VAX_BTYP_660)
        !           120:                        sc->sc_ac.ac_enaddr[i] = (ea[i] >> 24) & 0377;
        !           121:                else
        !           122:                        sc->sc_ac.ac_enaddr[i] = (ea[i] >> 8) & 0377;
        !           123:
        !           124:        vax_unmap_physmem((vaddr_t)ea, 1);
        !           125:
        !           126:        scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc,
        !           127:            SCB_ISTACK, &sc->sc_intrcnt);
        !           128:        evcount_attach(&sc->sc_intrcnt, sc->sc_dev.dv_xname,
        !           129:            (void *)&sc->sc_intvec, &evcount_intr);
        !           130:
        !           131:        sgec_attach(sc);
        !           132: }

CVSweb