[BACK]Return to memc.c CVS log [TXT][DIR] Up to [local] / sys / arch / mvme88k / dev

Annotation of sys/arch/mvme88k/dev/memc.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: memc.c,v 1.13 2006/11/16 23:21:56 miod Exp $ */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 1995 Theo de Raadt
        !             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 THE AUTHOR ``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 THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            20:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            21:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            22:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            23:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            24:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            25:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            26:  */
        !            27:
        !            28: /*
        !            29:  * MEMC/MCECC chips
        !            30:  * these chips are rather similar in appearance except that the MEMC
        !            31:  * does parity while the MCECC does ECC.
        !            32:  */
        !            33: #include <sys/param.h>
        !            34: #include <sys/conf.h>
        !            35: #include <sys/ioctl.h>
        !            36: #include <sys/proc.h>
        !            37: #include <sys/user.h>
        !            38: #include <sys/tty.h>
        !            39: #include <sys/uio.h>
        !            40: #include <sys/systm.h>
        !            41: #include <sys/kernel.h>
        !            42: #include <sys/syslog.h>
        !            43: #include <sys/fcntl.h>
        !            44: #include <sys/device.h>
        !            45:
        !            46: #include <machine/autoconf.h>
        !            47: #include <machine/cpu.h>
        !            48:
        !            49: #include <dev/cons.h>
        !            50:
        !            51: #include <mvme88k/dev/memcreg.h>
        !            52:
        !            53: struct memcsoftc {
        !            54:        struct device   sc_dev;
        !            55:        struct memcreg *sc_memc;
        !            56:        struct intrhand sc_ih;
        !            57: };
        !            58:
        !            59: void memcattach(struct device *, struct device *, void *);
        !            60: int  memcmatch(struct device *, void *, void *);
        !            61:
        !            62: struct cfattach memc_ca = {
        !            63:        sizeof(struct memcsoftc), memcmatch, memcattach
        !            64: };
        !            65:
        !            66: struct cfdriver memc_cd = {
        !            67:        NULL, "memc", DV_DULL
        !            68: };
        !            69:
        !            70: #if 0
        !            71: int memcintr(void *);
        !            72: #endif
        !            73:
        !            74: int
        !            75: memcmatch(parent, vcf, args)
        !            76:        struct device *parent;
        !            77:        void *vcf, *args;
        !            78: {
        !            79:        struct confargs *ca = args;
        !            80:        struct memcreg *memc = (struct memcreg *)ca->ca_paddr;
        !            81:
        !            82:        if (badaddr((vaddr_t)memc, 4))
        !            83:                return (0);
        !            84:        if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID)
        !            85:                return (1);
        !            86:        return (0);
        !            87: }
        !            88:
        !            89: void
        !            90: memcattach(parent, self, args)
        !            91:        struct device *parent, *self;
        !            92:        void *args;
        !            93: {
        !            94:        struct confargs *ca = args;
        !            95:        struct memcsoftc *sc = (struct memcsoftc *)self;
        !            96:
        !            97:        sc->sc_memc = (struct memcreg *)ca->ca_paddr;
        !            98:
        !            99:        printf(": %s rev %d",
        !           100:            (sc->sc_memc->memc_chipid == MEMC_CHIPID) ? "MEMC040" : "MCECC",
        !           101:            sc->sc_memc->memc_chiprev);
        !           102:
        !           103: #if 0
        !           104:        sc->sc_ih.ih_fn = memcintr;
        !           105:        sc->sc_ih.ih_arg = 0;
        !           106:        sc->sc_ih.ih_wantframe = 1;
        !           107:        sc->sc_ih.ih_ipl = 7;
        !           108:        mcintr_establish(xxx, &sc->sc_ih, self->dv_xname);
        !           109: #endif
        !           110:
        !           111:        switch (sc->sc_memc->memc_chipid) {
        !           112:        case MEMC_CHIPID:
        !           113:                break;
        !           114:        case MCECC_CHIPID:
        !           115:                break;
        !           116:        }
        !           117:
        !           118:        printf("\n");
        !           119: }
        !           120:
        !           121: #if 0
        !           122: int
        !           123: memcintr(eframe)
        !           124:        void *eframe;
        !           125: {
        !           126:        return (0);
        !           127: }
        !           128: #endif

CVSweb