|
|
1.1 root 1: 1.1.1.2 ! root 2: /* init.s Memory Test memtst. */ ! 3: /* */ ! 4: /* Memtst Revision History */ ! 5: /* V1.1 ? ? First original version */ ! 6: /* R1.2 22-APR-86 rfw Updated for a 20 MB "mixed" config of 4 4Mb boards 0-3 */ ! 7: /* and 4 1Mb boards 4-7. */ ! 8: /* Fixed user interface: (1) deleted redundant code to */ ! 9: /* query user again for test no and cycle count in diag */ ! 10: /* mode, (2) added a test number input validity check to */ ! 11: /* prevent random runs and infinite loop on invalid input*/ ! 12: /* Modules updated: monitor.c, locate.c, definitions. */ ! 13: /* */ 1.1 root 14: /* This file is a diagnostic version of locore.s. */ 15: /* It contains the following: */ 16: /* *system data area = scb, dump buffer, interrupt stack, */ 17: /* *system page table,user page tables,pcbs,iomap, & io buffers. */ 18: /* */ 19: /* *system code = interrupt vectors, initialization of system data,*/ 20: /* *memory size calculation,initialization of SPT, zeroing of */ 21: /* *unused memory, & loading of SBR & SLR. */ 22: /* * */ 23: /* *at the end of this code, you are ready to go to virtual mode. */ 24: /* * --- GOOD LUCK! */ 25: 26: 27: /* privileged registers addresses */ 28: #include "prvreg.h" 29: 30: /* program status long word definition */ 31: #include "psl.h" 32: 33: /* page table entry definition */ 34: #include "pte.h" 35: 36: /* process control block offsets */ 37: #include "pcboffset.h" 38: 39: /* fundamental constants for globl use */ 40: #include "const.h" 41: 42: /* system control block offsets*/ 43: #include "scboffset.h" 44: /* SPT offsets */ 45: #include "sptoffset.h" 46: 47: /* trap numbers*/ 48: #include "trap.h" 49: 50: 51: #define V_TRAP 0 52: #define V_SYSCALL 4 53: 54: .set HIGH,0x1f /*mask for disabling all interrupts */ 55: .set MCKVEC,4 /*scb offset for machinecheck vector */ 56: .set NISP,2 /*no. of interrupt stack pages */ 57: .set DONE,255 /*user process done code */ 58: 59: .text 60: 61: #include "pstorage.s" /* PROCESSOR STORAGE AREA */ 62: 63: .globl _Entry 64: _Entry: 65: jmp start 66: .space (1024-6) 67: 68: 69: 70: 71: /* globl dump buffer to be used for communication */ 72: /* between tests & interrupt handlers, & other misc. */ 73: /* purposes. */ 74: 75: /*physical page 3 */ 76: 77: .set NLWU,41 /*no. of longwords already used */ 78: /*this must be changed when you define */ 79: /*additional variables below before */ 80: /*_dbuf */ 81: .globl _restart 82: _restart: 83: .space 4 /*contains restart address for restarting*/ 84: /*after power is restored (loaded by */ 85: /*power fail interrupt handler & used by*/ 86: /*CPU 2 */ 87: .globl _maxmem 88: _maxmem: 89: .space 4 /*memory size in no of bytes */ 90: 91: .globl _maxpages 92: _maxpages: 93: .space 4 /*memory size in no. of physical pages */ 94: 95: .globl _lastadd 96: _lastadd: 97: .space 4 /*address of the last long word */ 98: 99: .globl _unused 100: _unused: 101: .space 4 /*first unused page in system space */ 102: 103: .globl _ctlblk 104: _ctlblk: 105: .long 0 /* pointer to SCB */ 106: 107: .globl _savvec0 /*save vectors area */ 108: _savvec0: 109: .space 4 110: 111: .globl _savvec1 /*save vectors area */ 112: _savvec1: 113: .space 4 114: 115: .globl _savvec2 /*save vectors area */ 116: _savvec2: 117: .space 4 118: 119: .globl _savvec3 /*save vectors area */ 120: _savvec3: 121: .space 4 122: 123: .globl _savvec4 /*save vectors area */ 124: _savvec4: 125: .space 4 126: 127: .globl _savvec5 /*save vectors area */ 128: _savvec5: 129: .space 4 130: .globl _savvec6 /*save vectors area */ 131: _savvec6: 132: .space 4 133: .globl _savvec7 /*save vectors area */ 134: _savvec7: 135: .space 4 136: 137: .globl _savvec8 /*save vectors area */ 138: _savvec8: 139: .space 4 140: 141: .globl badrtn 142: badrtn: 143: .long 0 144: 145: .long 0 146: 147: .globl _dbuf /*dump buffer left out of 1K */ 148: .globl _r_no 149: _r_no: 150: .long 0 151: .globl _pt_base 152: _pt_base: 153: .long 0 154: .globl _saved_psl 155: _saved_psl: 156: .long 0 157: .globl _saved_sp 158: _saved_sp: 159: .long 0 160: .globl _saved_fp 161: _saved_fp: 162: .long 0 163: .globl _p_ptr 164: _p_ptr: 165: .long 0 166: .globl _ret_adr 167: _ret_adr: 168: .long 0 169: .globl _exp_par0 170: _exp_par0: 171: .long 0 172: .globl _exp_par1 173: _exp_par1: 174: .long 0 175: .globl _exp_par2 176: _exp_par2: 177: .long 0 178: .globl _exp_par3 179: _exp_par3: 180: .long 0 181: .globl _act_par0 182: _act_par0: 183: .long 0 184: .globl _act_par1 185: _act_par1: 186: .long 0 187: .globl _act_par2 188: _act_par2: 189: .long 0 190: .globl _act_par3 191: _act_par3: 192: .long 0 193: .long 0 194: .globl _clk_cnt 195: _clk_cnt: 196: .long 0 /* Clock int. count */ 197: .globl _loop_flg 198: _loop_flg: 199: .long 0 200: .globl _errcnt 201: _errcnt: 202: .long 0 203: .globl _cycle 204: _cycle: 205: .long 0 206: .globl _hlt_flg 207: _hlt_flg: 208: .long 0 209: .long 0 210: .globl _endprog 211: _endprog: 212: .long 0 213: .globl _nonstop 214: _nonstop: 215: .long 0 216: _dbuf: 217: .space NBPG - (NLWU *4) 218: edbuf: 219: 220: 221: .globl _intstack /* Interrupt stack */ 222: _intstack: /* Physical pages 4 & 5 */ 223: .space NISP*NBPG 224: eintstack: 225: 226: 227: .set SYSPTSIZE,512 /* No. of entries in SPT */ 228: 229: /* 230: System Page Table -- physical page 6 & 7 231: */ 232: .align 2 233: .globl _Sysmap 234: _Sysmap: 235: .space SYSPTSIZE*4 /* 512 max pages allowed for system */ 236: eSysmap: 237: .globl _Syssize 238: .set _Syssize,(eSysmap-_Sysmap)/4 /* should be SYSPTSIZE */ 239: 240: .globl _iomap /* Physical page 8 */ 241: _iomap: .space 1024 /* IOMAP - unused */ 242: .globl _eiomap 243: _eiomap: 244: 245: .globl _pcb0 /* Physical page 9 */ 246: _pcb0: .space 128 /*process control block 0 */ 247: .globl _pcb1 248: _pcb1: .space 128 /*process control block 1 */ 249: .globl _pcb2 250: _pcb2: .space 128 /*process control block 2 */ 251: .globl _pcb3 252: _pcb3: .space 128 /*process control block 3 */ 253: .globl _pcb4 254: _pcb4: .space 128 /*process control block 4 */ 255: .globl _pcb5 256: _pcb5: .space 128 /*process control block 5 */ 257: .globl _pcb6 258: _pcb6: .space 128 /*process control block 6 */ 259: .globl _pcb7 260: _pcb7: .space 128 /*process control block 7 */ 261: 262: /* 263: *user #0 page tables -- P0PT, P1PT, P2PT 264: *physical memory -- page10, 11, & 12 respectively 265: */ 266: .align 2 267: .globl _u0p0pt 268: _u0p0pt: 269: .space 1024 /*255 max pages for user #0 text */ 270: .globl _u0p1pt 271: _u0p1pt: 272: .space 1024 /*255 max pages for user #0 data */ 273: .globl _u0p2pt 274: _u0p2pt: 275: .space 1020 /*255 max pages for user #0 stack */ 276: eu0p2pt: 277: .space 4 278: 279: /* 280: *user #1 page tables -- P0PT, P1PT, P2PT 281: *physical memory -- page13 ,14, & 15 respectively 282: */ 283: .align 2 284: .globl _u1p0pt 285: _u1p0pt: 286: .space 1024 /*255 max pages for user #1 text */ 287: .globl _u1p1pt 288: _u1p1pt: 289: .space 1024 /*255 max pages for user #1 data */ 290: .globl _u1p2pt 291: _u1p2pt: 292: .space 1020 /*255 max pages for user #1 stack */ 293: eu1p2pt: 294: .space 4 295: 296: 297: /* 298: *user #2 page tables -- P0PT, P1PT, P2PT 299: *physical memory -- page 16, 17 , & 18 respectively 300: */ 301: .align 2 302: .globl _u2p0pt 303: _u2p0pt: 304: .space 1024 /*255 max pages for user #2 text */ 305: .globl _u2p1pt 306: _u2p1pt: 307: .space 1024 /*255 max pages for user #2 data */ 308: .globl _u2p2pt 309: _u2p2pt: 310: .space 1020 /*255 max pages for user #2 stack */ 311: eu2p2pt: 312: .space 4 313: 314: 315: /* 316: *user #3 page tables -- P0PT, P1PT, P2PT 317: *physical memory -- page 19, 20 , & 21 respectively 318: */ 319: .align 2 320: .globl _u3p0pt 321: _u3p0pt: 322: .space 1024 /*255 max pages for user #3 text */ 323: .globl _u3p1pt 324: _u3p1pt: 325: .space 1024 /*255 max pages for user #3 data */ 326: .globl _u3p2pt 327: _u3p2pt: 328: .space 1020 /*255 max pages for user #3 stack */ 329: eu3p2pt: 330: .space 4 331: 332: /* 333: *user #4 thru 6 page tables 334: *physical memory -- pages 22 thru 30 335: */ 336: .globl _u4p0pt 337: _u4p0pt: 338: .space (9*NBPG) - 4 339: eu6p2pt: 340: .space 4 341: 342: /* 343: *user #7 page tables -- P0PT, P1PT, P2PT 344: *physical memory -- page 31, 32 , & 33 respectively 345: */ 346: .align 2 347: .globl _u7p0pt 348: _u7p0pt: 349: .space 1024 /*255 max pages for user #7 text */ 350: .globl _u7p1pt 351: _u7p1pt: 352: .space 1024 /*255 max pages for user #7 data */ 353: .globl _u7p2pt 354: _u7p2pt: 355: .space 1020 /*255 max pages for user #7 stack */ 356: eu7p2pt: 357: .space 4 358: 359: .globl _iob0 /*io buffer 0 */ 360: _iob0: .space 1024 361: .globl _iob1 /*io buffer 1 */ 362: _iob1: .space 1024 363: .globl _iob2 /*io buffer 2 */ 364: _iob2: .space 1024 365: .globl _iob3 /*io buffer 3 */ 366: _iob3: .space 1024 367: .globl _iob4 /*io buffer 4 */ 368: _iob4: .space 1024 369: .globl _iob5 /*io buffer 5 */ 370: _iob5: .space 1024 371: .globl _iob6 /*io buffer 6 */ 372: _iob6: .space 1024 373: esysdata: 374: 375: #include "scblock.s" /* SYSTEM CONTROL BLOCK */ 376: 377: #include "evthandlers.s" /*event handlers */ 378: 379: #define ACBL(_n1,_n2,_n3,_n4) \ 380: addl2 _n2,_n3;\ 381: cmpl _n3,_n1;\ 382: bleq _n4; 383: 384: .set MEMUNIT,64*1024 385: .set MAXPHYSMEM,32*1024*1024-1 386: .set ERRCD,0x7 387: .set APE,0x1 388: .set DCE,0x3 389: .set VTO,0x4 390: 391: 392: 393: /* 394: *INITIALIZATION CODE 395: * 396: * MME off; mode = k; IPL = 31; IS = 1 397: * 398: */ 399: 400: .globl start 401: start: 402: mtpr $0,$MME /* Disable MME */ 403: andl3 $4,r11,_ss1 /* messages sense switch */ 404: movl r0,_test_no /* save test number */ 405: movl r1,_OPTIONS /* save option bits */ 406: clrl _nonstop 407: movl r2,_count /* save cycle count */ 408: cmpl $0xffffffff,r2 /* Is count == -1 */ 409: bneq 1f 410: movl $1,_nonstop /* Yes : NONSTOP */ 411: 1: 412: cmpl $0x0,r2 /* Is count == 0 */ 413: bneq 1f 414: movl $1,_count /* Yes : set default count to 1 */ 415: 1: 416: movab _scb,r0 417: andl2 $0x3ffffc00,r0 418: mtpr r0,$SCBB /* Set SCBB */ 419: mtpr $0x1f,$IPL /* Set IPL to HIGH */ 420: 421: movpsl r1 422: andl2 $0xffffff00,r1 /* Mask out flags */ 423: cmpl r1,$0x041f0000 /*IS on,modes =k & IPL = 31? */ 424: beql 1f 425: 2: movl $1,r0 426: movl $0x041f0000,r2 427: halt /* PSL not initialized as expected */ 428: /* 429: # Mask out bit 30,31 of SCB vectors 430: # Will turm them back on when ready to go virtual in 431: # system space 432: */ 433: 1: 434: clrl _clk_cnt 435: movl $7,r0 /* R0 : Vector no. of clock int. */ 436: movab _Hardclk,_scb[r0] /* New vector for clock */ 437: 438: movl $_intstack+NISP*NBPG,r0 439: andl2 $0x3fffffff,r0 /* Mask out bit 30,31 */ 440: mtpr r0,$ISP /* init. ISP */ 441: movl r0,sp /* in case we get exception */ 442: movab (sp),fp /* Initialize FP */ 443: /* 444: Clear system data area all the way upto system code 445: this includes dump buffer,interrupt stack,spt,iomap,pcbs,user 446: page tables, & io buffer area. 447: */ 448: 3: 449: movab esysdata,r7 450: movab _restart,r6 451: 1: clrl (r6) 452: ACBL(r7,$4,r6,1b) 453: /* 454: Count memory 455: */ 456: clrl r3 457: movl _scb+BEVEC,r12 458: movab 9f,_scb+BEVEC /* new interrupt handler */ 459: 1: tstl (r3) 460: clrl r0 /* allow 100ns delay */ 461: addl2 $MEMUNIT,r3 462: cmpl r3,$MAXPHYSMEM /* excess max memory size? */ 463: bleq 1b 464: 2: 465: subl3 $4,r3,_maxmem 466: movl r12,_scb+BEVEC /* restore interrupt handler */ 467: jmp _ready 468: 469: .align 2 470: 9: andl3 4(sp),$ERRCD,r0 /* Here's where we get the bus err */ 471: cmpl r0,$APE /* data parity error */ 472: bneq 1f 473: halt 474: 1: cmpl r0,$VTO /* versabus Error */ 475: bneq 1f 476: halt 477: 1: movab 8(sp),sp 478: movab 2b,(sp) 479: mtpr $1,$TBIA /* Purge all */ 480: mtpr $1,$PADC /* Purge all data cache */ 481: rei 482: 483: .globl _ready 484: _ready: 485: mtpr $64,$DCR /* Enable fault */ 486: andl3 $0x3ffffc00,$_end+NBPG-1,_endprog 487: 488: callf $4,_monitor 489: mtpr $2,$27 /* Disable Data cache */ 490: clrl _cycle 491: clrl _errcnt 492: 2: 493: movl $1,_test_no 494: bitl $1,_tstmsk 495: beql 1f 496: callf $4,_stest1 497: 1: 498: incl _test_no 499: bitl $2,_tstmsk 500: beql 1f 501: callf $4,_stest2 502: 1: 503: incl _test_no 504: bitl $4,_tstmsk 505: beql 1f 506: callf $4,_stest3 507: 1: 508: mtpr $0x1e,$IPL /* Set IPL to a low value*/ 509: callf $4,_i_ecc /* Init. memory + ECC */ 510: incl _test_no 511: bitl $8,_tstmsk 512: beql 1f 513: callf $4,_subtest4 514: 1: 515: incl _test_no 516: bitl $16,_tstmsk 517: beql 1f 518: callf $4,_subtest5 519: 1: 520: incl _test_no 521: bitl $32,_tstmsk 522: beql 1f 523: callf $4,_subtest6 524: 1: 525: pushl $endmsg /* Write cycle count */ 526: mtpr $0x1f,$IPL /* Set IPL to a high value*/ 527: bitl $8,_OPTIONS /* print message ? */ 528: beql 1f 529: callf $8,_writes 530: incl _cycle 531: pushl _cycle 532: callf $8,_writed 533: 1: 534: tstl _nonstop /* Is loop forever ? */ 535: beql 4f 536: jmp 2b /* Yes : Jump back */ 537: 4: 538: decl _count 539: tstl _count /* Is count == 0 ? */ 540: beql 1f 541: jmp 2b /* No : Continue */ 542: 1: 543: bitl $8,_OPTIONS /* suppress message ? */ 544: beql 1f 545: pushl $emsg 546: callf $8,_writes 547: pushl _cycle 548: callf $8,_writed 549: pushl $ermsg 550: callf $8,_writes 551: pushl _errcnt 552: callf $8,_writed 553: pushl $ermsg1 554: callf $8,_writes 555: 1: 556: movl $0xCAFEBABE,r0 557: halt 558: # 559: # 560: # *********************************** 561: # * Routine to test an ECC location * 562: # * ecccor(addr) : Read from this * 563: # * addr. ECC correction is enable. * 564: # * Return in R0 : * 565: # * 0 = Didnot get Buser * 566: # * -1 = Got DCE * 567: # * -2 = Unexpected Buser * 568: # *********************************** 569: # 570: .align 2 571: .globl _ecccor 572: _ecccor: .word 0x1ffe 573: movl _scb+BEVEC,_savvec2 /* Save bus error vector */ 574: movab 9f,_scb+BEVEC /* Set new vector */ 575: movl 4(fp),r1 /* get test address */ 576: movl $0x3,0xffffb000 /* Turn ON ECC detection,correction */ 577: movl 0xffffb000,r0 578: movl (r1),*8(fp) /* Read data */ 579: movl $2,r0 /* timeout value*/ 580: 1: 581: decl r0 582: bgtr 1b 583: 584: clrl r0 /* indicate timeout */ 585: movl $0x80,0xffffb000 /* Turn OFF ECC detection */ 586: movl _savvec2,_scb+BEVEC 587: ret 588: # 589: # 590: # *********************************** 591: # * Routine to test an ECC location * 592: # * eccloc(addr) : Read from this * 593: # * addr. ECC detection is enable. * 594: # * Return in R0 : * 595: # * 0 = Didnot get Buser * 596: # * -1 = Got DCE * 597: # * -2 = Unexpected Buser * 598: # *********************************** 599: # 600: .align 2 601: .globl _eccloc 602: _eccloc: .word 0x1ffe 603: movl _scb+BEVEC,_savvec2 /* Save bus error vector */ 604: movab 9f,_scb+BEVEC /* Set new vector */ 605: movl 4(fp),r2 /* get test address */ 606: movl $0x1,0xffffb000 /* Turn ON ECC detection */ 607: movl 0xffffb000,r0 608: movl (r2),r1 /* Read data */ 609: movl $4,r0 /* timeout value*/ 610: 1: decl r0 611: bgtr 1b 612: 613: movl 0xffffb000,_ber1 /* Read MCR */ 614: movl 0xffffb008,_ber3 /* Read MCBR */ 615: movl r1,_ber2 /* Data read */ 616: 617: clrl r0 /* indicate timeout */ 618: # 619: # Return after Bus error 620: # 621: 2: 622: movl $0xc0,0xffffb000 /* Turn OFF ECC, clear error */ 623: movl _savvec2,_scb+BEVEC 624: ret 625: # 626: # ********************* 627: # * Bus Error handler * 628: # ********************* 629: # 630: .align 2 631: 9: 632: movl $0xc0,0xffffb000 /* Turn OFF ECC detection */ 633: andl3 4(sp),$ERRCD,r0 /* Here's where we get the bus err */ 634: movl (sp),_tmp_mcbr /* save current MCBR */ 635: movl 4(sp),_tmp_mear /* save current MEAR */ 636: cmpl r0,$DCE /* Data Check error ? */ 637: beql 3f 638: movl $-2,r0 /* indicate wrong Buser */ 639: brw 4f 640: 3: 641: movl $-1,r0 /* Indicate got a DCE */ 642: 4: movab 8(sp),sp 643: movab 2b,(sp) 644: movl _tmp_mcbr,_ber1 645: movl _tmp_mear,_ber2 646: rei 647: 648: .align 2 649: .globl _ber1 650: _ber1: .long 0 /* Bus error Parameter no. 1 */ 651: .globl _ber2 652: _ber2: .long 0 /* Bus error Parameter no. 1 */ 653: .globl _ber3 654: _ber3: .long 0 655: # 656: # ********************* 657: # 658: .align 2 659: .globl _Hardclk 660: _Hardclk: 661: incl _clk_cnt 662: rei 663: 664: .align 2 665: .globl _tstmsk 666: _tstmsk: .long 0 /* tests to run */ 667: .globl _ss1 668: _ss1: .long 0 /* If 1 then donot print heading messages */ 669: .globl _prt_flg 670: _prt_flg: .long 0 /* print enable */ 671: 672: .globl _OPTIONS 673: .globl _test_no 674: _test_no: .long 0 675: .globl _count 676: _count: .long 0 677: .globl _diagmode 678: _diagmode: .long 0 679: .globl _tmp_mcbr 680: _tmp_mcbr: .long 0 681: .globl _tmp_mear 682: _tmp_mear: .long 0 683: .globl err1 684: err1: 685: .ascii "\nRegisters : \0" 686: .globl err2 687: err2: 688: .ascii " \0" 689: .globl err3 690: err3: 691: .ascii "\n \0" 692: .globl err4 693: err4: 694: .ascii "\n\0" 695: .globl e_type 696: e_type: 697: .ascii "\n** Unexpected exception type : \0" 698: .globl par_0 699: par_0: 700: .ascii "** Par 0 : \0" 701: .globl par_1 702: par_1: 703: .ascii "** Par 1 : \0" 704: .globl par_pc 705: par_pc: 706: .ascii "** PC : \0" 707: .globl par_psl 708: par_psl: 709: .ascii "** PSL : \0" 710: .align 2 711: Gregs: .space 60 /* Space to save general registers */ 712: .align 2 713: .globl _Errmsg 714: _Errmsg: 715: .long 0 /* Pointer to error message */ 716: .data 1 717: endmsg: .ascii "\nEnd Cycle = \0" 718: emsg: .ascii "\nCycles Completed = \0" 719: ermsg: .ascii "\nError Count = \0" 720: ermsg1: .ascii "\nTest Complete \n\0"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.