Annotation of 43BSDReno/sys/vax/ka650.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 The Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * This code is derived from software contributed to Berkeley by
        !             6:  * Mt. Xinu.
        !             7:  *
        !             8:  * Redistribution is only permitted until one year after the first shipment
        !             9:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !            10:  * binary forms are permitted provided that: (1) source distributions retain
        !            11:  * this entire copyright notice and comment, and (2) distributions including
        !            12:  * binaries display the following acknowledgement:  This product includes
        !            13:  * software developed by the University of California, Berkeley and its
        !            14:  * contributors'' in the documentation or other materials provided with the
        !            15:  * distribution and in all advertising materials mentioning features or use
        !            16:  * of this software.  Neither the name of the University nor the names of
        !            17:  * its contributors may be used to endorse or promote products derived from
        !            18:  * this software without specific prior written permission.
        !            19:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            20:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            21:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            22:  *
        !            23:  *     @(#)ka650.c     7.6 (Berkeley) 6/28/90
        !            24:  */
        !            25: 
        !            26: #if VAX650
        !            27: 
        !            28: /*
        !            29:  * vax650-specific code.
        !            30:  */
        !            31: 
        !            32: #include "param.h"
        !            33: #include "time.h"
        !            34: #include "kernel.h"
        !            35: #include "systm.h"
        !            36: 
        !            37: #include "cpu.h"
        !            38: #include "clock.h"
        !            39: #include "psl.h"
        !            40: #include "mem.h"
        !            41: #include "mtpr.h"
        !            42: #include "ka650.h"
        !            43: 
        !            44: 
        !            45: ka650_init()
        !            46: {
        !            47:        ioaccess(KA650_MERR, KA650MERRmap, sizeof(ka650merr));
        !            48:        ioaccess(KA650_CBD, KA650CBDmap, sizeof(ka650cbd));
        !            49:        ioaccess(KA650_SSC, KA650SSCmap, sizeof(ka650ssc));
        !            50:        ioaccess(KA650_IPCR, KA650IPCRmap, sizeof(ka650ipcr));
        !            51:        ioaccess(KA650_CACHE, KA650CACHEmap, KA650_CACHESIZE);
        !            52:        ka650encache();
        !            53:        if (ctob(physmem) > ka650merr.merr_qbmbr) {
        !            54:                printf("physmem(0x%x) > qbmbr(0x%x)\n",
        !            55:                    ctob(physmem), ka650merr.merr_qbmbr);
        !            56:                panic("qbus map unprotected");
        !            57:        }
        !            58: }
        !            59: 
        !            60: ka650_clkstartrt()
        !            61: {
        !            62:        mtpr(ICCS, ICCS_IE);
        !            63: }
        !            64: 
        !            65: ka650_memnop()
        !            66: {
        !            67:        /* void */
        !            68: }
        !            69: 
        !            70: ka650_memerr()
        !            71: {
        !            72:        register char *cp = (char *)0;
        !            73:        register int m;
        !            74:        extern u_int cache2tag;
        !            75: 
        !            76:        if (ka650cbd.cbd_cacr & CACR_CPE) {
        !            77:                printf("cache 2 tag parity error: ");
        !            78:                if (time.tv_sec - cache2tag < 7) {
        !            79:                        ka650discache();
        !            80:                        printf("cacheing disabled\n");
        !            81:                } else {
        !            82:                        cache2tag = time.tv_sec;
        !            83:                        printf("flushing cache\n");
        !            84:                        ka650encache();
        !            85:                }
        !            86:        }
        !            87:        m = ka650merr.merr_errstat;
        !            88:        ka650merr.merr_errstat = MEM_EMASK;
        !            89:        if (m & MEM_CDAL) {
        !            90:                cp = "Bus Parity";
        !            91:        } else if (m & MEM_RDS) {
        !            92:                cp = "Hard ECC";
        !            93:        } else if (m & MEM_CRD) {
        !            94:                cp = "Soft ECC";
        !            95:        }
        !            96:        if (cp) {
        !            97:                printf("%sMemory %s Error: page 0x%x\n",
        !            98:                        (m & MEM_DMA) ? "DMA " : "", cp,
        !            99:                        (m & MEM_PAGE) >> MEM_PAGESHFT);
        !           100:        }
        !           101: }
        !           102: 
        !           103: #define NMC650 15
        !           104: char *mc650[] = {
        !           105:        0,                      "FPA proto err",        "FPA resv inst",
        !           106:        "FPA Ill Stat 2",       "FPA Ill Stat 1",       "PTE in P0, TB miss",
        !           107:        "PTE in P1, TB miss",   "PTE in P0, Mod",       "PTE in P1, Mod",
        !           108:        "Illegal intr IPL",     "MOVC state error",     "bus read error",
        !           109:        "SCB read error",       "bus write error",      "PCB write error"
        !           110: };
        !           111: u_int  cache1tag;
        !           112: u_int  cache1data;
        !           113: u_int  cdalerr;
        !           114: u_int  cache2tag;
        !           115: 
        !           116: struct mc650frame {
        !           117:        int     mc65_bcnt;              /* byte count == 0xc */
        !           118:        int     mc65_summary;           /* summary parameter */
        !           119:        int     mc65_mrvaddr;           /* most recent vad */
        !           120:        int     mc65_istate1;           /* internal state */
        !           121:        int     mc65_istate2;           /* internal state */
        !           122:        int     mc65_pc;                /* trapped pc */
        !           123:        int     mc65_psl;               /* trapped psl */
        !           124: };
        !           125: 
        !           126: ka650_mchk(cmcf)
        !           127:        caddr_t cmcf;
        !           128: {
        !           129:        register struct mc650frame *mcf = (struct mc650frame *)cmcf;
        !           130:        register u_int type = mcf->mc65_summary;
        !           131:        register u_int i;
        !           132: 
        !           133:        printf("machine check %x", type);
        !           134:        if (type >= 0x80 && type <= 0x83)
        !           135:                type -= (0x80 + 11);
        !           136:        if (type < NMC650 && mc650[type])
        !           137:                printf(": %s", mc650[type]);
        !           138:        printf("\n\tvap %x istate1 %x istate2 %x pc %x psl %x\n",
        !           139:            mcf->mc65_mrvaddr, mcf->mc65_istate1, mcf->mc65_istate2,
        !           140:            mcf->mc65_pc, mcf->mc65_psl);
        !           141:        printf("dmaser=0x%b qbear=0x%x dmaear=0x%x\n",
        !           142:            ka650merr.merr_dser, DMASER_BITS, ka650merr.merr_qbear,
        !           143:            ka650merr.merr_dear);
        !           144:        ka650merr.merr_dser = DSER_CLEAR;
        !           145: 
        !           146:        i = mfpr(CAER);
        !           147:        mtpr(CAER, CAER_MCC | CAER_DAT | CAER_TAG);
        !           148:        if (i & CAER_MCC) {
        !           149:                printf("cache 1 ");
        !           150:                if (i & CAER_DAT) {
        !           151:                        printf("data");
        !           152:                        i = cache1data;
        !           153:                        cache1data = time.tv_sec;
        !           154:                }
        !           155:                if (i & CAER_TAG) {
        !           156:                        printf("tag");
        !           157:                        i = cache1tag;
        !           158:                        cache1tag = time.tv_sec;
        !           159:                }
        !           160:        } else if ((i & CAER_MCD) || (ka650merr.merr_errstat & MEM_CDAL)) {
        !           161:                printf("CDAL");
        !           162:                i = cdalerr;
        !           163:                cdalerr = time.tv_sec;
        !           164:        }
        !           165:        if (time.tv_sec - i < 7) {
        !           166:                ka650discache();
        !           167:                printf(" parity error:  cacheing disabled\n");
        !           168:        } else {
        !           169:                printf(" parity error:  flushing cache\n");
        !           170:                ka650encache();
        !           171:        }
        !           172:        /*
        !           173:         * May be able to recover if type is 1-4, 0x80 or 0x81, but
        !           174:         * only if FPD is set in the saved PSL, or bit VCR in Istate2
        !           175:         * is clear.
        !           176:         */
        !           177:        if ((type > 0 && type < 5) || type == 11 || type == 12) {
        !           178:                if ((mcf->mc65_psl & PSL_FPD)
        !           179:                    || !(mcf->mc65_istate2 & IS2_VCR)) {
        !           180:                        ka650_memerr();
        !           181:                        return (MCHK_RECOVERED);
        !           182:                }
        !           183:        }
        !           184:        return (MCHK_PANIC);
        !           185: }
        !           186: 
        !           187: /*
        !           188:  * Make sure both caches are off and not in diagnostic mode.  Clear the
        !           189:  * 2nd level cache (by writing to each quadword entry), then enable it.
        !           190:  * Enable 1st level cache too.
        !           191:  */
        !           192: ka650encache()
        !           193: {
        !           194:        register int i;
        !           195: 
        !           196:        ka650discache();
        !           197:        for (i = 0; i < (KA650_CACHESIZE / sizeof(ka650cache[0])); i += 2)
        !           198:                ka650cache[i] = 0;
        !           199:        ka650cbd.cbd_cacr = CACR_CEN;
        !           200:        mtpr(CADR, CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND);
        !           201: }
        !           202: 
        !           203: ka650discache()
        !           204: {
        !           205:        mtpr(CADR, 0);
        !           206:        ka650cbd.cbd_cacr = CACR_CPE;
        !           207: }
        !           208: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.