|
|
1.1 ! root 1: /* ! 2: This test Ecc Memory bits Test ! 3: */ ! 4: #include "definitions" ! 5: #define BEVEC 128 /* offset in scb block for Bus error*/ ! 6: #define ecczero 0x00000028 ! 7: #define eccone 0x0000012d ! 8: #define MEMUNIT 64 * 1024 ! 9: #include "test4.h" ! 10: ! 11: extern struct OPTIONS OPTIONS; ! 12: extern long maxmem,endprog,scb; ! 13: extern long eccloc(), cycle,test_no,errcnt; ! 14: extern long loop_flg,hlt_flg,prt_flg; ! 15: extern long ber1, ber2, ber3; ! 16: long abmax; ! 17: long exp_ecc[32] = { ! 18: 0x4f,0x4a,0x52,0x54,0x57,0x58,0x5b,0x5d, ! 19: 0x62,0x64,0x67,0x68,0x6b,0x6d,0x70,0x75, ! 20: 0x0e,0x0b,0x13,0x15,0x16,0x19,0x1a,0x1c, ! 21: 0x23,0x25,0x26,0x29,0x2a,0x2c,0x31,0x34 ! 22: }; ! 23: ! 24: subtest5() ! 25: { ! 26: register long *mcr = (long *)0xffffb000; ! 27: register long *mcbr = (long *)0xffffb008; ! 28: register long *addr, bit, ckbits, delay; ! 29: long oldstatus, data, code, wcnt, cnt, actual, eccloc(); ! 30: char *msg; ! 31: ! 32: if (OPTIONS.header) ! 33: writes("\n** Subtest5 : ECC single (data) bit error detection."); ! 34: oldstatus = *mcr; /* save old status */ ! 35: ! 36: ckbits = 0xc; /* Check bits for data 0 */ ! 37: addr = (long *)abmax - 102400; /* Only check the last 100k */ ! 38: for(wcnt=0;addr <= (long *)abmax;addr++, wcnt++) ! 39: { ! 40: again: ! 41: /* Write data and known good check bits pattern */ ! 42: data = 0; /* Test data pattern */ ! 43: *mcbr = ckbits; /* Check bits of data 0 */ ! 44: *mcr = 0xc4; /* Turn ON diag_write */ ! 45: delay = *mcr; ! 46: *addr = data; /* Write Data with check */ ! 47: /* bits taken from MCBR */ ! 48: *mcr = 0; /* Turn OFF Diag_write */ ! 49: delay = *mcr; ! 50: code = eccloc(addr); /* Read back data */ ! 51: if ((code == -1) && prt_flg) { /* Got an unexpected DCE */ ! 52: *mcr = 0xc0; /* Turn OFF ECC, clear err. */ ! 53: writes("\nUnexpected DCE.<Diag_wr failed>"); ! 54: writes("\nAddress : ");writeh(addr); ! 55: writes("\nLword count : "); writed(wcnt); ! 56: wr_mibreg(); ! 57: if (loop_flg) goto again; ! 58: else if (hlt_flg) Halt(); ! 59: else continue; ! 60: } ! 61: if ((code == -2) && prt_flg) { ! 62: *mcr = 0; /* Turn OFF ECC logic */ ! 63: writes("\nUnexpected Buser."); ! 64: wr_mibreg(); ! 65: if (loop_flg) goto again; ! 66: else if (hlt_flg) Halt(); ! 67: else continue; ! 68: } ! 69: actual = *addr; /* Read data back to check */ ! 70: if ((actual != data) && prt_flg) { ! 71: writes("\nDiag_wr failed. Wrong data read back."); ! 72: writes("\nExpected "); writeh(data); ! 73: writes(", Actual "); writeh(actual); ! 74: if (loop_flg) goto again; ! 75: else if (hlt_flg) Halt(); ! 76: else continue; ! 77: } ! 78: for(bit=1,cnt=0;cnt<32; bit <<= 1, cnt++) { ! 79: repeat: ! 80: /* Write data and known good check bits pattern */ ! 81: data = 0; /* Test data pattern */ ! 82: data |= bit; /* Change 1 bit in data pattern */ ! 83: *mcbr = ckbits; /* Check bits of data 0 */ ! 84: *mcr = 0xc4; /* Turn ON diag_write */ ! 85: delay = *mcr; ! 86: *addr = data; /* Write Bad data back */ ! 87: *mcr = 0; /* Turn OFF Diag_write */ ! 88: delay = *mcr; ! 89: code = eccloc(addr); /* Read back data */ ! 90: if ((!code) && prt_flg) { /* Didnot detect bad data */ ! 91: writes("\nECC failed to detect bad data."); ! 92: writes("\n\tAddress : "); ! 93: writeh(addr); ! 94: writes("\n\tData written : "); ! 95: writeh(data); ! 96: writes("\n\tCheck bits written to MCBR : "); ! 97: writeh(ckbits); ! 98: writes("\n\tData read : "); ! 99: writeh(ber2); ! 100: writes("\n\tMCR after the Read : "); ! 101: writeh(ber1); ! 102: writes("\n\tMCBR after the Read : "); ! 103: writeh(ber3); ! 104: writes("\n"); ! 105: if (loop_flg) goto repeat; ! 106: else if (hlt_flg) Halt(); ! 107: else continue; ! 108: } ! 109: if ((code == -2) && prt_flg) { ! 110: writes("\nUnexpected Buser"); ! 111: wr_mibreg(); ! 112: if (loop_flg) goto repeat; ! 113: else if (hlt_flg) Halt(); ! 114: else continue; ! 115: } ! 116: /* Got the expected DCE, now check syndrome bits */ ! 117: actual = (tmp_mcbr >> 23) & 0x7f; ! 118: if ((actual != exp_ecc[cnt]) && prt_flg ) { ! 119: *mcr = 0xc0; /* Turn OFF ECC, clear err.*/ ! 120: msg = "\nSyndrome Bits error."; ! 121: writes("\n\tMCBR : "); writeh(ber1); ! 122: error4(msg,addr,exp_ecc[bit-1],actual); ! 123: writes("\n\t Data written : "); ! 124: writeh(data); ! 125: writes("\n\t Check bits written in MCBR : "); ! 126: writeh(ckbits); ! 127: writes("\nNumber Lwords passed "); ! 128: writed(wcnt); writes("\n"); ! 129: if (loop_flg) goto repeat; ! 130: else if (hlt_flg) Halt(); ! 131: } ! 132: } ! 133: } ! 134: *mcr = oldstatus; /* old status */ ! 135: } ! 136:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.