1 /* 2 * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)ka730.c 7.3 (Berkeley) 12/16/90 7 */ 8 9 #if VAX730 10 11 /* 12 * 730-specific code. 13 */ 14 15 #include "sys/param.h" 16 17 #include "../include/cpu.h" 18 #include "mem.h" 19 #include "../include/mtpr.h" 20 21 struct mcr730 { 22 int mc_addr; /* address and syndrome */ 23 int mc_err; /* error bits */ 24 }; 25 26 #define M730_UNCORR 0x80000000 /* rds, uncorrectable error */ 27 #define M730_CRD 0x40000000 /* crd */ 28 #define M730_FTBPE 0x20000000 /* force tbuf parity error */ 29 #define M730_ENACRD 0x10000000 /* enable crd interrupt */ 30 #define M730_MME 0x08000000 /* mem-man enable (ala ipr) */ 31 #define M730_DM 0x04000000 /* diagnostic mode */ 32 #define M730_DISECC 0x02000000 /* disable ecc */ 33 34 #define M730_INH(mcr) ((mcr)->mc_err = M730_MME) 35 #define M730_ENA(mcr) ((mcr)->mc_err = (M730_MME|M730_ENACRD)) 36 #define M730_ERR(mcr) ((mcr)->mc_err & (M730_UNCORR|M730_CRD)) 37 #define M730_SYN(addr) ((mcr)->mc_addr & 0x7f) 38 #define M730_ADDR(addr) (((mcr)->mc_addr >> 8) & 0x7fff) 39 40 /* enable crd interrupts */ 41 ka730_memenable() 42 { 43 44 M730_ENA((struct mcr730 *)mcraddr[0]); 45 } 46 47 /* log crd errors */ 48 ka730_memerr() 49 { 50 register struct mcr730 *mcr = (struct mcr730 *)mcraddr[0]; 51 struct mcr730 amcr; 52 53 /* 54 * Must be careful on the 730 not to use invalid 55 * instructions in I/O space, so make a copy; 56 */ 57 amcr.mc_addr = mcr->mc_addr; 58 amcr.mc_err = mcr->mc_err; 59 if (M730_ERR(&amcr)) { 60 printf("mcr0: %s", (amcr.mc_err & M730_UNCORR) ? 61 "hard error" : "soft ecc"); 62 printf(" addr %x syn %x\n", M730_ADDR(&amcr), M730_SYN(&amcr)); 63 M730_INH(mcr); 64 } 65 } 66 67 #define NMC730 12 68 char *mc730[] = { 69 "tb par", "bad retry", "bad intr id", "cant write ptem", 70 "unkn mcr err", "iib rd err", "nxm ref", "cp rds", 71 "unalgn ioref", "nonlw ioref", "bad ioaddr", "unalgn ubaddr", 72 }; 73 74 struct mc730frame { 75 int mc3_bcnt; /* byte count == 0xc */ 76 int mc3_summary; /* summary parameter */ 77 int mc3_parm[2]; /* parameter 1 and 2 */ 78 int mc3_pc; /* trapped pc */ 79 int mc3_psl; /* trapped psl */ 80 }; 81 82 ka730_mchk(cmcf) 83 caddr_t cmcf; 84 { 85 register struct mc730frame *mcf = (struct mc730frame *)cmcf; 86 register u_int type = mcf->mc3_summary; 87 88 printf("machine check %x: %s\n", type, 89 type < NMC730 ? mc730[type] : "???"); 90 printf("\tparams %x,%x pc %x psl %x mcesr %x\n", 91 mcf->mc3_parm[0], mcf->mc3_parm[1], 92 mcf->mc3_pc, mcf->mc3_psl, mfpr(MCESR)); 93 mtpr(MCESR, 0xf); 94 return (MCHK_PANIC); 95 } 96 #endif 97