File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / io / restart.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

#include "preg.h"

extern long pfint, pfcnt, memflg;
extern long sbr, slr, p0br, p0lr, p1br, p1lr, p2br, p2lr, ipl, mme, Pcbb;
extern long Isp, Sisr, scbb, ksp;

#define	NBPG	1024
#define	TP0BR	0x100
#define	TP0LR	0x200
#define	TP1BR	0x300
#define	TP1LR	0x400
#define	TP2BR	0x500
#define	TP2LR	0x600
#define	TKSP	0x700
#define KMEM	64


pfsetup(baddr)
register long *baddr;
{	register long ix;

	/* write pattern into 64K of memory */
	writes("** writing patterns to 64K bytes of memory...\n");
	for(ix=0;ix<((NBPG/4)*KMEM) ;ix++) baddr[ix] = ix;
}


prest(baddr)
register long *baddr;
{	register long ix;

	writes("** Power restarted...\n");
	if (pfint==0) {
		writes("   Tahoe did not receive power fail interrupt.\n");
		}
	if (memflg != 0xcafebabe) {
		writes("   Memory is not backed up on when power fails\n");
		return(0);
		}
	writes("   Count is "); writeh(pfcnt);

	/* Check if memory is backed up */
	writes("   Checking patterns written to memory previously...\n");
	for(ix=0;ix<((NBPG/4)*KMEM) ;ix++) {
		if (baddr[ix] != ix) {
			writes("** Memory error, begin address ");
			writeh(baddr); writes(", longword no. "); writeh(ix);
			writes(", actual "); writeh(baddr[ix]);
			break;
			}
		}
	chk_pr();		/* Check privilege registes */
}

chk_pr()
{	register long actual;

	actual = mfpr(SBR);
	if (actual != sbr) pferr("\n   SBR error ",actual,sbr);
	actual = mfpr(SLR);
	if (actual != slr) pferr("\n   SLR error ",actual,slr);
	actual = mfpr(P0BR);
	if (actual != p0br) pferr("\n   P0BR error ",actual,p0br);
	actual = mfpr(P0LR);
	if (actual != p0lr) pferr("\n   P0LR error ",actual,p0lr);
	actual = mfpr(P1BR);
	if (actual != p1br) pferr("\n   P1BR error ",actual,p1br);
	actual = mfpr(P1LR);
	if (actual != p1lr) pferr("\n   P1LR error ",actual,p1lr);
	actual = mfpr(P2BR);
	if (actual != p2br) pferr("\n   P2BR error ",actual,p2br);
	actual = mfpr(P2LR);
	if (actual != p2lr) pferr("\n   P2LR error ",actual,p2lr);
	actual = mfpr(IPL);
	if (actual != ipl) pferr("\n   IPL error ",actual,ipl);
	actual = mfpr(MME);
	if (actual != mme) pferr("\n   MME error ",actual,mme);
	actual = mfpr(PCBB);
	if (actual != Pcbb) pferr("\n   PCBB error ",actual,Pcbb);
	actual = mfpr(ISP);
	if (actual != Isp) pferr("\n   ISP error ",actual,Isp);
	actual = mfpr(SISR);
	if (actual != Sisr) pferr("\n   SISR error ",actual,Sisr);
	actual = mfpr(SCBB);
	if (actual != scbb) pferr("\n   SCBB error ",actual,scbb);
	actual = mfpr(KSP);
	if (actual != ksp) pferr("\n   KSP error ",actual,ksp);
}


mfpr(pn)
long pn;
{	register long r12;

	asm("mfpr 4(fp),r12");
	return(r12);
}

pferr(str,actual,expected)
char *str;
long actual, expected;
{
	writes(str); writes("** actual "); writeh(actual); 
	writes(" , expected "); writeh(expected);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.