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

Annotation of sys/arch/mvme68k/dev/memc.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: memc.c,v 1.10 2004/07/30 22:29:45 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: #include <machine/cpu.h>
                     46: #include <machine/autoconf.h>
                     47: #include <dev/cons.h>
                     48:
                     49: #include <mvme68k/dev/memcreg.h>
                     50:
                     51: struct memcsoftc {
                     52:        struct device   sc_dev;
                     53:        void *          sc_vaddr;
                     54:        struct memcreg *sc_memc;
                     55:        struct intrhand sc_ih;
                     56: };
                     57:
                     58: void memcattach(struct device *, struct device *, void *);
                     59: int  memcmatch(struct device *, void *, void *);
                     60:
                     61: struct cfattach memc_ca = {
                     62:        sizeof(struct memcsoftc), memcmatch, memcattach
                     63: };
                     64:
                     65: struct cfdriver memc_cd = {
                     66:        NULL, "memc", DV_DULL
                     67: };
                     68:
                     69: int memcintr(struct frame *frame);
                     70:
                     71: int
                     72: memcmatch(parent, vcf, args)
                     73:        struct device *parent;
                     74:        void *vcf, *args;
                     75: {
                     76:        struct confargs *ca = args;
                     77:        struct memcreg *memc = (struct memcreg *)ca->ca_vaddr;
                     78:
                     79:        if (badvaddr((vaddr_t)memc, 1))
                     80:                return (0);
                     81:        if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID)
                     82:                return (1);
                     83:        return (0);
                     84: }
                     85:
                     86: void
                     87: memcattach(parent, self, args)
                     88:        struct device *parent, *self;
                     89:        void *args;
                     90: {
                     91:        struct confargs *ca = args;
                     92:        struct memcsoftc *sc = (struct memcsoftc *)self;
                     93:
                     94:        /*
                     95:         * since we know ourself to land in intiobase land,
                     96:         * we must adjust our address
                     97:         */
                     98:        sc->sc_memc = (struct memcreg *)ca->ca_vaddr;
                     99:
                    100:        printf(": %s rev %d",
                    101:            (sc->sc_memc->memc_chipid == MEMC_CHIPID) ? "MEMC040" : "MCECC",
                    102:            sc->sc_memc->memc_chiprev);
                    103:
                    104: #if 0
                    105:        sc->sc_ih.ih_fn = memcintr;
                    106:        sc->sc_ih.ih_ipl = 7;
                    107:        sc->sc_ih.ih_wantframe = 1;
                    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: int
                    122: memcintr(frame)
                    123:        struct frame *frame;
                    124: {
                    125:        return (0);
                    126: }

CVSweb