Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/power/main.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname power/main.c 1990/0227
## diff -e /dev/null /n/bootesdump/1990/0227/sys/src/9/mips/main.c
0a
#include	"u.h"
#include	"lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"io.h"
#include	"ureg.h"
#include	"init.h"

void
main(void)
{
	active.exiting = 0;
	active.machs = 1;
	machinit();
	confinit();
	lockinit();
	printinit();
	tlbinit();
	vecinit();
	procinit0();
	pgrpinit();
	chaninit();
	clockinit();
	alarminit();
	io2init();
	chandevreset();
	streaminit();
	pageinit();
	userinit();
	launchinit();
	schedinit();
}

void
machinit(void)
{
	int n;

	n = m->machno;
	memset(m, 0, sizeof(Mach));
	m->machno = n;
	m->mmask = 1<<m->machno;
}

void
tlbinit(void)
{
	int i;

	for(i=0; i<NTLB; i++)
		puttlbx(i, KZERO | PTEPID(i), 0);
}

void
vecinit(void)
{
	ulong *p, *q;
	int size;

	p = (ulong*)EXCEPTION;
	q = (ulong*)vector80;
	for(size=0; size<4; size++)
		*p++ = *q++;
	p = (ulong*)UTLBMISS;
	q = (ulong*)vector80;
	for(size=0; size<4; size++)
		*p++ = *q++;
}

/*
 *  We have to program both the IO2 board to generate interrupts
 *  and the SBCC on CPU 0 to accept them.
 */
void
io2init(void)
{
	long i;

	/*
	 *  reset VME bus (MODEREG is on the IO2)
	 */
	MODEREG->resetforce = (1<<1);
	for(i=0; i<1000000; i++)
		;
	MODEREG->resetforce = 0;
	MODEREG->masterslave = (SLAVE<<4) | MASTER;

	/*
	 *  all VME interrupts to the error routine
	 */
	for(i=0; i<256; i++)
		setvmevec(i, novme);

	/*
	 *  tell IO2 to sent all interrupts to CPU 0's SBCC
	 */
	for(i=0; i<8; i++)
		INTVECREG->i[i].vec = 0<<8;

	/*
	 *  Tell CPU 0's SBCC to map all interrupts from the IO2 to MIPS level 5
	 *
	 *  Since there are 6 MIPS hardware interrupts and the SBCC can generate
	 *  only 5, one hardware interrupt can't be generated by the SBCC.  SBCC
	 *  interrupt 4 maps to MIPS interrupt 5, SBCC interrupt 0 maps to MIPS
	 *  interrupt 0.  I don't know which interrupt is missing. -- presotto
	 */
	SBCCREG->flevel = 0x10;

	/*
	 *  Tell CPU 0's SBCC to enable all interrupts from the IO2.
	 *
	 *  The SBCC 16 bit registers are read/written as ulong, but only
	 *  bits 23-16 and 7-0 are meaningful.
	 */
	SBCCREG->fintenable |= 0xff;	  /* allow all interrupts on the IO2 */
	SBCCREG->idintenable |= 0x800000; /* allow interrupts from the IO2 */

	/*
	 *  enable all interrupts on the IO2
	 */
	*IO2SETMASK = 0xff;
}

void
launchinit(void)
{
	int i;

	for(i=1; i<conf.nmach; i++)
		launch(i);
	for(i=0; i<1000000; i++)
		if(active.machs == (1<<conf.nmach) - 1){
			print("all launched\n");
			return;
		}
	print("launch: active = %x\n", active.machs);
}


void
init0(void)
{
	m->proc = u->p;
	u->p->state = Running;
	u->p->mach = m;
	spllo();
	chandevinit();
	
	u->slash = (*devtab[0].attach)(0);
	u->dot = clone(u->slash, 0);

	touser();
}

FPsave	initfp;

void
userinit(void)
{
	Proc *p;
	Seg *s;
	User *up;

	p = newproc();
	p->pgrp = newpgrp();
	strcpy(p->text, "*init*");
	strcpy(p->pgrp->user, "bootes");
	savefpregs(&initfp);
	p->fpstate = FPinit;

	/*
	 * Kernel Stack
	 */
	p->sched.pc = (ulong)init0;
	p->sched.sp = USERADDR+BY2PG-20;
	p->upage = newpage(0, 0, USERADDR|(p->pid&0xFFFF));

	/*
	 * User
	 */
	up = (User*)(p->upage->pa|KZERO);
	up->p = p;

	/*
	 * User Stack
	 */
	s = &p->seg[SSEG];
	s->proc = p;
	s->o = neworig(USTKTOP-BY2PG, 1, OWRPERM, 0);
	s->minva = USTKTOP-BY2PG;
	s->maxva = USTKTOP;

	/*
	 * Text
	 */
	s = &p->seg[TSEG];
	s->proc = p;
	s->o = neworig(UTZERO, 1, 0, 0);
	s->o->pte[0].page = newpage(0, 0, UTZERO);
	memcpy((ulong*)(s->o->pte[0].page->pa|KZERO), initcode, sizeof initcode);
	s->minva = 0x1000;
	s->maxva = 0x2000;

	ready(p);
}

void
lights(int v)
{

	*LED = ~v;
}

typedef struct Beef	Beef;
struct	Beef
{
	long	deadbeef;
	long	sum;
	long	cpuid;
	long	virid;
	long	erno;
	void	(*launch)(void);
	void	(*rend)(void);
	long	junk1[4];
	long	isize;
	long	dsize;
	long	nonbss;
	long	junk2[18];
};

void
launch(int n)
{
	Beef *p;
	long i;

	p = (Beef*) 0xb0000500 + n;
	p->launch = newstart;
	p->sum -= (long)newstart;
	for(i=0; i<3000000; i++)
		if(p->launch == 0)
			break;
}

void
online(void)
{

	machinit();
	lock(&active);
	active.machs |= 1<<m->machno;
	unlock(&active);
	tlbinit();
	clockinit();
	schedinit();
}

void
exit(void)
{
	int i;

	u = 0;
	lock(&active);
	active.machs &= ~(1<<m->machno);
	active.exiting = 1;
	unlock(&active);
	spllo();
	print("cpu %d exiting\n", m->machno);
	while(active.machs || consactive())
		for(i=0; i<1000; i++)
			;
	splhi();
	for(i=0; i<2000000; i++)
		;
	duartreset();
	firmware();
}

/*
 * Insert new into list after where
 */
void
insert(List **head, List *where, List *new)
{
	if(where == 0){
		new->next = *head;
		*head = new;
	}else{
		new->next = where->next;
		where->next = new;
	}
		
}

/*
 * Insert new into list at end
 */
void
append(List **head, List *new)
{
	List *where;

	where = *head;
	if(where == 0)
		*head = new;
	else{
		while(where->next)
			where = where->next;
		where->next = new;
	}
	new->next = 0;
}

/*
 * Delete old from list
 */
void
delete0(List **head, List *old)
{
	List *l;

	l = *head;
	if(l == old){
		*head = old->next;
		return;
	}
	while(l->next != old)
		l = l->next;
	l->next = old->next;
}

/*
 * Delete old from list.  where->next is known to be old.
 */
void
delete(List **head, List *where, List *old)
{
	if(where == 0){
		*head = old->next;
		return;
	}
	where->next = old->next;
}

Conf	conf;

void
confinit(void)
{
	long x, i, j, *l;

	conf.nmach = 4;
	if(conf.nmach > MAXMACH)
		panic("confinit");
	conf.nproc = 193;
	conf.npgrp = 100;

	x = 0x12345678;
	for(i=4; i<64; i+=4){
		l = (long*)(KSEG1|(i*1024L*1024L));
		*l = x;
		wbflush();
		*(ulong*)KSEG1 = *(ulong*)KSEG1;	/* clear latches */
		if(*l != x)
			break;
		x += 0x3141526;
	}
	conf.npage = i*1024/4;

	conf.npte = 20000;
	conf.nmod = 500;
	conf.nalarm = 1000;
	conf.norig = 500;
	conf.nchan = 500;
	conf.nenv = 200;
	conf.nenvchar = 10000;
	conf.npgenv = 200;
	conf.nmtab = 100;
	conf.nmount = 500;
	conf.nmntdev = 30;
	conf.nmntbuf = 60;
	conf.nmnthdr = 60;
	conf.nstream = 512;
	conf.nqueue = 5 * conf.nstream;
	conf.nblock = 16 * conf.nstream;
	conf.nsrv = 32;
}
.
## diffname power/main.c 1990/0312
## diff -e /n/bootesdump/1990/0227/sys/src/9/mips/main.c /n/bootesdump/1990/0312/sys/src/9/mips/main.c
374c
	conf.nmod = 2000;
.
## diffname power/main.c 1990/0321
## diff -e /n/bootesdump/1990/0312/sys/src/9/mips/main.c /n/bootesdump/1990/0321/sys/src/9/mips/main.c
378,380c
	conf.nenv = 400;
	conf.nenvchar = 20000;
	conf.npgenv = 400;
.
## diffname power/main.c 1990/0322
## diff -e /n/bootesdump/1990/0321/sys/src/9/mips/main.c /n/bootesdump/1990/0322/sys/src/9/mips/main.c
375c
	conf.nalarm = 10000;
.
362c
	for(i=4; i<128; i+=4){
.
## diffname power/main.c 1990/0325
## diff -e /n/bootesdump/1990/0322/sys/src/9/mips/main.c /n/bootesdump/1990/0325/sys/src/9/mips/main.c
373c
	conf.npte = 40000;
.
## diffname power/main.c 1990/0409
## diff -e /n/bootesdump/1990/0325/sys/src/9/mips/main.c /n/bootesdump/1990/0409/sys/src/9/mips/main.c
373c
	conf.npte = 50000;
.
## diffname power/main.c 1990/04101
## diff -e /n/bootesdump/1990/0409/sys/src/9/mips/main.c /n/bootesdump/1990/04101/sys/src/9/mips/main.c
373c
	conf.npte = 60000;
.
## diffname power/main.c 1990/0412
## diff -e /n/bootesdump/1990/04101/sys/src/9/mips/main.c /n/bootesdump/1990/0412/sys/src/9/mips/main.c
373c
	conf.npte = 4*conf.npage;
.
## diffname power/main.c 1990/0424
## diff -e /n/bootesdump/1990/0412/sys/src/9/mips/main.c /n/bootesdump/1990/0424/sys/src/9/mips/main.c
389d
372,386c
	conf.npte = 4 * conf.npage;
.
358,359d
355c
#include  "conf.h"

.
150c

.
144a
	int i;

.
35a
arginit(void)
{
	int i;

	if(_argc > 5)
		_argc = 5;

	for(i = 1; i < _argc; i++){
		strcpy(argx[i-1], _argv[i]);
		argv[i-1] = &(argx[i-1][0]);
	}
}

void
.
14a
	arginit();
.
12a
	int i;

.
9a
/*
 *  args passed by boot process
 */
int _argc; char **_argv; char **_env;

char *argv[5];
char argx[4][64];

.
## diffname power/main.c 1990/0427
## diff -e /n/bootesdump/1990/0424/sys/src/9/mips/main.c /n/bootesdump/1990/0427/sys/src/9/mips/main.c
218a
	s->o->pte[0].page = newpage(0, 0, USTKTOP-BY2PG);
	memcpy((ulong*)(s->o->pte[0].page->pa|KZERO|(BY2PG-argsize)), 
		argbuf + sizeof(argbuf) - argsize, argsize);
	av = (char **)(s->o->pte[0].page->pa|KZERO|(BY2PG-argsize));
	for(i = 0; i < _argc; i++)
		av[i] += (char *)USTKTOP - (argbuf + sizeof(argbuf));
.
214c
	 * User Stack, pass input arguments to boot process
.
191a
	int i;
	char **av;
.
181c
	sp = (ulong*)(USTKTOP - argsize);

	touser(sp);
.
175a

.
170a
	ulong *sp;
.
57a
	_argv = argv;

	argsize = ssize;
.
54,56c
	/*
	 *  copy arguments into the buffer
	 */
	argv = (char**)(argbuf + sizeof(argbuf) - ssize);
	charp = (char*)(argbuf + sizeof(argbuf) - nbytes);
	for(i=0; i<_argc; i++){
		argv[i] = charp;
		n = strlen(_argv[i]) + 1;
		memcpy(charp, _argv[i], n);
		charp += n;
.
51,52c
	/*
	 *  trim arguments to make them fit in the buffer
	 */
	for(nbytes = i = 0; i < _argc; i++){
		n = strlen(_argv[i]) + 1;
		ssize = BY2WD*(i+2) + ((nbytes+n+(BY2WD-1)) & ~(BY2WD-1));
		if(ssize > sizeof(argbuf))
			break;
		nbytes += n;
	}
	_argc = i;
	ssize = BY2WD*(i+1) + ((nbytes+(BY2WD-1)) & ~(BY2WD-1));
.
49c
	int i, n;
	int nbytes;
	int ssize;
	char *p;
	char **argv;
	char *charp;
.
45a
/*
 *  copy arguments into a temporary buffer.  we do this because the arguments
 *  are in memory that may be allocated to processes or kernel buffers.
 */
.
15,16c
char argbuf[512];
int argsize;
.
## diffname power/main.c 1990/0430
## diff -e /n/bootesdump/1990/0427/sys/src/9/mips/main.c /n/bootesdump/1990/0430/sys/src/9/mips/main.c
441a

	/*
	 *  zero memory from bss up
	 */
	e = (long *)(i*1024*1024);
	for(l = &end; l < e; l++)
		*l = 0;
.
421c
	long x, i, j, *l, *e;
.
## diffname power/main.c 1990/0504
## diff -e /n/bootesdump/1990/0430/sys/src/9/mips/main.c /n/bootesdump/1990/0504/sys/src/9/mips/main.c
446,448c
	if(*sysname == 0){
		for(argv = _env; *argv; argv++){
			if(strncmp(*argv, SYSENV, sizeof(SYSENV)-1)==0){
				strcpy(sysname, (*argv) + sizeof(SYSENV)-1);
				break;
			}
		}
	}
	strcpy(envbuf, SYSENV);
	strcat(envbuf, sysname);
	env[0] = envbuf;
	env[1] = 0;

	/*
	 *  trim arguments to make them fit in the buffer (argv[0] is sysname)
	 */
	nbytes = 0;
	_argv[0] = sysname;
	for(i = 0; i < _argc; i++){
		n = strlen(_argv[i]) + 1;
		ssize = BY2WD*(i+2) + ((nbytes+n+(BY2WD-1)) & ~(BY2WD-1));
		if(ssize > sizeof(argbuf))
			break;
		nbytes += n;
	}
	_argc = i;
	ssize = BY2WD*(i+1) + ((nbytes+(BY2WD-1)) & ~(BY2WD-1));

	/*
	 *  copy arguments into the buffer
	 */
	argv = (char**)(argbuf + sizeof(argbuf) - ssize);
	charp = (char*)(argbuf + sizeof(argbuf) - nbytes);
	for(i=0; i<_argc; i++){
		argv[i] = charp;
		n = strlen(_argv[i]) + 1;
		memcpy(charp, _argv[i], n);
		charp += n;
	}
	_argv = argv;
	argsize = ssize;
.
444c
	 *  get the system name from the environment
.
442a
	confread();

	if(conf.nmach > MAXMACH)
		panic("confinit");

}

/*
 *  copy arguments passed by the boot kernel (or ROM) into a temporary buffer.
 *  we do this because the arguments are in memory that may be allocated
 *  to processes or kernel buffers.
 */
#define SYSENV "netaddr="
void
arginit(void)
{
	int i, n;
	int nbytes;
	int ssize;
	char *p;
	char **argv;
	char *charp;

.
438a

	/*
	 *  set minimal default values
	 */
	conf.nmach = 1;
	conf.nmod = 2000;
	conf.nalarm = 1000;
	conf.norig = 9;
	conf.nchan = 64;
	conf.nenv = 4;
	conf.nenvchar = 1000;
	conf.npgenv = 400;
	conf.nmtab = 4;
	conf.nmount = 4;
	conf.nmntdev = 4;
	conf.nmntbuf = 4;
	conf.nmnthdr = 4;
	conf.nstream = 4;
	conf.nsrv = 0;
	conf.nproc = 4;
	conf.npgrp = 4;
.
427a
	/* skip white */
	for(p = sym; *p==' ' || *p=='\t'; p++)
		;
	sym = p;

	/* skip sym */
	for(; *p && *p!=' ' && *p!='\t' && *p!='='; p++)
		;
	if(*p)
		*p++ = 0;

	/* skip white */
	for(; *p==' ' || *p=='\t' || *p=='='; p++)
		;
	val = p;

	/*
	 *  lookup value
	 */
	for(ct = conftab; ct->sym; ct++)
		if(strcmp(sym, ct->sym) == 0){
			*(ct->x) = confeval(val);
			return;
		}

	if(strcmp(sym, "sysname")==0){
		p = strchr(val, ' ');
		if(p)
			*p = 0;
		strcpy(sysname, val);
	}
}

/*
 *  read the ascii configuration left by the boot kernel
 */
void
confread(void)
{
	char *line;
	char *end;

	/*
	 *  process configuration file
	 */
	line = confbuf;
	while(end = strchr(line, '\n')){
		*end = 0;
		confset(line);
		line = end+1;
	}
}

void
confprint(void)
{
	Conftab *ct;

	/*
	 *  lookup value
	 */
	for(ct = conftab; ct->sym; ct++)
		print("%s == %d\n", ct->sym, *ct->x);
}

void
confinit(void)
{
	long x, i, j, *l;

	/*
	 *  copy configuration down from high memory
	 */
	strcpy(confbuf, (char *)(0x80000000 + 4*1024*1024 - 4*1024));

	/*
	 *  size memory
	 */
.
425,426c
	/* comment */
	if(p = strchr(sym, '#'))
		*p = 0;
.
423c
	/*
 	 *  parse line
	 */
.
421c
	char *val, *p;
	Conftab *ct;
	ulong x;
.
419c
confset(char *sym)
.
417a
ulong
confeval(char *exp)
{
	char *op;
	Conftab *ct;

	/* crunch leading white */
	while(*exp==' ' || *exp=='\t')
		exp++;

	op = strchr(exp, '+');
	if(op != 0){
		*op++ = 0;
		return confeval(exp) + confeval(op);
	}

	op = strchr(exp, '*');
	if(op != 0){
		*op++ = 0;
		return confeval(exp) * confeval(op);
	}

	if(*exp >= '0' && *exp <= '9')
		return strtoul(exp, 0, 0);

	/* crunch trailing white */
	op = strchr(exp, ' ');
	if(op)
		*op = 0;
	op = strchr(exp, '\t');
	if(op)
		*op = 0;

	/* lookup in symbol table */
	for(ct = conftab; ct->sym; ct++)
		if(strcmp(exp, ct->sym) == 0)
			return *(ct->x);

	return 0;
}

/*
 *  each line of the configuration is of the form `param = expression'.
 */
.
415a
typedef struct Conftab {
	char *sym;
	ulong *x;
} Conftab;

#include "conf.h"

.
51,89d
46,49d
27a
	arginit();
.
25d
22a
	icflush(0, 64*1024);
.
17a
/*
 *  environment passed to any kernel started by this kernel
 */
char envbuf[64];
char *env[2];

/*
 *  configuration file read by boot program
 */
char confbuf[4*1024];

/*
 *  system name
 */
char sysname[64];

.
14a
/*
 *  arguments passed to initcode
 */
.
## diffname power/main.c 1990/0614
## diff -e /n/bootesdump/1990/0504/sys/src/9/mips/main.c /n/bootesdump/1990/0614/sys/src/9/mips/main.c
549c
	conf.npage0 = i*1024/4;
	conf.npage = conf.npage0;
.
## diffname power/main.c 1990/0617
## diff -e /n/bootesdump/1990/0614/sys/src/9/mips/main.c /n/bootesdump/1990/0617/sys/src/9/mips/main.c
247c
	k = kmap(s->o->pte[0].page);
	memcpy((ulong*)VA(k), initcode, sizeof initcode);
	kunmap(k);
.
223a
	kunmap(k);
.
222c
	k = kmap(p->upage);
	up = (User*)VA(k);
.
201a
	KMap *k;
.
## diffname power/main.c 1990/0718
## diff -e /n/bootesdump/1990/0617/sys/src/9/mips/main.c /n/bootesdump/1990/0718/sys/src/9/mips/main.c
59a
	sysloginit();
.
## diffname power/main.c 1990/0801
## diff -e /n/bootesdump/1990/0718/sys/src/9/mips/main.c /n/bootesdump/1990/0801/sys/src/9/mips/main.c
71a
	icflush(0, 64*1024);
.
45d
42c
	machinit();
.
## diffname power/main.c 1990/0802
## diff -e /n/bootesdump/1990/0801/sys/src/9/mips/main.c /n/bootesdump/1990/0802/sys/src/9/mips/main.c
250a
	s->o->npage = 1;
.
249c
	/*
	 * On the mips, init text must be OCACHED to avoid reusing page
	 * and getting in trouble with the hardware instruction cache.
	 */
	s->o = neworig(UTZERO, 1, OCACHED, 0);
.
## diffname power/main.c 1990/0825
## diff -e /n/bootesdump/1990/0802/sys/src/9/mips/main.c /n/bootesdump/1990/0825/sys/src/9/mips/main.c
136,139c
	 *	0x01		level 0
	 *	0x02		level 1
	 *	0x04		level 2
	 *	0x08		level 4
	 *	0x10		level 5
.
## diffname power/main.c 1990/0826
## diff -e /n/bootesdump/1990/0825/sys/src/9/mips/main.c /n/bootesdump/1990/0826/sys/src/9/mips/main.c
110a

	ioid = *IOID;
.
108c
ioboardinit(void)
.
102a
void
ioboardid(void)
{
	switch(ioid){
	case IO2R1:
		print("IO2 revision 1\n");
		break;
	case IO2R2:
		print("IO2 revision 2\n");
		break;
	case IO3R1:
		print("IO3 revision 1\n");
		break;
	default:
		print("unknown IO board\n");
		break;
	}
}

.
61a
	ioboardid();
.
56c
	ioboardinit();
.
36a
/*
 *  IO board type
 */
int ioid;

.
## diffname power/main.c 1990/0905
## diff -e /n/bootesdump/1990/0826/sys/src/9/mips/main.c /n/bootesdump/1990/0905/sys/src/9/mips/main.c
183c
	*IO2SETMASK = iomask;
.
177c
	SBCCREG->fintenable |= iomask;	/* turn on all interrupts */
.
157c
	for(i=0; i<iolevels; i++)
.
155c
	 *  tell IO2 to send all interrupts to CPU 0's SBCC
.
137a
	switch(ioid){
	case IO2R1:
	case IO2R2:
		iolevels = 8;
		iomask = 0xff;
		break;
	case IO3R1:
		iolevels = 11;
		iomask = 0x7fe;
		break;
	}
.
136a
	/*
	 *  set up interrupts based on IO board type
	 */
.
135a
	int intrs;
.
40a
int iolevels;
int iomask;
.
38c
 *  IO board type, number of interrupt levels, and interrupt enable mask
.
## diffname power/main.c 1990/09051
## diff -e /n/bootesdump/1990/0905/sys/src/9/mips/main.c /n/bootesdump/1990/09051/sys/src/9/mips/main.c
64a
	sinit();
.
## diffname power/main.c 1990/0907
## diff -e /n/bootesdump/1990/09051/sys/src/9/mips/main.c /n/bootesdump/1990/0907/sys/src/9/mips/main.c
631a
	conf.nnoifc = 1;
	conf.nnoconv = 32;
	conf.nurp = 256;
.
609a
 	 *  clear MP bus error caused by sizing memory
	 */
	i = *SBEADDR;

	/*
.
201c
	*IO2SETMASK = 0xff;
.
195c
	SBCCREG->fintenable |= 0xff;	  /* allow all interrupts on the IO2 */
.
175c
	for(i=0; i<8; i++)
.
173c
	 *  tell IO2 to sent all interrupts to CPU 0's SBCC
.
163c
	MODEREG->resetforce = (1<<0);
.
160c
	MODEREG->resetforce = (1<<1) | (1<<0);
.
145,155d
141,143d
139d
126c
		iprint("unknown IO board\n");
.
123c
		iprint("IO3 revision 1\n");
.
120c
		iprint("IO2 revision 2\n");
.
117c
		iprint("IO2 revision 1\n");
.
70d
65d
63a
	ioboardid();
.
47,48d
41,42d
38c
 *  IO board type
.
## diffname power/main.c 1990/0911
## diff -e /n/bootesdump/1990/0907/sys/src/9/mips/main.c /n/bootesdump/1990/0911/sys/src/9/mips/main.c
619a
	conf.nenv = 15*conf.nproc;
	conf.nenvchar = 20 * conf.nenv;
	conf.npte = 4 * conf.npage;
	conf.nqueue = 3 * conf.nstream;
	conf.nblock = 10 * conf.nstream;
.
599,616c
	conf.nalarm = 10000;
	conf.norig = 500;
	conf.nchan = 1000;
	conf.npgenv = 800;
	conf.nmtab = 100;
	conf.nmount = 5000;
	conf.nmntdev = 150;
	conf.nmntbuf = 120;
	conf.nmnthdr = 120;
	conf.nstream = 128;
	conf.nsrv = 32;
	conf.nproc = 386;
	conf.npgrp = 100;
.
143c
	MODEREG->resetforce = noforce;
.
140c
	MODEREG->resetforce = (1<<1) | noforce;
.
136a

.
135a
	if(ioid >= IO3R1)
		noforce = 1;
	else
		noforce = 0;
.
133a
	int noforce;
.
107,125d
60d
## diffname power/main.c 1990/0912
## diff -e /n/bootesdump/1990/0911/sys/src/9/mips/main.c /n/bootesdump/1990/0912/sys/src/9/mips/main.c
309c
	p->sum = 0;
	s = 0;
	ptr = (ulong*)p;
	for (i = 0; i < sizeof(Beef)/sizeof(ulong); i++)
		s += *ptr++;
	p->sum = -(s+1);

.
305c
	long i, s;
	ulong *ptr;
.
141c
	for(i=0; i<maxlevel; i++)
.
120a
	}
.
119c
	} else {
		maxlevel = 8;
.
117c
	if(ioid >= IO3R1){
		maxlevel = 11;
.
114a
	int maxlevel;
.
62d
49a
	sysloginit();
.
## diffname power/main.c 1990/0928
## diff -e /n/bootesdump/1990/0912/sys/src/9/mips/main.c /n/bootesdump/1990/0928/sys/src/9/mips/main.c
50d
## diffname power/main.c 1990/1002
## diff -e /n/bootesdump/1990/0928/sys/src/9/mips/main.c /n/bootesdump/1990/1002/sys/src/9/mips/main.c
124c
	print("IO %d\n", ioid);
.
## diffname power/main.c 1990/1004
## diff -e /n/bootesdump/1990/1002/sys/src/9/mips/main.c /n/bootesdump/1990/1004/sys/src/9/mips/main.c
593c
	conf.nmach = 2;
.
124d
## diffname power/main.c 1990/1009
## diff -e /n/bootesdump/1990/1004/sys/src/9/mips/main.c /n/bootesdump/1990/1009/sys/src/9/mips/main.c
614a
	conf.npipe = conf.nstream/2;
.
## diffname power/main.c 1990/1013
## diff -e /n/bootesdump/1990/1009/sys/src/9/mips/main.c /n/bootesdump/1990/1013/sys/src/9/mips/main.c
593c
	conf.nmod = 10000;
.
## diffname power/main.c 1990/11151
## diff -e /n/bootesdump/1990/1013/sys/src/9/mips/main.c /n/bootesdump/1990/11151/sys/src/9/mips/main.c
613c
	conf.nqueue = 5 * conf.nstream;
.
## diffname power/main.c 1990/11161
## diff -e /n/bootesdump/1990/11151/sys/src/9/mips/main.c /n/bootesdump/1990/11161/sys/src/9/mips/main.c
125,131c
	vmereset();
.
122,123d
119,120c
	else
.
117c
	if(ioid >= IO3R1)
.
113d
105a
 *  reset the vme bus
 */
void
vmereset(void)
{
	long i;
	int noforce;

	if(ioid >= IO3R1)
		noforce = 1;
	else
		noforce = 0;
	MODEREG->resetforce = (1<<1) | noforce;
	for(i=0; i<1000000; i++)
		;
	MODEREG->resetforce = noforce;
}

/*
.
## diffname power/main.c 1990/11211
## diff -e /n/bootesdump/1990/11161/sys/src/9/mips/main.c /n/bootesdump/1990/11211/sys/src/9/mips/main.c
41a
char	user[NAMELEN] = "bootes";

.
## diffname power/main.c 1990/1127
## diff -e /n/bootesdump/1990/11211/sys/src/9/mips/main.c /n/bootesdump/1990/1127/sys/src/9/mips/main.c
603c
	conf.nmach = 1;
.
## diffname power/main.c 1990/1202
## diff -e /n/bootesdump/1990/1127/sys/src/9/mips/main.c /n/bootesdump/1990/1202/sys/src/9/mips/main.c
623a
	conf.nalarm = 500;
	conf.nmount = 500;
	conf.nsrv = 3;
	conf.nnoifc = 1;
	conf.nnoconv = 32;
	conf.nurp = 25;
.
622a
	conf.nmtab = conf.nproc;
	conf.norig = 4 * conf.nproc;
	conf.nmod = 10 * conf.norig;
	conf.nchan = 20 * conf.nproc;
	conf.nmntdev = conf.nproc;
	conf.nmntbuf = conf.nproc;
	conf.nmnthdr = conf.nproc;
	conf.nstream = 2 * conf.nproc;
.
604,621c
	conf.nproc = 32;
	conf.npgrp = conf.nproc / 4;
	conf.npgenv = 4 * conf.npgrp;
	conf.nenv = 4 * conf.nproc;
.
## diffname power/main.c 1990/1211
## diff -e /n/bootesdump/1990/1202/sys/src/9/mips/main.c /n/bootesdump/1990/1211/sys/src/9/mips/main.c
694a
}

/*
 *  set up machine dependent process state for a new process
 */
void
setup(Proc *p)
{
}

/*
 *  Save machine dependent process state
 */
void
save(uchar *state, int len)
{
}

/*
 *  Restore what save() saves
 */
void
restore(Proc *p, uchar *state)
{
.
593a
	conf.maxialloc = (128*1024*1024-256*1024-BY2PG);
.
592a
	conf.base0 = 0;
.
## diffname power/main.c 1990/1212
## diff -e /n/bootesdump/1990/1211/sys/src/9/mips/main.c /n/bootesdump/1990/1212/sys/src/9/mips/main.c
697,720d
633a
	conf.copymode = 1;		/* copy on reference */
.
## diffname power/main.c 1990/1214
## diff -e /n/bootesdump/1990/1212/sys/src/9/mips/main.c /n/bootesdump/1990/1214/sys/src/9/mips/main.c
600a
	USED(i);
.
## diffname power/main.c 1990/1228
## diff -e /n/bootesdump/1990/1214/sys/src/9/mips/main.c /n/bootesdump/1990/1228/sys/src/9/mips/main.c
180a

	/*
	 *  get our ether addr out of the non-volatile ram
	 */
	ea[0] = LANCEID[20]>>8;
	ea[1] = LANCEID[16]>>8;
	ea[2] = LANCEID[12]>>8;
	ea[3] = LANCEID[8]>>8;
	ea[4] = LANCEID[4]>>8;
	ea[5] = LANCEID[0]>>8;

	/*
	 *  reset the lance.
	 *  configure the lance software parameters.
	 *  run through all lance memory to set parity.
	 */
	if(ioid >= IO3R1){
		MODEREG->promenet |= 1;
		MODEREG->promenet &= ~1;
		lanceconfig(LANCE3RAM, LANCE3END, LANCERAP, LANCERDP, 4,
			(void*)0x800000, ea);
		for(sp = LANCE3RAM; sp < LANCE3END; sp += 2)
			*sp = 0;
	} else {
		MODEREG->promenet &= ~1;
		MODEREG->promenet |= 1;
		lanceconfig(LANCERAM, LANCEEND, LANCERAP, LANCERDP, 1,
			(void*)0x0, ea);
		for(sp = LANCERAM; sp < LANCEEND; sp += 1)
			*sp = 0;
	}

	/*
	 *  initialize the map/buffer use
	 */
	lm.ttot = 128;
	lm.rtot = 128;
	lm.rnext = lm.rused = lm.tnext = lm.tused = 0;
}

/*
 *  map/copy a list of blocks to somewhere the lance can access
 *
 *  if bp==0, just create a block and map it in
 */
static int
isomap(void *x)
{
	int next;

	next = (int)x;
	return x != lm.tused;
}
Block *
lancemap(Block *bp, int len)
{
	Block *nbp, *tbp;
	int next;
	ulong x;

	if(bp == 0){
		next = lm.rnext+1 % lm.rtot;
		if(ioid >= IO3R1){
			bp = allocb(sizeof(Etherpkt));
			x = (ulong)(bp->wptr);
			*WRITEMAP = (next<<16) | ((x>>12)&0xFFFF);
			bp->va = (next<<12) | (x & 0xFFF));
		} else {
			bp = allocb(0);
			x = (ulong)(LANCEMEM+4*1024+next*sizeof(Etherpkt));
			bp->va = x;
			bp->rptr = (uchar *)x;
			bp->wptr = (uchar *)x;
		}
		lm.rnext = next;
		return bp;
	}

	if(ioid >= IO3R1){
		for(nbp = bp; nbp; nbp = nbp->next){
			next = lm.tnext+1 % lm.ttot;
			if(next == lm.tused)
				sleep(&lm.tr, isomap, (void *)next);
			x = (ulong)(nbp->rptr);
			*WRITEMAP = ((lm.rtot + next)<<16) | ((x>>12)&0xFFFF);
			nbp->va = ((lm.rtot + next)<<12) | (x & 0xFFF));
			lm.tnext = next;
		}
	} else {
		tbp = bp;
		bp = allocb(0);
		next = lm.tnext+1 % lm.ttot;
		if(next == lm.tused)
			sleep(&lm.tr, isomap, (void *)next);
		x = (ulong)(LANCEMEM+4*1024+(next+lm.rtot)*sizeof(Etherpkt));
		bp->va = x;
		bp->rptr = (uchar *)x;
		bp->wptr = (uchar *)x;
		for(nbp = tbp; nbp; nbp = nbp->next){
			n = BLEN(nbp);
			if(BLEN(bp) + n < sizeof(Etherpkt))
				n = sizeof(Etherpkt) - BLEN(bp);
			memcpy(bp->wptr, nbp->rptr, n);
			bp->wptr += n;
		}
		freeb(tbp);
		lm.tnext = next;
	}
}

/*
 *  get a block back from the lance
 */
Block *
lanceunmap(Block *bp)
{
.
134a
	ushort *sp;
	uchar ea[6];
.
41a
/*
 *  lance memory mapping
 */
typedef struct Lancemap	Lancemap;
struct Lancemap
{
	int	rused;		/* first used receive map */
	int	rnext;		/* next receive map to use */
	int	rtot;

	int	tused;		/* first used transmit map */
	int	tnext;		/* next transmit map to use */
	int	ttot;
	Rendez	tr;		/* where to wait for a transmit map */
};
Lancemap lm;

extern int	ioid;

.
## diffname power/main.c 1990/1229
## diff -e /n/bootesdump/1990/1228/sys/src/9/mips/main.c /n/bootesdump/1990/1229/sys/src/9/mips/main.c
835a
}

/*
 *  get our ether addr out of the non-volatile ram
 */
void
lanceeaddr(uchar *ea)
{
	ea[0] = LANCEID[20]>>8;
	ea[1] = LANCEID[16]>>8;
	ea[2] = LANCEID[12]>>8;
	ea[3] = LANCEID[8]>>8;
	ea[4] = LANCEID[4]>>8;
	ea[5] = LANCEID[0]>>8;
}

/*
 *  allocate command memory for the initialization block
 *  and descriptor rings.
 *
 *  pass back the host's address of the memory, the lance's address
 *  of the memory, and the span (in shorts) of each short as seen
 *  by the host.  The latter is only for a peculiarity of the SGI IO3.
 *  It is normally 1.
 */
void
lancectlmem(ushort **hostaddr, ushort **lanceaddr, int *sep, int len)
{
	len = (len + sizeof(ushort) - 1)/sizeof(ushort);
	if(ioid >= IO3R1)
		*sep = 4;
	else
		*sep = 1;
	if(len+lancehmem > lancehend)
		panic("lancecmdmem");
	*lanceaddr = lancelmem;
	*hostaddr = lancehmem;
	lancelmem += len;
	lancehmem += len;
}

/*
 *  allocate packet buffer memory for the lance.
 *
 *  pass back the host's address of the memory and the lance's address
 *  of the memory.
 */
void
lancepktmem(ushort **hostaddr, ushort **lanceaddr, int len)
{
	ulong x;
	ulong y;

	if(ioid >= IO3R1){
		/*
		 *  allocate some host mempry and map it into lance
		 *  space
		 */
		*hostaddr = (ushort*)ialloc(len, 1);
		x = (ulong)*hostaddr;
		*lanceaddr = (ushort*)((lancemap<<12) | (x & 0xFFF));
		for(y = x; y < x+len; y += 0x1000){
			*WRITEMAP = ((0x1E00+lancemap)<<16) | (y>>12)&0xFFFF;
			lancemap++;
		}
	} else {
		/*
		 *  allocate lance memory
		 */
		len = (len + sizeof(ushort) - 1)/sizeof(ushort);
		if(len+lancehmem > lancehend)
			panic("lancecmdmem");
		*lanceaddr = lancelmem;
		*hostaddr = lancehmem;
		lancelmem += len;
		lancehmem += len;
	}
}

void
lanceparity(void)
{
	print("lance DRAM parity error\n");
	MODEREG->promenet &= ~4;
	MODEREG->promenet |= 4;
.
242,319d
233,239d
231a
		lancehmem = LANCERAM;
		lancehend = LANCEEND;
		lancelmem = (ushort*)0;
.
228,229d
224a
		lancehmem = LANCE3RAM;
		lancehend = LANCE3END;
		lancelmem = (ushort*)0x800000;
.
221,222d
215d
204,213d
155d
59,60d
52,57c
/*
 *  next free lance memory map
 */
int	lancemap;
.
45,50c
ushort	*lancelmem;	/* next free lance mem as seen by lance */
ushort	*lancehmem;	/* next free lance mem as seen by host */
ushort	*lancehend;
.
43c
 *  lance memory allocation
.
## diffname power/main.c 1990/1231
## diff -e /n/bootesdump/1990/1229/sys/src/9/mips/main.c /n/bootesdump/1990/1231/sys/src/9/mips/main.c
784,810c
	lp->rap = LANCERAP;
	lp->rdp = LANCERDP;
	lp->ea[0] = LANCEID[20]>>8;
	lp->ea[1] = LANCEID[16]>>8;
	lp->ea[2] = LANCEID[12]>>8;
	lp->ea[3] = LANCEID[8]>>8;
	lp->ea[4] = LANCEID[4]>>8;
	lp->ea[5] = LANCEID[0]>>8;
	lp->lognrrb = 7;
	lp->logntrb = 7;
	lp->nrrb = 1<<lp->lognrrb;
	lp->ntrb = 1<<lp->logntrb;
	if(ioid >= IO3R1)
		lanceIO3setup(lp);
	else
		lanceIO2setup(lp);
.
782c
lancesetup(Lance *lp)
.
776,779c
 *  set up the lance
.
762,772c
	ulong x, y;
	int index;
	ushort *sp;
	int len;

	/*
	 *  reset lance and set parity on its memory
	 */
	MODEREG->promenet |= 1;
	MODEREG->promenet &= ~1;
	for(sp = LANCE3RAM; sp < LANCE3END; sp += 2)
		*sp = 0;

	lp->sep = 4;
	lp->lanceram = LANCE3RAM;
	lp->lm = (Lancemem*)0x800000;

	/*
	 *  allocate some host memory for buffers and map it into lance
	 *  space
	 */
	len = (lp->nrrb + lp->ntrb)*sizeof(Etherpkt);
	lp->rp = (Etherpkt*)ialloc(len , 1);
	lp->tp = lp->rp + lp->nrrb;
	x = (ulong)lp->rp;
	lp->lrp = (Etherpkt*)(x & 0xFFF);
	lp->ltp = lp->lrp + lp->nrrb;
	index = LANCEINDEX;
	for(y = x+len; x < y; x += 0x1000){
		*WRITEMAP = (index<<16) | (x>>12)&0xFFFF;
		index++;
	}
.
760c
lanceIO3setup(Lance *lp)
.
751,757c
 *  setup the IO3 lance, io buffers are in host memory mapped to
 *  lance address space
.
742,747c
	ushort *sp;

	/*
	 *  reset lance and set parity on its memory
	 */
	MODEREG->promenet &= ~1;
	MODEREG->promenet |= 1;
	for(sp = LANCERAM; sp < LANCEEND; sp += 1)
		*sp = 0;

	lp->sep = 1;
	lp->lanceram = LANCERAM;
	lp->lm = (Lancemem*)0;

	/*
	 *  Allocate space in lance memory for the io buffers.
	 *  Start at 4k to avoid the initialization block and
	 *  descriptor rings.
	 */
	lp->lrp = (Etherpkt*)(4*1024);
	lp->ltp = lp->lrp + lp->nrrb;
	lp->rp = (Etherpkt*)(((ulong)LANCERAM) + (ulong)lp->lrp);
	lp->tp = lp->rp + lp->nrrb;
.
740c
lanceIO2setup(Lance *lp)
.
737c
 *  setup the IO2 lance, io buffers are in lance memory
.
195,215d
49,53d
42,47d
## diffname power/main.c 1991/0109
## diff -e /n/bootesdump/1990/1231/sys/src/9/mips/main.c /n/bootesdump/1991/0109/sys/src/9/mips/main.c
793a
	lp->busctl = BSWP;
.
## diffname power/main.c 1991/0125
## diff -e /n/bootesdump/1991/0109/sys/src/9/mips/main.c /n/bootesdump/1991/0125/sys/src/9/mips/main.c
635a
	conf.npipe = conf.nstream/2;	/* must be after confread */
.
632d
## diffname power/main.c 1991/0212
## diff -e /n/bootesdump/1991/0201/sys/src/9/mips/main.c /n/bootesdump/1991/0212/sys/src/9/power/main.c
182c
	*IO2SETMASK = 0xff000000;
.
180c
	 *  Enable all interrupts on the IO2.  If IO3, run in compatibility mode.
.
140c
		maxlevel = 8;
.
## diffname power/main.c 1991/0314
## diff -e /n/bootesdump/1991/0212/sys/src/9/power/main.c /n/bootesdump/1991/0314/sys/src/9/power/main.c
254a
	up->fpsave.fpstatus = initfp.fpstatus;
.
## diffname power/main.c 1991/0315
## diff -e /n/bootesdump/1991/0314/sys/src/9/power/main.c /n/bootesdump/1991/0315/sys/src/9/power/main.c
216a

	chandevinit();
.
213,214c
	/*
	 * These are o.k. because rootinit is null.
	 * Then early kproc's will have a root and dot.
	 */
.
## diffname power/main.c 1991/0318
## diff -e /n/bootesdump/1991/0315/sys/src/9/power/main.c /n/bootesdump/1991/0318/sys/src/9/power/main.c
702c
		memmove(charp, _argv[i], n);
.
290c
	memmove((ulong*)VA(k), initcode, sizeof initcode);
.
269c
	memmove((ulong*)(s->o->pte[0].page->pa|KZERO|(BY2PG-argsize)), 
.
## diffname power/main.c 1991/0424
## diff -e /n/bootesdump/1991/0318/sys/src/9/power/main.c /n/bootesdump/1991/0424/sys/src/9/power/main.c
636a
	conf.ipif = 8;
	conf.ip = 64;
	conf.arp = 32;
	conf.frag = 32;
.
## diffname power/main.c 1991/0425
## diff -e /n/bootesdump/1991/0424/sys/src/9/power/main.c /n/bootesdump/1991/0425/sys/src/9/power/main.c
103c
	q = (ulong*)vector0;
.
80c
	m->stb = &stlb[n][0];
.
10a
 * software tlb simulation
 */
Softtlb stlb[4][STLBSIZE];

/*
.
## diffname power/main.c 1991/0426
## diff -e /n/bootesdump/1991/0425/sys/src/9/power/main.c /n/bootesdump/1991/0426/sys/src/9/power/main.c
109c
	for(size=0; size<0x80/sizeof(*q); size++)
.
## diffname power/main.c 1991/0607
## diff -e /n/bootesdump/1991/0426/sys/src/9/power/main.c /n/bootesdump/1991/0607/sys/src/9/power/main.c
821a

/*
 *  for the sake of a single devcons.c
 */
void
buzz(int f, int d)
{
}
int
mouseputc(IOQ *q, int c)
{
	return 0;
}

.
379c
	duartenable0();
.
373c
	while(active.machs || duartactive())
.
85a
	duartinit();
.
59a
	duartspecial(0, &printq, &kbdq, 9600);
.
## diffname power/main.c 1991/0608
## diff -e /n/bootesdump/1991/0607/sys/src/9/power/main.c /n/bootesdump/1991/0608/sys/src/9/power/main.c
647a
	conf.cntrlp = 1;
.
## diffname power/main.c 1991/0611
## diff -e /n/bootesdump/1991/0608/sys/src/9/power/main.c /n/bootesdump/1991/0611/sys/src/9/power/main.c
293c
	s->o = neworig(UTZERO, 1, OCACHED|OISMEM, 0);
.
274c
	s->o = neworig(USTKTOP-BY2PG, 1, OWRPERM|OISMEM, 0);
.
## diffname power/main.c 1991/0705
## diff -e /n/bootesdump/1991/0611/sys/src/9/power/main.c /n/bootesdump/1991/0705/sys/src/9/power/main.c
832a

.
656a
	conf.copymode = 1;		/* copy on reference */
	conf.cntrlp = 1;
.
655d
648d
635d
628,629c
	conf.nseg = 4 * conf.nproc;
	conf.npagetab = conf.nseg*3;
	conf.nswap = 20000;
	conf.nimage = 200;
.
381c
	duartreset();
.
375c
	while(active.machs || consactive())
.
299,300d
287,296c
	s = newseg(SG_TEXT, UTZERO, 1);
	p->seg[TSEG] = s;
	segpage(s, newpage(1, 0, UTZERO));
	k = kmap(s->map[0]->pages[0]);
.
281,282d
278c

	av = (char **)(pg->pa|KZERO|(BY2PG-argsize));
.
272,276c
	s = newseg(SG_STACK, USTKTOP-USTKSIZE, USTKSIZE/BY2PG);
	p->seg[SSEG] = s;
	pg = newpage(1, 0, USTKTOP-BY2PG);
	segpage(s, pg);

	memmove((ulong*)(pg->pa|KZERO|(BY2PG-argsize)), 
.
247a
	p->egrp = newegrp();
	p->fgrp = newfgrp();

.
244a
	Page *pg;
.
240c
	Segment *s;
.
230a
	kickpager();
.
70a
	swapinit();
.
64c
	initseg();
	grpinit();
.
## diffname power/main.c 1991/0707
## diff -e /n/bootesdump/1991/0705/sys/src/9/power/main.c /n/bootesdump/1991/0707/sys/src/9/power/main.c
380c
/*	duartreset(); /**/
.
## diffname power/main.c 1991/0708
## diff -e /n/bootesdump/1991/0707/sys/src/9/power/main.c /n/bootesdump/1991/0708/sys/src/9/power/main.c
380c
	duartenable0();
.
## diffname power/main.c 1991/0710
## diff -e /n/bootesdump/1991/0708/sys/src/9/power/main.c /n/bootesdump/1991/0710/sys/src/9/power/main.c
382,447d
264c
	p->sched.sp = USERADDR+BY2PG-24;	/* BUG */
.
## diffname power/main.c 1991/0711
## diff -e /n/bootesdump/1991/0710/sys/src/9/power/main.c /n/bootesdump/1991/0711/sys/src/9/power/main.c
264c
	p->sched.sp = USERADDR+BY2PG-(1+MAXSYSARG)*BY2WD;
.
## diffname power/main.c 1991/0717
## diff -e /n/bootesdump/1991/0711/sys/src/9/power/main.c /n/bootesdump/1991/0717/sys/src/9/power/main.c
233d
## diffname power/main.c 1991/0803
## diff -e /n/bootesdump/1991/0717/sys/src/9/power/main.c /n/bootesdump/1991/0803/sys/src/9/power/main.c
541a
	conf.npage1 = 0;
	conf.base1 = 0;
.
## diffname power/main.c 1991/0926
## diff -e /n/bootesdump/1991/0803/sys/src/9/power/main.c /n/bootesdump/1991/0926/sys/src/9/power/main.c
232a
	sp = (ulong*)(USTKTOP - argsize);
.
231c
	if(!waserror()){
		c = namec("#e/cputype", Acreate, OWRITE, 0600);
		(*devtab[c->type].write)(c, "mips", strlen("mips"), 0);
		close(c);
		poperror();
	}
.
215a
	Chan *c;
.
## diffname power/main.c 1991/0927
## diff -e /n/bootesdump/1991/0926/sys/src/9/power/main.c /n/bootesdump/1991/0927/sys/src/9/power/main.c
233,235c
		ksetenv("cputype", "mips");
.
## diffname power/main.c 1991/1101
## diff -e /n/bootesdump/1991/0927/sys/src/9/power/main.c /n/bootesdump/1991/1101/sys/src/9/power/main.c
233a
		ksetenv("terminal", "sgi power 4D");
		ksetenv("sysname", sysname);
.
## diffname power/main.c 1991/1102
## diff -e /n/bootesdump/1991/1101/sys/src/9/power/main.c /n/bootesdump/1991/1102/sys/src/9/power/main.c
234c
		ksetterm("sgi %s 4D");
.
## diffname power/main.c 1991/1105
## diff -e /n/bootesdump/1991/1102/sys/src/9/power/main.c /n/bootesdump/1991/1105/sys/src/9/power/main.c
262c
	strcpy(p->user, "bootes");
.
131,132c
	delay(140);
.
## diffname power/main.c 1991/1107
## diff -e /n/bootesdump/1991/1105/sys/src/9/power/main.c /n/bootesdump/1991/1107/sys/src/9/power/main.c
597a
	conf.dkif = 2;
.
## diffname power/main.c 1991/1109
## diff -e /n/bootesdump/1991/1107/sys/src/9/power/main.c /n/bootesdump/1991/1109/sys/src/9/power/main.c
261c
	strcpy(p->user, eve);
.
47,49d
## diffname power/main.c 1991/1110
## diff -e /n/bootesdump/1991/1109/sys/src/9/power/main.c /n/bootesdump/1991/1110/sys/src/9/power/main.c
255a
	p->procmode = 0644;
.
## diffname power/main.c 1991/1112
## diff -e /n/bootesdump/1991/1110/sys/src/9/power/main.c /n/bootesdump/1991/1112/sys/src/9/power/main.c
256c
	p->procmode = 0640;
.
## diffname power/main.c 1991/1115
## diff -e /n/bootesdump/1991/1112/sys/src/9/power/main.c /n/bootesdump/1991/1115/sys/src/9/power/main.c
596d
580a
	conf.dkif = 1;
.
## diffname power/main.c 1991/1127
## diff -e /n/bootesdump/1991/1115/sys/src/9/power/main.c /n/bootesdump/1991/1127/sys/src/9/power/main.c
484a
	} else if(strcmp(sym, "eve")==0){
		p = strchr(val, ' ');
		if(p)
			*p = 0;
		strcpy(eve, val);
.
## diffname power/main.c 1991/1214
## diff -e /n/bootesdump/1991/1127/sys/src/9/power/main.c /n/bootesdump/1991/1214/sys/src/9/power/main.c
781a
	USED(q);
.
776a
	USED(f);
.
## diffname power/main.c 1991/1222
## diff -e /n/bootesdump/1991/1214/sys/src/9/power/main.c /n/bootesdump/1991/1222/sys/src/9/power/main.c
268c
	p->upage = newpage(1, 0, USERADDR|(p->pid&0xFFFF));
.
225d
## diffname power/main.c 1992/0101
## diff -e /n/bootesdump/1991/1222/sys/src/9/power/main.c /n/bootesdump/1992/0101/sys/src/9/power/main.c
581c
	conf.nsrv = 20;
.
564c
	conf.nproc = 100;
.
## diffname power/main.c 1992/0120
## diff -e /n/bootesdump/1992/0101/sys/src/9/power/main.c /n/bootesdump/1992/0120/sys/src/9/power/main.c
7d
## diffname power/main.c 1992/0209
## diff -e /n/bootesdump/1992/0120/sys/src/9/power/main.c /n/bootesdump/1992/0209/sys/src/9/power/main.c
571c
	conf.nswap = 262144;
.
551c
	conf.maxialloc = 16*1024*1024;
.
## diffname power/main.c 1992/0228
## diff -e /n/bootesdump/1992/0209/sys/src/9/power/main.c /n/bootesdump/1992/0228/sys/src/9/power/main.c
581,582d
## diffname power/main.c 1992/0321
## diff -e /n/bootesdump/1992/0228/sys/src/9/power/main.c /n/bootesdump/1992/0321/sys/src/9/power/main.c
35,39d
2c
#include	"../port/lib.h"
.
## diffname power/main.c 1992/0325
## diff -e /n/bootesdump/1992/0321/sys/src/9/power/main.c /n/bootesdump/1992/0325/sys/src/9/power/main.c
592c
	conf.cntrlp = cpuserver;
.
573c
	conf.nalarm = 2500;
.
## diffname power/main.c 1992/0509
## diff -e /n/bootesdump/1992/0325/sys/src/9/power/main.c /n/bootesdump/1992/0509/sys/src/9/power/main.c
80a

	m->ledval = 0xff;
.
## diffname power/main.c 1992/0516
## diff -e /n/bootesdump/1992/0509/sys/src/9/power/main.c /n/bootesdump/1992/0516/sys/src/9/power/main.c
220a
	kproc("alarm", alarmkproc, 0);
.
## diffname power/main.c 1992/0517
## diff -e /n/bootesdump/1992/0516/sys/src/9/power/main.c /n/bootesdump/1992/0517/sys/src/9/power/main.c
230a
	kproc("alarm", alarmkproc, 0);
.
221d
## diffname power/main.c 1992/0602
## diff -e /n/bootesdump/1992/0517/sys/src/9/power/main.c /n/bootesdump/1992/0602/sys/src/9/power/main.c
625,626d
617,622c
	strcpy(envbuf, IPADDRENV);
	for(argv = _env; *argv; argv++){
		if(strncmp(*argv, IPADDRENV, sizeof(IPADDRENV)-1)==0){
			strcat(envbuf, (*argv) + sizeof(IPADDRENV)-1);
			break;
.
603c
#define IPADDRENV "netaddr="
.
59d
## diffname power/main.c 1992/0607
## diff -e /n/bootesdump/1992/0602/sys/src/9/power/main.c /n/bootesdump/1992/0607/sys/src/9/power/main.c
63a
print("userinit\n");
.
## diffname power/main.c 1992/0610
## diff -e /n/bootesdump/1992/0607/sys/src/9/power/main.c /n/bootesdump/1992/0610/sys/src/9/power/main.c
645,654c
	if(diskless[0] > '1')
		av[i++] = pusharg(diskless);
	av[i] = 0;
.
643c
	 *  if no boot method is specified, look for
	 *  a default in the diskless environment variable
.
639,640d
633,637c
		if(i && *(_argv[i]) != '-')
			diskless[0] = 0;
		av[i] = pusharg(_argv[i]);
.
630,631c
	av = (char**)argbuf;
	sp = argbuf + sizeof(argbuf);
.
628c
	 *  pack args into buffer
.
617,625c
	if(*sysname == 0)
		for(av = _env; *av; av++)
			for(i=0; i < sizeof bootenv/sizeof bootenv[0]; i++){
				n = strlen(bootenv[i].name);
				if(strncmp(*av, bootenv[i].name, n) == 0){
					strncpy(bootenv[i].val, (*av)+n, NAMELEN);
					bootenv[i].val[NAMELEN-1] = '\0';
					break;
				}
			}
.
615c
	 *  get boot env variables
.
608,612c
	char **av;
.
603c
struct{
	char	*name;
	char	*val;
}bootenv[] = {
	{"netaddr=",	sysname},
	{"console=",	consname},
	{"diskless=",	diskless},
};
char *sp;

char *
pusharg(char *p)
{
	int n;

	n = strlen(p)+1;
	sp -= n;
	memmove(sp, p, n);
	return sp;
}

.
601a
 *
 *  also grab any environment variables that might be useful
.
380c
	firmware(conf.cntrlp ? PROM_AUTOBOOT : PROM_REINIT);
.
283,289d
281a
	k = kmap(pg);
	for(av = (char**)argbuf; *av; av++)
		*av += (USTKTOP - sizeof(argbuf)) - (ulong)argbuf;
	memmove((uchar*)VA(k) + BY2PG - sizeof(argbuf), argbuf, sizeof argbuf);
	kunmap(k);
.
231,232c
	touser((uchar*)(USTKTOP - sizeof(argbuf)));
.
207d
64d
48a
	confinit();
.
47d
28,29c
char consname[NAMELEN];
char diskless[NAMELEN];
.
26c
 *  environment variables extracted from NVRAM
.
22c
char argbuf[128];
.
## diffname power/main.c 1992/0622
## diff -e /n/bootesdump/1992/0610/sys/src/9/power/main.c /n/bootesdump/1992/0622/sys/src/9/power/main.c
721c
	lp->rp = (Etherpkt*)xspanalloc(len , BY2PG, 0);
.
600c
struct
{
.
585d
577d
571,573d
566,569d
561,563d
557,558c
	conf.npgenv = 4 * conf.nproc;
.
545a
	conf.upages = (conf.npage*70)/100;
	i = conf.npage-conf.upages;
	if(i > (12*MB)/BY2PG)
		conf.upages +=  i - ((12*MB)/BY2PG);
.
544d
531c
		l = (long*)(KSEG1|(i*MB));
.
524c
	strcpy(confbuf, (char *)(0x80000000 + (4*MB) - BY2PG));
.
63d
56,57d
51a
	pageinit();
xsummary();
.
49a
	xinit();
.
14,40d
9,12c
Softtlb stlb[MAXMACH][STLBSIZE];		/* software tlb simulation */
int	_argc;					/* args passed by boot process */
char 	**_argv;
char	**_env;
char 	argbuf[128];				/* arguments passed to initcode */
int	argsize;
char	consname[NAMELEN];			/* environment vars from NVRAM */
char	diskless[NAMELEN];
char	confbuf[4*1024];			/* config file read by boot program */
int	ioid;					/* IO board type */
.
## diffname power/main.c 1992/0623
## diff -e /n/bootesdump/1992/0622/sys/src/9/power/main.c /n/bootesdump/1992/0623/sys/src/9/power/main.c
547d
544,545d
539,541d
33d
## diffname power/main.c 1992/0625
## diff -e /n/bootesdump/1992/0623/sys/src/9/power/main.c /n/bootesdump/1992/0625/sys/src/9/power/main.c
540d
225,226c
	p->egrp = smalloc(sizeof(Egrp));
	p->egrp->ref = 1;
	p->fgrp = smalloc(sizeof(Fgrp));
	p->fgrp->ref = 1;
.
## diffname power/main.c 1992/0711
## diff -e /n/bootesdump/1992/0625/sys/src/9/power/main.c /n/bootesdump/1992/0711/sys/src/9/power/main.c
742a
	USED(c);
.
736a
	USED(d);
.
499c
	long x, i, *l;
.
416d
219d
183,185d
114d
93d
## diffname power/main.c 1992/0715
## diff -e /n/bootesdump/1992/0711/sys/src/9/power/main.c /n/bootesdump/1992/0715/sys/src/9/power/main.c
516a

	ktop = PGROUND((ulong)end);
	ktop = PADDR(ktop);
	conf.npage0 -= ktop/BY2PG;
	conf.base0 += ktop;
.
492a
	ulong ktop;
.
## diffname power/main.c 1992/0725
## diff -e /n/bootesdump/1992/0715/sys/src/9/power/main.c /n/bootesdump/1992/0725/sys/src/9/power/main.c
552d
349c
	firmware(cpuserver ? PROM_AUTOBOOT : PROM_REINIT);
.
## diffname power/main.c 1992/0812
## diff -e /n/bootesdump/1992/0725/sys/src/9/power/main.c /n/bootesdump/1992/0812/sys/src/9/power/main.c
334a
	USED(ispanic);
.
331c
exit(int ispanic)
.
## diffname power/main.c 1992/1125
## diff -e /n/bootesdump/1992/0812/sys/src/9/power/main.c /n/bootesdump/1992/1125/sys/src/9/power/main.c
746d
200a
	kproc("kdebug", debugger, 0);
.
## diffname power/main.c 1992/1203
## diff -e /n/bootesdump/1992/1125/sys/src/9/power/main.c /n/bootesdump/1992/1203/sys/src/9/power/main.c
201c
	if(conf.nmach > 2)
		kproc("kdebug", debugger, 0);
.
## diffname power/main.c 1992/1220
## diff -e /n/bootesdump/1992/1203/sys/src/9/power/main.c /n/bootesdump/1992/1220/sys/src/9/power/main.c
201c
	if(conf.debugger && conf.nmach > 2)
.
## diffname power/main.c 1993/0106
## diff -e /n/bootesdump/1992/1220/sys/src/9/power/main.c /n/bootesdump/1993/0106/sys/src/9/power/main.c
540c
	conf.nmach = 2;
.
## diffname power/main.c 1993/0123
## diff -e /n/bootesdump/1993/0106/sys/src/9/power/main.c /n/bootesdump/1993/0123/sys/src/9/power/main.c
476c
		line = lend+1;
.
473,474c
	while(lend = strchr(line, '\n')){
		*lend = 0;
.
467c
	char *lend;
.
## diffname power/main.c 1993/0206
## diff -e /n/bootesdump/1993/0123/sys/src/9/power/main.c /n/bootesdump/1993/0206/sys/src/9/power/main.c
544,547d
540,541c
	conf.nmach = 1;
.
521a
	conf.nproc = 128 + 3*i;

.
## diffname power/main.c 1993/0501
## diff -e /n/bootesdump/1993/0206/sys/src/9/power/main.c /n/fornaxdump/1993/0501/sys/src/brazil/power/main.c
544a
	conf.ipif = 8;
	conf.ip = 64;
	conf.arp = 32;
	conf.frag = 32;
.
542c
	conf.nmach = 2;
	conf.nproc = 100;
.
522,523d
476c
		line = end+1;
.
473,474c
	while(end = strchr(line, '\n')){
		*end = 0;
.
467c
	char *end;
.
351a
	firmware(PROM_REINIT);
.
338d
261,263c
	/* Text */
.
257a

.
240,248d
236,238c
	p->sched.sp = (ulong)p->kstack+KSTACK-(1+MAXSYSARG)*BY2WD;
.
230a
	p->fpsave.fpstatus = initfp.fpstatus;
.
228a

.
217a
	char **av;
	Segment *s;
.
216d
213,214d
204c
	touser((uchar*)(USTKTOP-sizeof(argbuf)));
.
201,202d
196c
		sprint(buf, "sgi %s 4D", conffile);
		ksetenv("terminal", buf);
.
190,191c
	up->slash = namec("#/", Atodir, 0, 0);
	up->dot = clone(up->slash, 0);

.
181,183c
	char buf[2*NAMELEN];

.
177d
171c
			print("all launched\n");/**/
.
31a
	print("\n\nBRAZIL\n");
.
17,18c
char	confbuf[4*1024];		/* config file read by boot program */
int	ioid;				/* IO board type */
.
15c
char	consname[NAMELEN];		/* environment vars from NVRAM */
.
13c
char 	argbuf[128];			/* arguments passed to initcode */
.
9,10c
Softtlb stlb[MAXMACH][STLBSIZE];	/* software tlb simulation */
int	_argc;				/* args passed by boot process */
.
## diffname power/main.c 1993/0806
## diff -e /n/fornaxdump/1993/0501/sys/src/brazil/power/main.c /n/fornaxdump/1993/0806/sys/src/brazil/power/main.c
677c
	lp->lrp = (Lancepkt*)(x & 0xFFF);
.
673,674c
	len = (lp->nrrb + lp->ntrb)*sizeof(Lancepkt);
	lp->rp = (Lancepkt*)xspanalloc(len , BY2PG, 0);
.
641c
	lp->rp = (Lancepkt*)(((ulong)LANCERAM) + (ulong)lp->lrp);
.
639c
	lp->lrp = (Lancepkt*)(4*1024);
.
315a
	duartinit();
.
310d
58d
41d
36a
	vecinit();
.
35d
31,32c
	duartspecial(0, 9600, &kbdq, &printq, kbdcr2nl);
iprint("F:\n", printq);
	print("\n\nBrazil\n");
.
29a
	duartinit();
.
25a
iprint("Boot baby\n");
.
## diffname power/main.c 1993/0807
## diff -e /n/fornaxdump/1993/0806/sys/src/brazil/power/main.c /n/fornaxdump/1993/0807/sys/src/brazil/power/main.c
192a
	iallocinit();
.
82a

.
43a
	rootfiles();
.
34d
26d
## diffname power/main.c 1993/0915
## diff -e /n/fornaxdump/1993/0807/sys/src/brazil/power/main.c /n/fornaxdump/1993/0915/sys/src/brazil/power/main.c
42d
40a
	links();
.
## diffname power/main.c 1993/1201
## diff -e /n/fornaxdump/1993/0915/sys/src/brazil/power/main.c /n/fornaxdump/1993/1201/sys/src/brazil/power/main.c
730,737d
## diffname power/main.c 1994/0322
## diff -e /n/fornaxdump/1993/1201/sys/src/brazil/power/main.c /n/fornaxdump/1994/0322/sys/src/brazil/power/main.c
193d
## diffname power/main.c 1994/0406
## diff -e /n/fornaxdump/1994/0322/sys/src/brazil/power/main.c /n/fornaxdump/1994/0406/sys/src/brazil/power/main.c
519a
	conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
.
60a

	/* Setup call back ring buffer */
	m->cbin = m->calls;
	m->cbout = m->calls;
	m->cbend = &m->calls[NCALLBACK];
.
54a
	dcflush(0, 64*1024);
.
## diffname power/main.c 1994/0509
## diff -e /n/fornaxdump/1994/0406/sys/src/brazil/power/main.c /n/fornaxdump/1994/0509/sys/src/brazil/power/main.c
62,66d
## diffname power/main.c 1997/0327 # deleted
## diff -e /n/fornaxdump/1994/0509/sys/src/brazil/power/main.c /n/emeliedump/1997/0327/sys/src/brazil/power/main.c
1,730d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.