|
|
1.1 ! root 1: /* ! 2: * VAX-11/780 memory controller ! 3: */ ! 4: ! 5: #include "sys/param.h" ! 6: #include "sys/systm.h" ! 7: #include "sys/nxaddr.h" ! 8: ! 9: /* ! 10: * intentional overlays: ! 11: * if no memory controller configured, ! 12: * mcrcnt will be 0 ! 13: * but there will be no undefined symbols ! 14: */ ! 15: ! 16: int mcrcnt; ! 17: struct nxaddr mcraddr[1]; /* one or more */ ! 18: caddr_t mcrregs[1]; /* one or more */ ! 19: time_t mcrtime[1]; /* one or more */ ! 20: ! 21: int mcrtimeout = 60; /* seconds between soft error reports */ ! 22: ! 23: struct device { ! 24: long csra; ! 25: long csrb; ! 26: long csrc; ! 27: }; ! 28: ! 29: /* ! 30: * csrc ! 31: */ ! 32: #define ICRD 0x40000000 /* inhibit soft errors */ ! 33: #define HIERR 0x20000000 /* error lost */ ! 34: #define ERLOG 0x10000000 /* error log request */ ! 35: ! 36: #define SBIER 52 ! 37: #define RDSIE 0x8000 /* memory intr enable */ ! 38: #define ERCRD 0x4000 /* soft error */ ! 39: #define ERRDS 0x2000 /* hard error */ ! 40: ! 41: mcrinit() ! 42: { ! 43: register int i; ! 44: register struct device *m; ! 45: ! 46: for (i = 0; i < mcrcnt; i++) ! 47: if ((m = (struct device *)nxaddr(&mcraddr[i])) == NULL ! 48: || badaddr(&m->csra, sizeof(long))) ! 49: printf("mcr%d absent\n", i); ! 50: else { ! 51: mcrregs[i] = (caddr_t)m; ! 52: mcrenable((caddr_t)m); ! 53: } ! 54: } ! 55: ! 56: /* ! 57: * enable interrupts, clear stale error complaints ! 58: */ ! 59: mcrenable(mm) ! 60: caddr_t mm; ! 61: { ! 62: ((struct device *)mm)->csrc = HIERR|ERLOG; ! 63: mtpr(SBIER, RDSIE|ERCRD|ERRDS); ! 64: } ! 65: ! 66: /* ! 67: * here on: ! 68: * SBI alert ! 69: * corrected read data ! 70: * read data substitute (machine check) ! 71: */ ! 72: memerr() ! 73: { ! 74: register int i; ! 75: register struct device *m; ! 76: long csr[3]; ! 77: register long er; ! 78: ! 79: er = mfpr(SBIER); ! 80: mtpr(SBIER, er); /* clear latches */ ! 81: printf("mem error: sbier %x\n", er); ! 82: if (mcrcnt == 0) { ! 83: printf("no controllers configured\n"); ! 84: return; /* and hope */ ! 85: } ! 86: for (i = 0; i < mcrcnt; i++) { ! 87: if ((m = (struct device *)mcrregs[i]) == NULL) ! 88: continue; ! 89: if (m->csrc & ERLOG) { ! 90: csr[0] = m->csra; ! 91: csr[1] = m->csrb; ! 92: csr[2] = m->csrc; ! 93: m->csrc = m->csrc; /* clear latches */ ! 94: if (mcrtime[i] != time) ! 95: mcrtime[i] = time; ! 96: else { ! 97: m->csrc = ICRD; ! 98: mtpr(SBIER, 0); /* clear RDS enable */ ! 99: timeout(mcrenable, (caddr_t)m, mcrtimeout*HZ); ! 100: } ! 101: printf("mcr%d: %x %x %x\n", i, csr[0], csr[1], csr[2]); ! 102: } ! 103: } ! 104: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.