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

Annotation of sys/arch/mvme88k/dev/vmel.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: vmel.c,v 1.16 2005/11/25 22:14:32 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: #include <sys/param.h>
                     29: #include <sys/proc.h>
                     30: #include <sys/user.h>
                     31: #include <sys/systm.h>
                     32: #include <sys/kernel.h>
                     33: #include <sys/device.h>
                     34:
                     35: #include <machine/autoconf.h>
                     36: #include <machine/conf.h>
                     37: #include <machine/cpu.h>
                     38:
                     39: #include <mvme88k/dev/vme.h>
                     40:
                     41: /*
                     42:  * The VMEL driver deals with D32 transfers on the VME bus. The number
                     43:  * of address bits (A16, A24, A32) is irrelevant since the mapping
                     44:  * functions will decide how many address bits are relevant.
                     45:  */
                     46:
                     47: void   vmelattach(struct device *, struct device *, void *);
                     48: int    vmelmatch(struct device *, void *, void *);
                     49: int    vmelscan(struct device *, void *, void *);
                     50:
                     51: struct cfattach vmel_ca = {
                     52:         sizeof(struct device), vmelmatch, vmelattach
                     53: };
                     54:
                     55: struct cfdriver vmel_cd = {
                     56:         NULL, "vmel", DV_DULL
                     57: };
                     58:
                     59: int
                     60: vmelmatch(parent, cf, args)
                     61:        struct device *parent;
                     62:        void *cf, *args;
                     63: {
                     64:        return (1);
                     65: }
                     66:
                     67: int
                     68: vmelscan(parent, child, args)
                     69:        struct device *parent;
                     70:        void *child, *args;
                     71: {
                     72:        return (vmescan(parent, child, args, BUS_VMEL));
                     73: }
                     74:
                     75: void
                     76: vmelattach(parent, self, args)
                     77:        struct device *parent, *self;
                     78:        void *args;
                     79: {
                     80:        printf("\n");
                     81:
                     82:        config_search(vmelscan, self, args);
                     83: }
                     84:
                     85: /*ARGSUSED*/
                     86: int
                     87: vmelopen(dev, flag, mode, p)
                     88:        dev_t dev;
                     89:        int flag, mode;
                     90:        struct proc *p;
                     91: {
                     92:        if (minor(dev) >= vmel_cd.cd_ndevs ||
                     93:            vmel_cd.cd_devs[minor(dev)] == NULL)
                     94:                return (ENODEV);
                     95:        return (0);
                     96: }
                     97:
                     98: /*ARGSUSED*/
                     99: int
                    100: vmelclose(dev, flag, mode, p)
                    101:        dev_t dev;
                    102:        int flag, mode;
                    103:        struct proc *p;
                    104: {
                    105:
                    106:        return (0);
                    107: }
                    108:
                    109: /*ARGSUSED*/
                    110: int
                    111: vmelioctl(dev, cmd, data, flag, p)
                    112:        dev_t dev;
                    113:        u_long cmd;
                    114:        caddr_t data;
                    115:        int flag;
                    116:        struct proc *p;
                    117: {
                    118:        int error = 0;
                    119:
                    120:        switch (cmd) {
                    121:        default:
                    122:                error = ENOTTY;
                    123:                break;
                    124:        }
                    125:        return (error);
                    126: }
                    127:
                    128: int
                    129: vmelread(dev, uio, flags)
                    130:        dev_t dev;
                    131:        struct uio *uio;
                    132:        int flags;
                    133: {
                    134:        int unit = minor(dev);
                    135:        struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
                    136:
                    137:        return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
                    138: }
                    139:
                    140: int
                    141: vmelwrite(dev, uio, flags)
                    142:        dev_t dev;
                    143:        struct uio *uio;
                    144:        int flags;
                    145: {
                    146:        int unit = minor(dev);
                    147:        struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
                    148:
                    149:        return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
                    150: }
                    151:
                    152: paddr_t
                    153: vmelmmap(dev, off, prot)
                    154:        dev_t dev;
                    155:        off_t off;
                    156:        int prot;
                    157: {
                    158:        int unit = minor(dev);
                    159:        struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
                    160:        paddr_t pa;
                    161:
                    162:        pa = vmepmap(sc->dv_parent, off, BUS_VMEL);
                    163: #ifdef DEBUG
                    164:        printf("vmel %llx pa %p\n", off, pa);
                    165: #endif
                    166:        if (pa == NULL)
                    167:                return (-1);
                    168:        return (atop(pa));
                    169: }

CVSweb