|
|
1.1 ! root 1: /* ! 2: * memory controller support for nautilus ! 3: * ! 4: * an interpretation of the VMS code ! 5: */ ! 6: ! 7: #include "sys/param.h" ! 8: #include "sys/systm.h" ! 9: ! 10: extern long *mcrcsr; /* virt addr of mem csrs; filled in when spt built */ ! 11: ! 12: /* ! 13: * mem csrs have no names, just numbers 0-7 ! 14: * 0-3 have control and status bits ! 15: * 4-7 are just magic places to read: ! 16: * csr4 clears memory interrupt ! 17: * csr5 clears memory (and nmi) fault ! 18: */ ! 19: ! 20: /* ! 21: * csr0 ! 22: */ ! 23: ! 24: #define TOCODE 0x7000000 /* timeout code */ ! 25: #define ILTO 0x2000000 /* interlock timeout */ ! 26: ! 27: /* ! 28: * csr1 ! 29: */ ! 30: ! 31: #define WENABLE 0x100000 /* decode ram write enable -- make sure off */ ! 32: ! 33: /* ! 34: * csr2 ! 35: */ ! 36: ! 37: #define RDSHER 0x80000000 /* rds thick and fast */ ! 38: #define RDS 0x40000000 /* read data substitute (hard error) */ ! 39: #define CRD 0x20000000 /* corrected read data (soft error) */ ! 40: #define RDFORCE 0x10000000 /* RDS really NMI bus error */ ! 41: ! 42: /* ! 43: * csr3 ! 44: */ ! 45: ! 46: #define IEINTERR 0x80000000 /* internal error intr enab */ ! 47: #define IEILERR 0x40000000 /* interlock error ie */ ! 48: #define IECRD 0x20000000 /* soft error ie */ ! 49: #define IERDS 0x10000000 /* hard error ie */ ! 50: #define INTERR 0x2000000 /* internal error */ ! 51: ! 52: #define IE (IEINTERR|IEILERR|IECRD|IERDS) ! 53: ! 54: /* ! 55: * init the memory controller: ! 56: * enable interrupts ! 57: */ ! 58: ! 59: mcrinit() ! 60: { ! 61: register long junk; ! 62: register long *m; ! 63: ! 64: if ((m = mcrcsr) == 0) ! 65: panic("mcrinit"); ! 66: mcrclr(); ! 67: m[3] = IE; ! 68: } ! 69: ! 70: /* ! 71: * here on memory interrupt ! 72: * guess whether it's an error ! 73: */ ! 74: ! 75: mcrint() ! 76: { ! 77: register long *m; ! 78: ! 79: if ((m = mcrcsr) == 0) ! 80: return; ! 81: /* cknofault? */ ! 82: mcrerr(); ! 83: } ! 84: ! 85: /* ! 86: * memory error, because controller interrupted or otherwise ! 87: */ ! 88: static int crdoff; ! 89: int mcrreenb(); ! 90: ! 91: mcrerr() ! 92: { ! 93: register long *m; ! 94: register long csr0, csr1, csr2, csr3; ! 95: register long xcsr1; /* eventually toss out */ ! 96: register int hard; ! 97: static time_t lastcrd; ! 98: ! 99: if ((m = mcrcsr) == 0) ! 100: return; /* hopeless */ ! 101: csr0 = m[0]; ! 102: xcsr1 = m[1]; ! 103: m[1] = xcsr1 & ~WENABLE; ! 104: csr1 = m[1]; ! 105: csr2 = m[2]; ! 106: csr3 = m[3]; ! 107: mcrclr(); ! 108: hard = 0; ! 109: if (csr3 & INTERR) ! 110: hard++; ! 111: if ((csr0 & TOCODE) == ILTO) ! 112: hard++; ! 113: if (csr2 & (RDS|RDFORCE)) ! 114: hard++; ! 115: printf("mem %s err: %x %x %x %x (%x)\n", hard ? "hard" : "soft", ! 116: csr0, csr1, csr2, csr3, xcsr1); ! 117: if (hard) ! 118: panic("mcrerr"); ! 119: if (lastcrd && lastcrd + 5 < time) { ! 120: if (crdoff++ == 0) ! 121: timeout(mcrreenb, (caddr_t)0, 15*HZ); ! 122: m[3] = (IE &~ IECRD); ! 123: } ! 124: else ! 125: lastcrd = time; ! 126: } ! 127: ! 128: mcrreenb(x) ! 129: caddr_t x; ! 130: { ! 131: crdoff = 0; ! 132: mcrcsr[3] = IE; ! 133: } ! 134: ! 135: mcrclr() ! 136: { ! 137: register long junk; ! 138: register long *m; ! 139: ! 140: if ((m = mcrcsr) == 0) ! 141: return; ! 142: junk = m[4]; ! 143: junk = m[5]; ! 144: m[0] = m[0]|TOCODE; ! 145: m[1] = m[1]; ! 146: m[2] = m[2]; ! 147: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.