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

Annotation of sys/arch/hppa64/dev/pluto.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: pluto.c,v 1.2 2005/05/22 01:38:09 mickey Exp $        */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 2005 Michael Shalayeff
        !             5:  * All rights reserved.
        !             6:  *
        !             7:  * Permission to use, copy, modify, and distribute this software for any
        !             8:  * purpose with or without fee is hereby granted, provided that the above
        !             9:  * copyright notice and this permission notice appear in all copies.
        !            10:  *
        !            11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            15:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
        !            16:  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
        !            17:  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            18:  */
        !            19:
        !            20: /* TODO IOA programming */
        !            21:
        !            22: #include <sys/param.h>
        !            23: #include <sys/systm.h>
        !            24: #include <sys/device.h>
        !            25: #include <sys/reboot.h>
        !            26:
        !            27: #include <machine/iomod.h>
        !            28: #include <machine/autoconf.h>
        !            29: #include <machine/bus.h>
        !            30:
        !            31: #include <arch/hppa/dev/cpudevs.h>
        !            32:
        !            33: struct pluto_regs {
        !            34:        u_int32_t       version;        /* 0x000: version */
        !            35:        u_int32_t       pad00;
        !            36:        u_int32_t       ctrl;           /* 0x008: control register */
        !            37: #define        PLUTO_CTRL_TOC  0x0001  /* enable toc */
        !            38: #define        PLUTO_CTRL_COE  0x0002  /* enable coalescing */
        !            39: #define        PLUTO_CTRL_DIE  0x0004  /* enable dillon */
        !            40: #define        PLUTO_CTRL_RM   0x0010  /* real mode */
        !            41: #define        PLUTO_CTRL_NCO  0x0020  /* non-coherent mode */
        !            42:        u_int32_t       pad08;
        !            43:        u_int32_t       resv0[(0x200-0x10)/4];
        !            44:        u_int64_t       rope0;          /* 0x200: */
        !            45:        u_int64_t       rope1;
        !            46:        u_int64_t       rope2;
        !            47:        u_int64_t       rope3;
        !            48:        u_int64_t       rope4;
        !            49:        u_int64_t       rope5;
        !            50:        u_int64_t       rope6;
        !            51:        u_int64_t       rope7;
        !            52:        u_int32_t       resv1[(0x100-0x40)/4];
        !            53:        u_int64_t       ibase;
        !            54:        u_int64_t       imask;
        !            55:        u_int64_t       pcom;
        !            56:        u_int64_t       tconf;
        !            57:        u_int64_t       pdir;
        !            58: } __packed;
        !            59:
        !            60: struct pluto_softc {
        !            61:        struct device sc_dv;
        !            62:
        !            63:        volatile struct pluto_regs *sc_regs;
        !            64:        struct confargs sc_ca;
        !            65: };
        !            66:
        !            67: int    plutomatch(struct device *, void *, void *);
        !            68: void   plutoattach(struct device *, struct device *, void *);
        !            69:
        !            70: struct cfattach plut_ca = {
        !            71:        sizeof(struct pluto_softc), plutomatch, plutoattach
        !            72: };
        !            73:
        !            74: void   pluto_scan(struct device *self);
        !            75:
        !            76: struct cfdriver plut_cd = {
        !            77:        NULL, "plut", DV_DULL
        !            78: };
        !            79:
        !            80: int
        !            81: plutomatch(parent, cfdata, aux)
        !            82:        struct device *parent;
        !            83:        void *cfdata;
        !            84:        void *aux;
        !            85: {
        !            86:        struct confargs *ca = aux;
        !            87:        /* struct cfdata *cf = cfdata; */
        !            88:
        !            89:        if ((ca->ca_name && !strcmp(ca->ca_name, "sba")) ||
        !            90:            (ca->ca_type.iodc_type == HPPA_TYPE_IOA &&
        !            91:             ca->ca_type.iodc_sv_model == HPPA_IOA_PLUTO) ||
        !            92:            (ca->ca_type.iodc_type == HPPA_TYPE_IOA &&
        !            93:             ca->ca_type.iodc_sv_model == HPPA_IOA_UTURN &&
        !            94:             ca->ca_type.iodc_model == 0x58 &&
        !            95:             ca->ca_type.iodc_revision >= 0x20))
        !            96:                return 1;
        !            97:
        !            98:        return 0;
        !            99: }
        !           100:
        !           101: void
        !           102: plutoattach(parent, self, aux)
        !           103:        struct device *parent;
        !           104:        struct device *self;
        !           105:        void *aux;
        !           106: {
        !           107:        struct confargs *ca = aux;
        !           108:        struct pluto_softc *sc = (struct pluto_softc *)self;
        !           109:        struct pluto_regs volatile *r;
        !           110:        bus_space_handle_t ioh;
        !           111:        u_int32_t ver;
        !           112:        char buf[16];
        !           113:
        !           114:        if (bus_space_map(ca->ca_iot, ca->ca_hpa, ca->ca_hpasz, 0, &ioh)) {
        !           115:                printf(": can't map IO space\n");
        !           116:                return;
        !           117:        }
        !           118:        sc->sc_regs = r = (void *)bus_space_vaddr(ca->ca_iot, ioh);
        !           119:
        !           120:        /* r->ctrl = PLUTO_CTRL_RM|PLUTO_CTRL_TOC; */
        !           121:
        !           122:        ver = letoh32(r->version);
        !           123:        switch ((ca->ca_type.iodc_model << 4) |
        !           124:            (ca->ca_type.iodc_revision >> 4)) {
        !           125:        case 0x582:
        !           126:        case 0x780:
        !           127:                snprintf(buf, sizeof(buf), "Astro rev %d.%d",
        !           128:                    (ver & 7) + 1, (ver >> 3) & 3);
        !           129:                break;
        !           130:
        !           131:        case 0x803:
        !           132:        case 0x781:
        !           133:                snprintf(buf, sizeof(buf), "Ike rev %d", ver & 0xff);
        !           134:                break;
        !           135:
        !           136:        case 0x804:
        !           137:        case 0x782:
        !           138:                snprintf(buf, sizeof(buf), "Reo rev %d", ver & 0xff);
        !           139:                break;
        !           140:
        !           141:        case 0x880:
        !           142:        case 0x784:
        !           143:                snprintf(buf, sizeof(buf), "Pluto rev %d.%d",
        !           144:                    (ver >> 4) & 0xf, ver & 0xf);
        !           145:                break;
        !           146:
        !           147:        default:
        !           148:                snprintf(buf, sizeof(buf), "Fluffy rev 0x%x", ver);
        !           149:                break;
        !           150:        }
        !           151:
        !           152:        printf(": %s\n", buf);
        !           153:
        !           154:        sc->sc_ca = *ca;        /* clone from us */
        !           155:        config_defer(self, &pluto_scan);
        !           156: }
        !           157:
        !           158: void
        !           159: pluto_scan(struct device *self)
        !           160: {
        !           161:        struct pluto_softc *sc = (struct pluto_softc *)self;
        !           162:
        !           163:        pdc_scan(self, &sc->sc_ca);
        !           164: }

CVSweb