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

Annotation of sys/arch/vax/vax/ka630.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: ka630.c,v 1.9 2003/06/02 23:27:58 millert Exp $       */
        !             2: /*     $NetBSD: ka630.c,v 1.17 1999/09/06 19:52:52 ragge Exp $ */
        !             3: /*-
        !             4:  * Copyright (c) 1982, 1988, 1990, 1993
        !             5:  *     The Regents of the University of California.  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:  * 3. Neither the name of the University nor the names of its contributors
        !            16:  *    may be used to endorse or promote products derived from this software
        !            17:  *    without specific prior written permission.
        !            18:  *
        !            19:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            20:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            21:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            22:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            25:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            29:  * SUCH DAMAGE.
        !            30:  *
        !            31:  *     @(#)ka630.c     7.8 (Berkeley) 5/9/91
        !            32:  */
        !            33:
        !            34: #include <sys/param.h>
        !            35: #include <sys/types.h>
        !            36: #include <sys/device.h>
        !            37: #include <sys/kernel.h>
        !            38: #include <sys/time.h>
        !            39: #include <sys/systm.h>
        !            40:
        !            41: #include <uvm/uvm_extern.h>
        !            42:
        !            43: #include <machine/cpu.h>
        !            44: #include <machine/pmap.h>
        !            45: #include <machine/ka630.h>
        !            46: #include <machine/clock.h>
        !            47: #include <machine/vsbus.h>
        !            48:
        !            49: static struct uvaxIIcpu *uvaxIIcpu_ptr;
        !            50:
        !            51: static void ka630_conf(void);
        !            52: static void ka630_memerr(void);
        !            53: static int ka630_mchk(caddr_t);
        !            54: static void ka630_halt(void);
        !            55: static void ka630_reboot(int);
        !            56: static void ka630_clrf(void);
        !            57:
        !            58: struct cpu_dep ka630_calls = {
        !            59:        0,
        !            60:        ka630_mchk,
        !            61:        ka630_memerr,
        !            62:        ka630_conf,
        !            63:        chip_clkread,
        !            64:        chip_clkwrite,
        !            65:        1,      /* ~VUPS */
        !            66:        2,      /* SCB pages */
        !            67:        ka630_halt,
        !            68:        ka630_reboot,
        !            69:        ka630_clrf,
        !            70: };
        !            71:
        !            72: /*
        !            73:  * uvaxII_conf() is called by cpu_attach to do the cpu_specific setup.
        !            74:  */
        !            75: void
        !            76: ka630_conf()
        !            77: {
        !            78:        clk_adrshift = 0;       /* Addressed at short's... */
        !            79:        clk_tweak = 0;          /* ...and no shifting */
        !            80:        clk_page = (short *)vax_map_physmem((paddr_t)KA630CLK, 1);
        !            81:
        !            82:        uvaxIIcpu_ptr = (void *)vax_map_physmem(VS_REGS, 1);
        !            83:
        !            84:        /*
        !            85:         * Enable memory parity error detection and clear error bits.
        !            86:         */
        !            87:        uvaxIIcpu_ptr->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR |
        !            88:            UVAXIIMSER_LEB);
        !            89: }
        !            90:
        !            91: /* log crd errors */
        !            92: void
        !            93: ka630_memerr()
        !            94: {
        !            95:        printf("memory err!\n");
        !            96: }
        !            97:
        !            98: #define NMC78032 10
        !            99: char *mc78032[] = {
        !           100:        0,              "immcr (fsd)",  "immcr (ssd)",  "fpu err 0",
        !           101:        "fpu err 7",    "mmu st(tb)",   "mmu st(m=0)",  "pte in p0",
        !           102:        "pte in p1",    "un intr id",
        !           103: };
        !           104:
        !           105: struct mc78032frame {
        !           106:        int     mc63_bcnt;              /* byte count == 0xc */
        !           107:        int     mc63_summary;           /* summary parameter */
        !           108:        int     mc63_mrvaddr;           /* most recent vad */
        !           109:        int     mc63_istate;            /* internal state */
        !           110:        int     mc63_pc;                /* trapped pc */
        !           111:        int     mc63_psl;               /* trapped psl */
        !           112: };
        !           113:
        !           114: int
        !           115: ka630_mchk(cmcf)
        !           116:        caddr_t cmcf;
        !           117: {
        !           118:        register struct mc78032frame *mcf = (struct mc78032frame *)cmcf;
        !           119:        register u_int type = mcf->mc63_summary;
        !           120:
        !           121:        printf("machine check %x", type);
        !           122:        if (type < NMC78032 && mc78032[type])
        !           123:                printf(": %s", mc78032[type]);
        !           124:        printf("\n\tvap %x istate %x pc %x psl %x\n",
        !           125:            mcf->mc63_mrvaddr, mcf->mc63_istate,
        !           126:            mcf->mc63_pc, mcf->mc63_psl);
        !           127:        if (uvaxIIcpu_ptr && uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_MERR) {
        !           128:                printf("\tmser=0x%lx ", uvaxIIcpu_ptr->uvaxII_mser);
        !           129:                if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_CPUE)
        !           130:                        printf("page=%ld", uvaxIIcpu_ptr->uvaxII_cear);
        !           131:                if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_DQPE)
        !           132:                        printf("page=%ld", uvaxIIcpu_ptr->uvaxII_dear);
        !           133:                printf("\n");
        !           134:        }
        !           135:        return (-1);
        !           136: }
        !           137:
        !           138: static void
        !           139: ka630_halt()
        !           140: {
        !           141:        ((struct ka630clock *)clk_page)->cpmbx = KA630CLK_DOTHIS|KA630CLK_HALT;
        !           142:        asm("halt");
        !           143: }
        !           144:
        !           145: static void
        !           146: ka630_reboot(arg)
        !           147:        int arg;
        !           148: {
        !           149:        ((struct ka630clock *)clk_page)->cpmbx =
        !           150:            KA630CLK_DOTHIS | KA630CLK_REBOOT;
        !           151: }
        !           152:
        !           153: /*
        !           154:  * Clear restart and boot in progress flags in the CPMBX.
        !           155:  */
        !           156: static void
        !           157: ka630_clrf()
        !           158: {
        !           159:        short i = ((struct ka630clock *)clk_page)->cpmbx;
        !           160:
        !           161:        ((struct ka630clock *)clk_page)->cpmbx = i & KA630CLK_LANG;
        !           162: }

CVSweb