~kris/9p

9hist

5edcddb2b0c45549cedb1305f80922c8d269a540 — David du Colombier 26 years ago aac6b96
Plan 9 from Bell Labs 2000-06-15
3 files changed, 32 insertions(+), 24 deletions(-)

M pc/etherec2t.c
M port/devdraw.c
M port/devroot.c
M pc/etherec2t.c => pc/etherec2t.c +26 -12
@@ 1,7 1,5 @@
/*
 * Linksys Combo PCMCIA EthernetCard (EC2T)
 * and EtherFast 10/100 PC Card (PCMPC100).
 * Supposedly NE2000 clones, see the comments in ether2000.c
 * Supposed NE2000 PCMCIA clones, see the comments in ether2000.c
 */
#include "u.h"
#include "../port/lib.h"


@@ 21,8 19,9 @@ enum {
};

static char* ec2tpcmcia[] = {
	"EC2T",
	"PCMPC100",
	"EC2T",				/* Linksys Combo PCMCIA EthernetCard */
	"PCMPC100",			/* EtherFast 10/100 PC Card */
	"EN2216",			/* Accton EtherPair-PCMCIA */
	nil,
};



@@ 62,6 61,15 @@ reset(Ether* ether)
		if((slot = pcmspecial(type, ether)) >= 0)
			break;
	}
	if(ec2tpcmcia[i] == nil){
		for(i = 0; i < ether->nopt; i++){
			if(cistrncmp(ether->opt[i], "id=", 3))
				continue;
			type = &ether->opt[i][3];
			if((slot = pcmspecial(type, ether)) >= 0)
				break;
		}
	}
	if(slot < 0){
		iofree(port);
		return -1;


@@ 80,6 88,12 @@ reset(Ether* ether)
	ctlr->pstop = ctlr->tstart + HOWMANY(ether->size, Dp8390BufSz);

	ctlr->dummyrr = 0;
	for(i = 0; i < ether->nopt; i++){
		if(cistrcmp(ether->opt[i], "nodummyrr") == 0)
			ctlr->dummyrr = 0;
		else if(cistrncmp(ether->opt[i], "dummyrr=", 8) == 0)
			ctlr->dummyrr = strtol(&ether->opt[i][8], nil, 0);
	}

	/*
	 * Reset the board. This is done by doing a read


@@ 101,13 115,7 @@ reset(Ether* ether)
	 */
	dp8390reset(ether);
	sum = 0;
	if(strcmp(type, "PCMPC100")){
		memset(buf, 0, sizeof(buf));
		dp8390read(ctlr, buf, 0, sizeof(buf));
		if((buf[0x0E] & 0xFF) == 0x57 && (buf[0x0F] & 0xFF) == 0x57)
			sum = 0xFF;
	}
	else{
	if(cistrcmp(type, "PCMPC100") == 0){
		/*
		 * The PCMPC100 has the ethernet address in I/O space.
		 * There's a checksum over 8 bytes which sums to 0xFF.


@@ 118,6 126,12 @@ reset(Ether* ether)
			buf[i] = (x<<8)|x;
		}
	}
	else{
		memset(buf, 0, sizeof(buf));
		dp8390read(ctlr, buf, 0, sizeof(buf));
		if((buf[0x0E] & 0xFF) == 0x57 && (buf[0x0F] & 0xFF) == 0x57)
			sum = 0xFF;
	}
	if(sum != 0xFF){
		pcmspecialclose(slot);
		iofree(ether->port);

M port/devdraw.c => port/devdraw.c +5 -0
@@ 756,6 756,11 @@ drawnewclient(void)
int
drawhasclients(void)
{
	/*
	 * if draw has ever been used, we can't resize the frame buffer,
	 * even if all clients have exited (nclients is cumulative); it's too
	 * hard to make work.
	 */
	return sdraw.nclient != 0;
}


M port/devroot.c => port/devroot.c +1 -12
@@ 176,17 176,6 @@ rootwrite(Chan *c, void*, long, vlong)
	return 0;
}

static void
rootcreate(Chan *c, char *name, int mode, ulong perm)
{
	if(!iseve() || c->qid.path != (CHDIR|Qdir) ||
	   (perm & CHDIR) == 0 || mode != OREAD)
		error(Eperm);
	addrootdir(name);
	c->flag |= COPEN;
	c->mode = OREAD;
}

Dev rootdevtab = {
	'/',
	"root",


@@ 198,7 187,7 @@ Dev rootdevtab = {
	rootwalk,
	rootstat,
	rootopen,
	rootcreate,
	devcreate,
	rootclose,
	rootread,
	devbread,