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

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


## diffname carrera/main.c 1993/0903
## diff -e /dev/null /n/fornaxdump/1993/0903/sys/src/brazil/carrera/main.c
0a
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"io.h"
#include	"init.h"

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

/*
 *  arguments passed to initcode and /boot
 */
char argbuf[128];

/*
 *  environment passed to boot -- sysname, consname, diskid
 */
char consname[NAMELEN];
char bootdisk[NAMELEN];
char screenldepth[NAMELEN];

/*
 * software tlb simulation
 */
Softtlb stlb[MAXMACH][STLBSIZE];

Conf	conf;
FPsave	initfp;

void
main(void)
{
	*(uchar*)(Uart0) = '*';
	tlbinit();		/* Very early to establish IO mappings */
	ioinit();
	arginit();
	confinit();
	savefpregs(&initfp);
	machinit();
	active.exiting = 0;
	active.machs = 1;
	kmapinit();
	xinit();
	printinit();
	NS16552setup(Uart0, UartFREQ);
	NS16552special(0, 9600, &kbdq, &printq, kbdcr2nl);
	vecinit();
	iprint("\n\nBrazil\n");
	pageinit();
	procinit0();
	initseg();
	chandevreset();
	rootfiles();
	swapinit();
	userinit();
	schedinit();
}


/*
 *  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.
 *
 *  also grab any environment variables that might be useful
 */
struct
{
	char	*name;
	char	*val;
}bootenv[] = {
	{"netaddr=",	sysname},
	{"console=",	consname},
	{"bootdisk=",	bootdisk},
	{"ldepth=",	screenldepth},
};
char *sp;

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

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

void
arginit(void)
{
	int i, n;
	char **av;

	/*
	 *  get boot env variables
	 */
	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;
				}
			}

	/*
	 *  pack args into buffer
	 */
	av = (char**)argbuf;
	sp = argbuf + sizeof(argbuf);
	for(i = 0; i < _argc; i++){
		if(strchr(_argv[i], '='))
			break;
		av[i] = pusharg(_argv[i]);
	}
	av[i] = 0;
}

/*
 *  initialize a processor's mach structure.  each processor does this
 *  for itself.
 */
void
machinit(void)
{
	int n;

	/* Ensure CU1 is off */
	clrfpintr();

	/* scrub cache */
	cleancache();

	n = m->machno;
	m->stb = &stlb[n][0];
	clockinit();
}

/*
 * Map IO address space in wired down TLB entry 1
 */
void
ioinit(void)
{
	ulong phys;

	phys = PPN(Devicephys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;

	puttlbx(1, Devicevirt, phys, PTEGLOBL, PGSZ256K);
}

/*
 *  setup MIPS trap vectors
 */
void
vecinit(void)
{
	memmove((ulong*)UTLBMISS, (ulong*)vector0, 0x100);
	memmove((ulong*)CACHETRAP, (ulong*)vector100, 0x80);
	memmove((ulong*)EXCEPTION, (ulong*)vector180, 0x80);
	icflush((ulong*)UTLBMISS, 32*1024);
}

void
init0(void)
{
	char buf[2*NAMELEN];

	spllo();

	/*
	 * These are o.k. because rootinit is null.
	 * Then early kproc's will have a root and dot.
	 */
	up->slash = namec("#/", Atodir, 0, 0);
	up->dot = clone(up->slash, 0);

	iallocinit();
	chandevinit();

	if(!waserror()){
		ksetenv("cputype", "mips");
		sprint(buf, "sgi %s 4D", conffile);
		ksetenv("terminal", buf);
		ksetenv("sysname", sysname);
		poperror();
	}

	kproc("alarm", alarmkproc, 0);
	touser((uchar*)(USTKTOP-sizeof(argbuf)));
}

FPsave	initfp;

void
userinit(void)
{
	Proc *p;
	KMap *k;
	Page *pg;
	char **av;
	Segment *s;

	p = newproc();
	p->pgrp = newpgrp();
	p->egrp = smalloc(sizeof(Egrp));
	p->egrp->ref = 1;
	p->fgrp = smalloc(sizeof(Fgrp));
	p->fgrp->ref = 1;
	p->procmode = 0640;

	strcpy(p->text, "*init*");
	strcpy(p->user, eve);

	p->fpstate = FPinit;
	p->fpsave.fpstatus = initfp.fpstatus;

	/*
	 * Kernel Stack
	 */
	p->sched.pc = (ulong)init0;
	p->sched.sp = (ulong)p->kstack+KSTACK-(1+MAXSYSARG)*BY2WD;
	/*
	 * User Stack, pass input arguments to boot process
	 */
	s = newseg(SG_STACK, USTKTOP-USTKSIZE, USTKSIZE/BY2PG);
	p->seg[SSEG] = s;
	pg = newpage(1, 0, USTKTOP-BY2PG);
	segpage(s, pg);
	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);

	/* Text */
	s = newseg(SG_TEXT, UTZERO, 1);
	s->flushme++;
	p->seg[TSEG] = s;
	pg = newpage(1, 0, UTZERO);
	memset(pg->cachectl, PG_TXTFLUSH, sizeof(pg->cachectl));
	segpage(s, pg);
	k = kmap(s->map[0]->pages[0]);
	memmove((ulong*)VA(k), initcode, sizeof initcode);
	kunmap(k);

	ready(p);
}

void
exit(long type)
{
	int timer;

	spllo();
	print("cpu %d exiting %d\n", m->machno, type);
	timer = 0;
	while(active.machs || consactive()) {
		if(timer++ > 400)
			break;
		delay(10);
	}
	splhi();
	for(;;)
		;
}

void
confinit(void)
{
	ulong ktop, top;

	/*
	 *  divide memory twixt user pages and kernel. Since
	 *  the kernel can't use anything above .5G unmapped,
	 *  make sure all that memory goes to the user.
	 */
	ktop = PGROUND((ulong)end);
	ktop = PADDR(ktop);
	top = (16*1024*1024)/BY2PG;

	conf.base0 = 0;
	conf.npage0 = top;
	conf.npage = conf.npage0;
	conf.npage0 -= ktop/BY2PG;
	conf.base0 += ktop;
	conf.npage1 = 0;
	conf.base1 = 0;

	conf.upages = (conf.npage*90)/100;
	if(top - conf.upages > (256*1024*1024)/BY2PG)
		conf.upages = top - (256*1024*1024)/BY2PG;

	conf.nmach = 1;

	/* set up other configuration parameters */
	conf.nproc = 100;
	conf.nswap = 262144;
	conf.nimage = 200;
	conf.ipif = 8;
	conf.ip = 64;
	conf.arp = 32;
	conf.frag = 32;

	conf.copymode = 0;		/* copy on reference */
}


/*
 *  for the sake of devcons
 */
void
lights(int v)
{
	USED(v);
}

void
buzz(int f, int d)
{
	USED(f);
	USED(d);
}

int
mouseputc(IOQ *q, int c)
{
	USED(q);
	USED(c);
	return 0;
}

.
## diffname carrera/main.c 1993/0904
## diff -e /n/fornaxdump/1993/0903/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0904/sys/src/brazil/carrera/main.c
307c
	conf.nswap = conf.npage*3;
.
299c
	conf.upages = (conf.npage*70)/100;
.
271d
266,269c
	while(consactive())
.
169c

	icflush((ulong*)UTLBMISS, 8*1024);
.
157c
	/*
	 * Map Interrupt control
	 */
	phys = PPN(Intctlphys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	puttlbx(2, Intctlvirt, phys, PTEGLOBL, PGSZ4K);

	*(ushort*)Intenareg = 0xffff;
.
155a
	puttlbx(1, Devicevirt, phys, PTEGLOBL, PGSZ64K);
.
154a
	/*
	 * Map devices
	 */
.
143a

.
75c
}bootenv[] =
{
.
63d
50a

.
49c

	NS16552setup(Uart1, UartFREQ);
.
37d
## diffname carrera/main.c 1993/0905
## diff -e /n/fornaxdump/1993/0904/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0905/sys/src/brazil/carrera/main.c
323c
	conf.copymode = 0;		/* copy on write */
.
309,310d
291,295d
278c
	print("cpu %d exiting\n", m->machno);
.
275c
	USED(type);
.
172a
 * All DMA and ether IO buffers must reside in the first 16M bytes of
 * memory to be covered by the translation registers
 */
void
iomapinit(void)
{
	int i;
	Tte *t;

	t = xspanalloc(Ntranslation*sizeof(Tte), BY2PG, 0);

	for(i = 0; i < Ntranslation; i++)
		t[i].lo = i<<PGSHIFT;

	/* Set the translation table */
	IO(ulong, Ttbr) = PADDR(t);
	IO(ulong, Tlrb) = (Ntranslation-1)*sizeof(Tte);

	/* Invalidate the old entries */
	IO(ulong, Tir) = 0;
}

/*
.
171a
void
enetaddr(uchar *ea)
{
	/** BUG get from PROM */
	static uchar tea[] = { 0x00, 0x00, 0x77, 0x01, 0xD2, 0xba };

	memmove(ea, tea, sizeof(tea));
}

.
169c
	/* Enable all devce interrupt */
	IO(ushort, Intenareg) = 0xffff;
.
149a
 * Set up a console on serial port 2
 */
void
serialinit(void)
{
	NS16552setup(Uart1, UartFREQ);
	NS16552special(0, 9600, &kbdq, &printq, kbdcr2nl);
}

/*
.
146a

	active.exiting = 0;
	active.machs = 1;
.
145a
	m->speed = 50;
.
60a
enab();
spllo();
for(;;)
  ;
.
48,51c
	serialinit();
.
46a
	iomapinit();
.
43,44d
## diffname carrera/main.c 1993/0906
## diff -e /n/fornaxdump/1993/0905/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0906/sys/src/brazil/carrera/main.c
382,390d
362a
	conf.monitor = 1;

.
193c
	for(i = 0; i < 8; i++)
		tbuf[i] = ((uchar*)(NvramRO+Enetoffset))[i];

	print("ether:");
	for(i = 0; i < 6; i++) {
		ea[i] = tbuf[7-i];
		print("%2.2ux", ea[i]);
	}
	print("\n");
.
190,191c
	int i;
	uchar tbuf[8];
.
186a
/*
 * Pull the ethernet address out of NVRAM
 */
.
180,181c
	intphys = PPN(Intctlphys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	puttlbx(2, Intctlvirt, intphys, PTEGLOBL, PGSZ4K);
.
176a
	puttlbx(1, Devicevirt, devphys, isaphys, PGSZ64K);

.
174,175c
	devphys = PPN(Devicephys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	isaphys = PPN(Eisaphys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
.
172c
	 * Map devices and the Eisa control space
.
169c
	ulong devphys, isaphys, intphys;
.
57,60c
screeninit();
.
## diffname carrera/main.c 1993/0907
## diff -e /n/fornaxdump/1993/0906/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0907/sys/src/brazil/carrera/main.c
382,386d
373c
	conf.monitor = 0;
.
271,272d
181a
	puttlbx(2, Intctlvirt, intphys, isamphys, PGSZ1M);

.
180c
	isamphys = PPN(Eisamphys)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
.
177c
	 * Map Interrupt control & Eisa memory
.
166c
	ulong devphys, isaphys, intphys, isamphys;
.
157a

	kbdinit();
.
57d
49a
/*screeninit();*/
.
## diffname carrera/main.c 1993/0908
## diff -e /n/fornaxdump/1993/0907/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0908/sys/src/brazil/carrera/main.c
187a

	/* Look at the first 16M of Eisa memory */
iprint("write latch\n");
/*	IO(uchar, EisaLatch) = 0; /**/
iprint("done\n");
.
181,182c
	intphys  = IOPTE|PPN(Intctlphys);
	isamphys = IOPTE|PPN(Eisamphys);
.
173,174c
	devphys = IOPTE|PPN(Devicephys);
	isaphys = IOPTE|PPN(Eisaphys);
.
50c
 screeninit(); /**/
.
## diffname carrera/main.c 1993/0909
## diff -e /n/fornaxdump/1993/0908/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0909/sys/src/brazil/carrera/main.c
50c
screeninit(); 
.
## diffname carrera/main.c 1993/0914
## diff -e /n/fornaxdump/1993/0909/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0914/sys/src/brazil/carrera/main.c
174c
	isaphys = /* IOPTE|PPN(Eisaphys) */ PTEGLOBL;
.
50c
/* screeninit(); */
.
## diffname carrera/main.c 1993/0915
## diff -e /n/fornaxdump/1993/0914/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0915/sys/src/brazil/carrera/main.c
182c
	isamphys = /* IOPTE|PPN(Eisamphys) */ PTEGLOBL;
.
55d
53a
	links();
.
## diffname carrera/main.c 1993/0918
## diff -e /n/fornaxdump/1993/0915/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0918/sys/src/brazil/carrera/main.c
380c
	conf.monitor = 1;
.
367c
	conf.upages = (conf.npage*50)/100;
.
192d
190d
182d
174d
170a
	 * If you want to segattach the eisa space these
	 * mappings must be turned off to prevent duplication
	 * of the tlb entries
	 */
	if(mapeisa) {
		isaphys = IOPTE|PPN(Eisaphys)|PTEGLOBL;
		isamphys = 0x04000000|IOPTE|PTEGLOBL;
	}
	else {
		isaphys = PTEGLOBL;
		isamphys = PTEGLOBL;
	}

	/*
.
166c
ioinit(int mapeisa)
.
49,50c
	screeninit();
	print("\n\nBrazil\n");
.
38c
	ioinit(1);
.
## diffname carrera/main.c 1993/0930
## diff -e /n/fornaxdump/1993/0918/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/0930/sys/src/brazil/carrera/main.c
280c
		sprint(buf, "%s R4400PC", conffile);
.
## diffname carrera/main.c 1993/1005
## diff -e /n/fornaxdump/1993/0930/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1005/sys/src/brazil/carrera/main.c
280c
		sprint(buf, "carrera %s R4400PC", conffile);
.
## diffname carrera/main.c 1993/1015
## diff -e /n/fornaxdump/1993/1005/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1015/sys/src/brazil/carrera/main.c
377c
	conf.upages = (conf.npage*70)/100;
.
139a
	memset(m, 0, sizeof(Mach));

.
50c
	iprint("\n\nBrazil\n");
.
## diffname carrera/main.c 1993/1208
## diff -e /n/fornaxdump/1993/1015/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1208/sys/src/brazil/carrera/main.c
204a
}

void	puttlbxx(int, ulong, ulong, ulong, int);
void	puttlbx(int a, ulong b, ulong c, ulong d, int e)
{
	static int done[4];

	if(((c|d)&PTEVALID) && a < 4){
		if(done[a]++)
			puttlbx(a, b, c, d, e);
	}
	puttlbxx(a, b, c, d, e);
.
200c
	/* Enable all device interrupts */
.
## diffname carrera/main.c 1993/1209
## diff -e /n/fornaxdump/1993/1208/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1209/sys/src/brazil/carrera/main.c
8a
int	junk[32];

.
## diffname carrera/main.c 1993/1210
## diff -e /n/fornaxdump/1993/1209/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1210/sys/src/brazil/carrera/main.c
420a
}

void
rdbginit(void)
{
	memmove((void*)0xA001C000, rdbgcode, rdbglen);
.
209,220d
59a
	rdbginit();
.
35a
extern	uchar rdbgcode[];
extern	ulong	rdbglen;

.
9,10d
## diffname carrera/main.c 1993/1214
## diff -e /n/fornaxdump/1993/1210/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1214/sys/src/brazil/carrera/main.c
417a

void
procsave(Proc *p)
{
	/* keep track of tlbfaults */
	up->counter[TLBCNTR] += m->tlbfault - m->otlbfault;
	m->otlbfault = m->tlbfault;
}
.
## diffname carrera/main.c 1993/1216
## diff -e /n/fornaxdump/1993/1214/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1216/sys/src/brazil/carrera/main.c
421a
	USED(p);

.
## diffname carrera/main.c 1993/1217
## diff -e /n/fornaxdump/1993/1216/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1217/sys/src/brazil/carrera/main.c
424,426c
	/* Only interested in the PC */
	Mipsjmpbuf.pc = 0xA001C020;

	/* Link an NMI handler to the debugger
	 * - addresses from the ARCS rom source
	 */
	vec = (uchar*)0xA0000420;
	jba = (ulong)UNCACHED(void, &Mipsjmpbuf);

	vec[0] = 'N';
	vec[1] = 'm';
	vec[2] = 'i';
	vec[3] = 's';
	vec[4] = jba>>24;
	vec[5] = jba>>16;
	vec[6] = jba>>8;
	vec[7] = jba;

	/* Install the debugger code in a known place */
	memmove((void*)0xA001C000, rdbgcode, rdbglen);
.
422c
	uchar *vec;
	ulong jba;
.
420c
rdbginit(void)
.
416,417c
	ulong	pc;
	ulong	sp;
	ulong	fp;
	ulong	s[7];
} Mipsjmpbuf;
.
413,414c
/*
	register offsets of ARCS prom jmpbuf
		JB_PC		0
		JB_SP		1
		JB_FP		2
		JB_S0		3
		JB_S1		4
		JB_S2		5
		JB_S3		6
		JB_S4		7
		JB_S5		8
		JB_S6		9
		JB_S7		10
*/

struct 
.
402,404c
	/* keep track of tlbfaults */
	up->counter[TLBCNTR] += m->tlbfault - m->otlbfault;
	m->otlbfault = m->tlbfault;
}
.
400a
void
procsave(Proc *p)
{
	USED(p);
.
64a

.
40,41c
	rdbginit();
	tlbinit();
	ioinit(1);		/* Very early to establish IO mappings */
.
## diffname carrera/main.c 1993/1218
## diff -e /n/fornaxdump/1993/1217/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1218/sys/src/brazil/carrera/main.c
209,210c
	/* Map the rom back into Promvirt to allow NMI handling */
	promphys = IOPTE|PPN(Promphys);

	puttlbx(3, Promvirt, promphys, PTEGLOBL, PGSZ1M);
.
176c
	ulong devphys, isaphys, intphys, isamphys, promphys;
.
40d
## diffname carrera/main.c 1993/1219
## diff -e /n/fornaxdump/1993/1218/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1219/sys/src/brazil/carrera/main.c
394,397d
## diffname carrera/main.c 1993/1221
## diff -e /n/fornaxdump/1993/1219/sys/src/brazil/carrera/main.c /n/fornaxdump/1993/1221/sys/src/brazil/carrera/main.c
365,366c
	/* Turn off the NMI hander for the debugger */
	vec = (uchar*)0xA0000420;
	vec[0] = 0;
	/* Call the prom */
	((void(*)(void))0xBFC00000)();
.
363a

.
357a
	uchar *vec;

.
## diffname carrera/main.c 1994/0115
## diff -e /n/fornaxdump/1993/1221/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0115/sys/src/brazil/carrera/main.c
251c
	IO(ulong, Tlrb) = Ntranslation*sizeof(Tte);
.
## diffname carrera/main.c 1994/0126
## diff -e /n/fornaxdump/1994/0115/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0126/sys/src/brazil/carrera/main.c
471c
	memmove((void*)0x8001C000, rdbgcode, rdbglen);
.
453c
	Mipsjmpbuf.pc = 0x8001C020;
.
## diffname carrera/main.c 1994/0207
## diff -e /n/fornaxdump/1994/0126/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0207/sys/src/brazil/carrera/main.c
274a

.
## diffname carrera/main.c 1994/0210
## diff -e /n/fornaxdump/1994/0207/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0210/sys/src/brazil/carrera/main.c
274d
211a

	/* 8 MB video ram config */
	v = IO(ulong, 0xE0000004);
	v &= ~(3<<8);
	v |= (2<<8);
	IO(ulong, 0xE0000004) = v;

	/* Map the display hardware */
	ptec = PPN(VideoCTL)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	ptes = PPN(VideoMEM)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	puttlbx(4, Screenvirt, ptes, ptec, PGSZ4M);
.
210d
202d
195d
175c
	ulong devphys, isaphys, intphys, isamphys, promphys, ptec, ptes, v;
.
## diffname carrera/main.c 1994/0225
## diff -e /n/fornaxdump/1994/0210/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0225/sys/src/brazil/carrera/main.c
219a

	/* for PC weenies */
	/*
	 *  Set up the first 8259 interrupt processor.
	 *  Make 8259 interrupts start at CPU vector Int0vec.
	 *  Set the 8259 as master with edge triggered
	 *  input with fully nested interrupts.
	 */
	EISAOUTB(Int0ctl, 0x11);		/* ICW1 - edge triggered, master,
						   ICW4 will be sent */
	EISAOUTB(Int0aux, Int0vec);		/* ICW2 - interrupt vector offset */
	EISAOUTB(Int0aux, 0x04);		/* ICW3 - have slave on level 2 */
	EISAOUTB(Int0aux, 0x01);		/* ICW4 - 8086 mode, not buffered */

	/*
	 *  Set up the second 8259 interrupt processor.
	 *  Make 8259 interrupts start at CPU vector Int0vec.
	 *  Set the 8259 as master with edge triggered
	 *  input with fully nested interrupts.
	 */
	EISAOUTB(Int1ctl, 0x11);		/* ICW1 - edge triggered, master,
						   ICW4 will be sent */
	EISAOUTB(Int1aux, Int1vec);		/* ICW2 - interrupt vector offset */
	EISAOUTB(Int1aux, 0x02);		/* ICW3 - I am a slave on level 2 */
	EISAOUTB(Int1aux, 0x01);		/* ICW4 - 8086 mode, not buffered */

	/*
	 *  pass #2 8259 interrupts to #1
	 */
	int0mask &= ~0x04;
	EISAOUTB(Int0aux, int0mask);

	/* enable all PC interrupts except the clock */
	int0mask |= 1<<(Clockvec&7);
	EISAOUTB(Int0aux, int0mask);
	int1mask = 0;
	EISAOUTB(Int1aux, int1mask);
.
33a
int	int0mask = 0xff;	/* interrupts enabled for first 8259 */
int	int1mask = 0xff;	/* interrupts enabled for second 8259 */

.
## diffname carrera/main.c 1994/0305
## diff -e /n/fornaxdump/1994/0225/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0305/sys/src/brazil/carrera/main.c
243,247c
	EISAOUTB(Int1ctl, 0x11);	/* ICW1 - edge triggered, master,
					   ICW4 will be sent */
	EISAOUTB(Int1aux, Int1vec);	/* ICW2 - interrupt vector offset */
	EISAOUTB(Int1aux, 0x02);	/* ICW3 - I am a slave on level 2 */
	EISAOUTB(Int1aux, 0x01);	/* ICW4 - 8086 mode, not buffered */
.
231,235c
	EISAOUTB(Int0ctl, 0x11);	/* ICW1 - edge triggered, master,
					   ICW4 will be sent */
	EISAOUTB(Int0aux, Int0vec);	/* ICW2 - interrupt vector offset */
	EISAOUTB(Int0aux, 0x04);	/* ICW3 - have slave on level 2 */
	EISAOUTB(Int0aux, 0x01);	/* ICW4 - 8086 mode, not buffered */
.
## diffname carrera/main.c 1994/0306
## diff -e /n/fornaxdump/1994/0305/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0306/sys/src/brazil/carrera/main.c
259a

	IO(ulong, R4030ier) = 0xf;	/* enable eisa interrupts */
.
257a

.
255a
	int0mask &= ~((1<<2)|(1<<5));
.
252,253d
## diffname carrera/main.c 1994/0307
## diff -e /n/fornaxdump/1994/0306/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0307/sys/src/brazil/carrera/main.c
254c
	int0mask = 0;
.
## diffname carrera/main.c 1994/0308
## diff -e /n/fornaxdump/1994/0307/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0308/sys/src/brazil/carrera/main.c
501a
	return;	/* Not installed now */

.
## diffname carrera/main.c 1994/0322
## diff -e /n/fornaxdump/1994/0308/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0322/sys/src/brazil/carrera/main.c
501,502d
442a
	conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
.
334d
157a

	/* Setup call back ring buffer */
	m->cbin = m->calls;
	m->cbout = m->calls;
	m->cbend = &m->calls[NCALLBACK];
.
64d
44a
	rdbginit();
.
## diffname carrera/main.c 1994/0327
## diff -e /n/fornaxdump/1994/0322/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0327/sys/src/brazil/carrera/main.c
506c
return;
.
## diffname carrera/main.c 1994/0330
## diff -e /n/fornaxdump/1994/0327/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0330/sys/src/brazil/carrera/main.c
212c
	IO(ushort, Intenareg) = 0xfff7;
.
146c
	((void(*)(void))((ulong)cleancache|0xA0000000))();
.
## diffname carrera/main.c 1994/0405
## diff -e /n/fornaxdump/1994/0330/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0405/sys/src/brazil/carrera/main.c
506c
return;/**/
.
## diffname carrera/main.c 1994/0410
## diff -e /n/fornaxdump/1994/0405/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0410/sys/src/brazil/carrera/main.c
526c
	memmove((void*)0xA001C000, rdbgcode, rdbglen);
.
506c
/*return;/**/
.
## diffname carrera/main.c 1994/0411
## diff -e /n/fornaxdump/1994/0410/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0411/sys/src/brazil/carrera/main.c
526c
	memmove((void*)0x8001C000, rdbgcode, rdbglen);
.
## diffname carrera/main.c 1994/0413
## diff -e /n/fornaxdump/1994/0411/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0413/sys/src/brazil/carrera/main.c
506c
return;/**/
.
## diffname carrera/main.c 1994/0415
## diff -e /n/fornaxdump/1994/0413/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0415/sys/src/brazil/carrera/main.c
526c
	memmove((void*)0xA001C000, rdbgcode, rdbglen);
.
508c
	Mipsjmpbuf.pc = 0xA001C020;
.
## diffname carrera/main.c 1994/0508
## diff -e /n/fornaxdump/1994/0415/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0508/sys/src/brazil/carrera/main.c
158,162d
## diffname carrera/main.c 1994/0516
## diff -e /n/fornaxdump/1994/0508/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0516/sys/src/brazil/carrera/main.c
207c
	IO(ushort, Intenareg) = 0xffff;
.
## diffname carrera/main.c 1994/0519
## diff -e /n/fornaxdump/1994/0516/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0519/sys/src/brazil/carrera/main.c
57a
	iprint("M(PRID) = 0x%.8lux\n", getprid());
.
## diffname carrera/main.c 1994/0520
## diff -e /n/fornaxdump/1994/0519/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0520/sys/src/brazil/carrera/main.c
58d
## diffname carrera/main.c 1994/0528
## diff -e /n/fornaxdump/1994/0520/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0528/sys/src/brazil/carrera/main.c
420,421c

	firmware(type);
.
412c
	print("cpu%d exiting\n", m->machno);
.
## diffname carrera/main.c 1994/0609
## diff -e /n/fornaxdump/1994/0528/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0609/sys/src/brazil/carrera/main.c
313c
	memmove((ulong*)UTLBMISS, (ulong*)vector0, 0x80);
	memmove((ulong*)XEXCEPTION, (ulong*)vector0, 0x80);
.
## diffname carrera/main.c 1994/0612
## diff -e /n/fornaxdump/1994/0609/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0612/sys/src/brazil/carrera/main.c
463d
## diffname carrera/main.c 1994/0617
## diff -e /n/fornaxdump/1994/0612/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0617/sys/src/brazil/carrera/main.c
313,314c
	memmove((ulong*)UTLBMISS, (ulong*)vector0, 0x100);
.
## diffname carrera/main.c 1994/0619
## diff -e /n/fornaxdump/1994/0617/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0619/sys/src/brazil/carrera/main.c
313c
	memmove((ulong*)UTLBMISS, (ulong*)vector0, 0x80);
	memmove((ulong*)XEXCEPTION, (ulong*)vector0, 0x80);
.
## diffname carrera/main.c 1994/0621
## diff -e /n/fornaxdump/1994/0619/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0621/sys/src/brazil/carrera/main.c
167,168d
## diffname carrera/main.c 1994/0728
## diff -e /n/fornaxdump/1994/0621/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0728/sys/src/brazil/carrera/main.c
456,464d
## diffname carrera/main.c 1994/0806
## diff -e /n/fornaxdump/1994/0728/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0806/sys/src/brazil/carrera/main.c
415a
	if(type == 1)
		for(;;);

.
## diffname carrera/main.c 1994/0812
## diff -e /n/fornaxdump/1994/0806/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0812/sys/src/brazil/carrera/main.c
361a
	p->rgrp = newrgrp();
.
## diffname carrera/main.c 1994/0902
## diff -e /n/fornaxdump/1994/0812/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/0902/sys/src/brazil/carrera/main.c
166c
	ns16552install();
.
## diffname carrera/main.c 1994/1019
## diff -e /n/fornaxdump/1994/0902/sys/src/brazil/carrera/main.c /n/fornaxdump/1994/1019/sys/src/brazil/carrera/main.c
434c
	top = memsize()/BY2PG;
.
426a
ulong
memsize(void)
{
	ulong gcr;

	gcr = IO(ulong, MCTgcr);
	/* Check for bank one enable -
	 * assumes both have 4Meg SIMMS
	 */
	if(gcr & 0x20){
		memset(UNCACHED(void, 16*MB), 0, 16*MB);
		return 32*MB;
	}
	return 16*MB;
}

.
## diffname carrera/main.c 1995/0131
## diff -e /n/fornaxdump/1994/1019/sys/src/brazil/carrera/main.c /n/fornaxdump/1995/0131/sys/src/brazil/carrera/main.c
324a
{
	uchar *p;
	int x;

	for(p = (uchar*)(0xA0000000|16*MB); p<(uchar*)(0xA0000000|32*MB); p+=16){
		if((((ulong)p) & 0x3FFF)==0)
			print("%lux ", p);
		x = *p;
	}
}
.
57c
	print("\n\nBrazil\n");
.
## diffname carrera/main.c 1995/0201
## diff -e /n/fornaxdump/1995/0131/sys/src/brazil/carrera/main.c /n/fornaxdump/1995/0201/sys/src/brazil/carrera/main.c
325,334d
## diffname carrera/main.c 1995/0214
## diff -e /n/fornaxdump/1995/0201/sys/src/brazil/carrera/main.c /n/fornaxdump/1995/0214/sys/src/brazil/carrera/main.c
482a
 * dummy routine for interoperability with pc's
 */
int
isaconfig(char *class, int ctlrno, ISAConf *isa)
{
	if(strcmp(class, "audio") == 0 && ctlrno == 0){
		strcpy(isa->type, "sb16");
		isa->port = 0x220;
		isa->irq = 7;
		return 1;
	}
	return 0;
}

/*
.
## diffname carrera/main.c 1995/0215
## diff -e /n/fornaxdump/1995/0214/sys/src/brazil/carrera/main.c /n/fornaxdump/1995/0215/sys/src/brazil/carrera/main.c
490,491d
## diffname carrera/main.c 1995/0308
## diff -e /n/fornaxdump/1995/0215/sys/src/brazil/carrera/main.c /n/fornaxdump/1995/0308/sys/src/brazil/carrera/main.c
57c
/*	iprint("\n\nBrazil\n");		/**/
.
## diffname carrera/main.c 1997/0117
## diff -e /n/fornaxdump/1995/0308/sys/src/brazil/carrera/main.c /n/fornaxdump/1997/0117/sys/src/brazil/carrera/main.c
405c
exit(int type)
.
## diffname carrera/main.c 1997/0201
## diff -e /n/fornaxdump/1997/0117/sys/src/brazil/carrera/main.c /n/emeliedump/1997/0201/sys/src/brazil/carrera/main.c
336c
		ksetenv("cputype", "mips2");
.
## diffname carrera/main.c 1997/0202
## diff -e /n/emeliedump/1997/0201/sys/src/brazil/carrera/main.c /n/emeliedump/1997/0202/sys/src/brazil/carrera/main.c
336c
		ksetenv("cputype", "mips");
.
## diffname carrera/main.c 1997/0327
## diff -e /n/emeliedump/1997/0202/sys/src/brazil/carrera/main.c /n/emeliedump/1997/0327/sys/src/brazil/carrera/main.c
331c
	up->dot = cclone(up->slash, 0);
.
111c
			for(i=0; i < nelem(bootenv); i++){
.
## diffname carrera/main.c 1997/0603
## diff -e /n/emeliedump/1997/0327/sys/src/brazil/carrera/main.c /n/emeliedump/1997/0603/sys/src/brazil/carrera/main.c
361a
	p->fgrp->fd = smalloc(DELTAFD*sizeof(Chan*));
	p->fgrp->nfd = DELTAFD;
.
## diffname carrera/main.c 1997/0606
## diff -e /n/emeliedump/1997/0603/sys/src/brazil/carrera/main.c /n/emeliedump/1997/0606/sys/src/brazil/carrera/main.c
360,363c
	p->fgrp = dupfgrp(nil);
.
## diffname carrera/main.c 1997/1101
## diff -e /n/emeliedump/1997/0606/sys/src/brazil/carrera/main.c /n/emeliedump/1997/1101/sys/src/brazil/carrera/main.c
459c
	if(top > 16*MB){
		conf.upages = (conf.npage*60)/100;
		poolsetparam("Image", 0, 0, 4*1024*1024);
	}else
		conf.upages = (conf.npage*40)/100;
.
61d
7a
#include	"pool.h"
.
## diffname carrera/main.c 1997/1210
## diff -e /n/emeliedump/1997/1101/sys/src/brazil/carrera/main.c /n/emeliedump/1997/1210/sys/src/brazil/carrera/main.c
492a
		return 1;
	}
	if(cistrcmp(class, "ether") == 0 && ctlrno == 0){
		strcpy(isa->type, "sonic");
.
491c
	if(cistrcmp(class, "audio") == 0 && ctlrno == 0){
.
484a
int
cistrcmp(char *a, char *b)
{
	int ac, bc;

	for(;;){
		ac = *a++;
		bc = *b++;
	
		if(ac >= 'A' && ac <= 'Z')
			ac = 'a' + (ac - 'A');
		if(bc >= 'A' && bc <= 'Z')
			bc = 'a' + (bc - 'A');
		ac -= bc;
		if(ac)
			return ac;
		if(bc == 0)
			break;
	}
	return 0;
}

.
## diffname carrera/main.c 1997/1211
## diff -e /n/emeliedump/1997/1210/sys/src/brazil/carrera/main.c /n/emeliedump/1997/1211/sys/src/brazil/carrera/main.c
302a

	/* Invalidate R4030 I/O cache */
	for(i=0; i<8; i++){
		*(ulong*)0xE0000034 = i<<2;
		*(ulong*)0xE000004C = 0;
	}
.
## diffname carrera/main.c 1998/0121
## diff -e /n/emeliedump/1997/1211/sys/src/brazil/carrera/main.c /n/emeliedump/1998/0121/sys/src/brazil/carrera/main.c
465c
	if(top > 16*MB/BY2PG){
.
## diffname carrera/main.c 1998/0502
## diff -e /n/emeliedump/1998/0121/sys/src/brazil/carrera/main.c /n/emeliedump/1998/0502/sys/src/brazil/carrera/main.c
61a
	links();
.
## diffname carrera/main.c 1998/0610
## diff -e /n/emeliedump/1998/0502/sys/src/brazil/carrera/main.c /n/emeliedump/1998/0610/sys/src/brazil/carrera/main.c
415a

	lock(&active);
	active.machs &= ~(1<<m->machno);
	active.exiting = 1;
	unlock(&active);
.
147c
	configreg = ((int(*)(void))((ulong)cleancache|0xA0000000))();
.
58a
	print("Brazil config reg %#lux\n", configreg);
.
33a
int	configreg;
.
## diffname carrera/main.c 1998/0916
## diff -e /n/emeliedump/1998/0610/sys/src/brazil/carrera/main.c /n/emeliedump/1998/0916/sys/src/brazil/carrera/main.c
484a
	conf.nswppo = 4096;
.
## diffname carrera/main.c 1999/0128
## diff -e /n/emeliedump/1998/0916/sys/src/brazil/carrera/main.c /n/emeliedump/1999/0128/sys/src/brazil/carrera/main.c
475c
		poolsetparam("Image", 0, 0, 4*1024*1024, nil);
.
## diffname carrera/main.c 1999/0629
## diff -e /n/emeliedump/1999/0128/sys/src/brazil/carrera/main.c /n/emeliedump/1999/0629/sys/src/brazil/carrera/main.c
339a
	cnameclose(up->slash->name);
	up->slash->name = newcname("/");
.
60c
	print("Brazil config reg %#ux\n", configreg);
.
## diffname carrera/main.c 1999/0711
## diff -e /n/emeliedump/1999/0629/sys/src/brazil/carrera/main.c /n/emeliedump/1999/0711/sys/src/brazil/carrera/main.c
477c
		poolconfig(imagmem, 0, 4*1024*1024, 0, nil);
.
## diffname carrera/main.c 1999/0712
## diff -e /n/emeliedump/1999/0711/sys/src/brazil/carrera/main.c /n/emeliedump/1999/0712/sys/src/brazil/carrera/main.c
477c
		poolsetparam("Image", 0, 0, 4*1024*1024, nil);
.
## diffname carrera/main.c 1999/0713
## diff -e /n/emeliedump/1999/0712/sys/src/brazil/carrera/main.c /n/emeliedump/1999/0713/sys/src/brazil/carrera/main.c
477c
		imagmem->minarena = 4*1024*1024;
.
## diffname carrera/main.c 1999/1005
## diff -e /n/emeliedump/1999/0713/sys/src/brazil/carrera/main.c /n/emeliedump/1999/1005/sys/src/brazil/carrera/main.c
433c
		rdb();
.
67a
	noprint = 0;
.
59,60c
//	print("Brazil config reg %#ux\n", configreg);
.
56a
	iprint("Brazil\n");		/**/
.
44a
	noprint = 1;
.
40a
extern	int	noprint;
.
## diffname carrera/main.c 1999/1031
## diff -e /n/emeliedump/1999/1005/sys/src/brazil/carrera/main.c /n/emeliedump/1999/1031/sys/src/9/carrera/main.c
62d
59c
	iprint("Plan 9\n");		/**/
.
## diffname carrera/main.c 2001/0424
## diff -e /n/emeliedump/1999/1031/sys/src/9/carrera/main.c /n/emeliedump/2001/0424/sys/src/9/carrera/main.c
591a
}

/*
 *  physical segs unique to the carrera
 */
static Physseg myphyssegs[] =
{
	{ SG_PHYSICAL,	"eisaio",	Eisaphys,	64*1024,	0, 0 },
	{ SG_PHYSICAL,	"eisavga",	Eisavgaphys,	128*1024,	0, 0 },
	{ SG_PHYSICAL,	"bootrom",	0x1fc00000,	256*1024,	0, 0 },
	{ SG_PHYSICAL,	"nvram",	0xe0009000,	12*1024,	0, 0 },
	{ SG_PHYSICAL,	"fb",		0x40000000,	4*1024*1024,	0, 0 },
};

static void
addps(void)
{
	int i;

	for(i = 0; i < nelem(myphyssegs); i++)
		addphysseg(&myphyssegs[i]);
.
65a
	addps();
.
42a
static void	addps(void);

.
## diffname carrera/main.c 2001/0527 # deleted
## diff -e /n/emeliedump/2001/0424/sys/src/9/carrera/main.c /n/emeliedump/2001/0527/sys/src/9/carrera/main.c
1,616d

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.