~kris/9p

9hist

01e08d2944bf8ed12eac42bf452fff79c40a367f — David du Colombier 29 years ago b86cb5b
Plan 9 from Bell Labs 1997-03-31
3 files changed, 37 insertions(+), 16 deletions(-)

M pc/ether8003.c
M pc/fns.h
M pc/memory.c
M pc/ether8003.c => pc/ether8003.c +5 -5
@@ 205,11 205,11 @@ reset(Ether* ether)
		ether->size = 8*1024;

	/*
	 * Look for the interface. We read the LAN address ROM
	 * Look for the interface. Read the LAN address ROM
	 * and validate the checksum - the sum of all 8 bytes
	 * should be 0xFF.
	 * While we're at it, get the (possible) interface chip
	 * registers, we'll use them to check for aliasing later.
	 * At the same time, get the (possible) interface chip
	 * registers, they'll be used later to check for aliasing.
	 */
	port = ether->port;
	sum = 0;


@@ 253,8 253,8 @@ reset(Ether* ether)
	}
	dp8390setea(ether);

	if(umbrmalloc(PADDR(ether->mem), ether->size, 0) == 0)
		panic("ether8003: 0x%luX unavailable", PADDR(ether->mem));
	if(umbrwmalloc(PADDR(ether->mem), ether->size, 0) == 0)
		print("ether8003: warning - 0x%luX unavailable", PADDR(ether->mem));

	return 0;
}

M pc/fns.h => pc/fns.h +2 -1
@@ 97,8 97,9 @@ void	touser(void*);
void	trapinit(void);
int	tas(void*);
ulong	umbmalloc(ulong, int, int);
ulong	umbrmalloc(ulong, int, int);
void	umbfree(ulong, int);
ulong	umbrwmalloc(ulong, int, int);
void	umbrwfree(ulong, int);
ulong	upamalloc(ulong, int, int);
void	upafree(ulong, int);
void	vectortable(void);

M pc/memory.c => pc/memory.c +30 -10
@@ 67,11 67,11 @@ static RMap rmapumb = {
	&mapumb[63],
};

static Map mapumbr[8];
static RMap rmapumbr = {
static Map mapumbrw[8];
static RMap rmapumbrw = {
	"UMB device memory",
	mapumbr,
	&mapumbr[7],
	mapumbrw,
	&mapumbrw[7],
};

#define notdef


@@ 85,14 85,14 @@ dumpmembank(void)
	maxpa = (nvramread(0x18)<<8)|nvramread(0x17);
	maxpa1 = (nvramread(0x31)<<8)|nvramread(0x30);
	maxpa2 = (nvramread(0x16)<<8)|nvramread(0x15);
	print("maxpa = %uX -> %uX, maxpa1 = %uXm maxpa2 = %uX\n",
	print("maxpa = %uX -> %uX, maxpa1 = %uX maxpa2 = %uX\n",
		maxpa, MB+maxpa*KB, maxpa1, maxpa2);

	for(mp = rmapram.map; mp->size; mp++)
		print("%8.8uX %8.8uX %8.8uX\n", mp->addr, mp->size, mp->addr+mp->size);
	for(mp = rmapumb.map; mp->size; mp++)
		print("%8.8uX %8.8uX %8.8uX\n", mp->addr, mp->size, mp->addr+mp->size);
	for(mp = rmapumbr.map; mp->size; mp++)
	for(mp = rmapumbrw.map; mp->size; mp++)
		print("%8.8uX %8.8uX %8.8uX\n", mp->addr, mp->size, mp->addr+mp->size);
	for(mp = rmapupa.map; mp->size; mp++)
		print("%8.8uX %8.8uX %8.8uX\n", mp->addr, mp->size, mp->addr+mp->size);


@@ 212,7 212,7 @@ umbscan(void)
	while(p < (uchar*)KADDR(0xE0000)){
		p[0] = 0xCC;
		p[2*KB-1] = 0xCC;
		if(p[0] != 0xCC && p[2*KB-1] != 0xCC){
		if(p[0] != 0xCC || p[2*KB-1] != 0xCC){
			p[0] = 0x55;
			p[1] = 0xAA;
			p[2] = 4;


@@ 223,7 223,7 @@ umbscan(void)
			mapfree(&rmapumb, PADDR(p), 2*KB);
		}
		else
			mapfree(&rmapumbr, PADDR(p), 2*KB);
			mapfree(&rmapumbrw, PADDR(p), 2*KB);
		p += 2*KB;
	}



@@ 481,16 481,36 @@ umbfree(ulong addr, int size)
}

ulong
umbrmalloc(ulong addr, int size, int align)
umbrwmalloc(ulong addr, int size, int align)
{
	ulong a;
	uchar *p;

	if(a = mapalloc(&rmapumbr, addr, size, align))
	if(a = mapalloc(&rmapumbrw, addr, size, align))
		return KZERO|a;

	/*
	 * Perhaps the memory wasn't visible before
	 * the interface is initialised, so try again.
	 */
	if((a = umbmalloc(addr, size, align)) == 0)
		return 0;
	p = (uchar*)a;
	p[0] = 0xCC;
	p[size-1] = 0xCC;
	if(p[0] == 0xCC && p[size-1] == 0xCC)
		return a;
	umbfree(a, size);

	return 0;
}

void
umbrwfree(ulong addr, int size)
{
	mapfree(&rmapumbrw, addr & ~KZERO, size);
}

ulong
upamalloc(ulong addr, int size, int align)
{