~kris/9p

9hist

194add6117dd4b0cbb1d2101d22f635c4d374095 — David du Colombier 25 years ago 5d2460d
Plan 9 from Bell Labs 2000-10-05
2 files changed, 51 insertions(+), 30 deletions(-)

M pc/devi82365.c
M pc/mouse.c
M pc/devi82365.c => pc/devi82365.c +51 -26
@@ 121,6 121,7 @@ struct I82365
	int	nslot;
	int	xreg;		/* index register address */
	int	dreg;		/* data register address */
	int	irq;
};
static I82365 *controller[4];
static int ncontroller;


@@ 259,13 260,20 @@ slotena(Slot *pp)
	if(pp->enabled)
		return;

print("-enabling<");
	/* power up and unreset, wait's are empirical (???) */
	wrreg(pp, Rpc, Fautopower|Foutena|Fcardena);
print(">");
	delay(300);
print("<");
	wrreg(pp, Rigc, 0);
print(">");
	delay(100);
print("<");
	wrreg(pp, Rigc, Fnotreset);
print(">");
	delay(500);
print("...");

	/* get configuration */
	slotinfo(pp);


@@ 274,6 282,7 @@ slotena(Slot *pp)
		pp->enabled = 1;
	} else
		wrreg(pp, Rpc, Fautopower);
print("done-");
}

/*


@@ 439,20 448,24 @@ pcmspecial(char *idstr, ISAConf *isa)
	extern char *strstr(char*, char*);

	i82365reset();
print("Looking for %s ...", idstr);
	for(pp = slot; pp < lastslot; pp++){
		if(pp->special)
			continue;	/* already taken */
		increfp(pp);

		if(pp->occupied)
		if(strstr(pp->verstr, idstr))
		if(isa == 0 || pcmio(pp->slotno, isa) == 0){
			pp->special = 1;
			return pp->slotno;
		if(pp->occupied) {
print("[%s] ", pp->verstr);
			if(strstr(pp->verstr, idstr))
			if(isa == 0 || pcmio(pp->slotno, isa) == 0){
				pp->special = 1;
print("done\n");
				return pp->slotno;
			}
		}

		decrefp(pp);
	}
print("not found\n");
	return -1;
}



@@ 531,10 544,12 @@ static char *chipname[] =
};

static I82365*
i82386probe(int x, int d, int dev)
i82365probe(int x, int d, int dev)
{
	uchar c, id;
	I82365 *cp;
	ISAConf isa;
	int i, nslot;

	outb(x, Rid + (dev<<7));
	id = inb(d);


@@ 592,6 607,21 @@ i82386probe(int x, int d, int dev)
	c = inb(d);
	outb(d, c & ~Flowpow);

	memset(&isa, 0, sizeof(ISAConf));
	if(isaconfig("pcmcia", ncontroller, &isa) && isa.irq)
		cp->irq = isa.irq;
	else
		cp->irq = IrqPCMCIA;

	for(i = 0; i < isa.nopt; i++){
		if(cistrncmp(isa.opt[i], "nslot=", 6))
			continue;
		nslot = strtol(&isa.opt[i][6], nil, 0);
		if(nslot > 0 && nslot <= 2)
			cp->nslot = nslot;
	}
print("%uX/%d: nslot = %d\n", x, dev, cp->nslot);

	controller[ncontroller++] = cp;
	return cp;
}


@@ 618,31 648,26 @@ static void
i82365reset(void)
{
	static int already;
	int i, j, irq;
	int i, j;
	I82365 *cp;
	Slot *pp;
	ISAConf isa;
	char buf[NAMELEN];

	if(already)
		return;
	already = 1;

	memset(&isa, 0, sizeof(ISAConf));
	irq = IrqPCMCIA;
	if(isaconfig("pcmcia", 0, &isa) && isa.irq)
		irq = isa.irq;

	/* look for controllers if the ports aren't already taken */
	if(ioalloc(0x3E0, 2, 0, "i82386.0") >= 0){
		i82386probe(0x3E0, 0x3E1, 0);
		i82386probe(0x3E0, 0x3E1, 1);
	if(ioalloc(0x3E0, 2, 0, "i82365.0") >= 0){
		i82365probe(0x3E0, 0x3E1, 0);
		i82365probe(0x3E0, 0x3E1, 1);
		if(ncontroller == 0)
			iofree(0x3E0);
	}
	if(ioalloc(0x3E2, 2, 0, "i82386.1") >= 0){
	if(ioalloc(0x3E2, 2, 0, "i82365.1") >= 0){
		i = ncontroller;
		i82386probe(0x3E2, 0x3E3, 0);
		i82386probe(0x3E2, 0x3E3, 1);
		i82365probe(0x3E2, 0x3E3, 0);
		i82365probe(0x3E2, 0x3E3, 1);
		if(ncontroller == i)
			iofree(0x3E2);
	}


@@ 655,7 680,7 @@ i82365reset(void)
	for(i = 0; i < ncontroller; i++){
		cp = controller[i];
		print("#y%d: %d slot %s: port 0x%uX irq %d\n",
			i, cp->nslot, chipname[cp->type], cp->xreg, irq);
			i, cp->nslot, chipname[cp->type], cp->xreg, cp->irq);
		for(j = 0; j < cp->nslot; j++){
			pp = lastslot++;
			pp->slotno = pp - slot;


@@ 665,14 690,14 @@ i82365reset(void)
			slotdis(pp);

			/* interrupt on status change */
			wrreg(pp, Rcscic, (irq<<4) | Fchangeena);
			wrreg(pp, Rcscic, (cp->irq<<4) | Fchangeena);
			rdreg(pp, Rcsc);
		}
	}

	/* for card management interrupts */
	if(ncontroller)
		intrenable(irq, i82365intr, 0, BUSUNKNOWN, "i82365");
		/* for card management interrupts */
		sprint(buf, "i82365.%d", i);
		intrenable(cp->irq, i82365intr, 0, BUSUNKNOWN, buf);
	}
}

static Chan*

M pc/mouse.c => pc/mouse.c +0 -4
@@ 101,10 101,6 @@ ps2mouse(void)
	mousetype = MousePS2;
}

static int intellimouse;
static int resolution;
static int accelerated;

static void
setaccelerated(int x)
{