~kris/9p

9hist

40a505f1d80444c5a5ffeb47cd68b91b3f7593d3 — David du Colombier 28 years ago 611eb50
Plan 9 from Bell Labs 1998-03-31
8 files changed, 39 insertions(+), 30 deletions(-)

M ip/ip.c
M pc/clock.c
M pc/devata.c
M pc/ether82557.c
M pc/etherelnk3.c
M pc/screen.h
M port/devaudio.c
M port/devns16552.c
M ip/ip.c => ip/ip.c +1 -1
@@ 323,7 323,7 @@ ipiput(Fs *f, uchar *ia, Block *bp)
//				h->src, h->dst, BLEN(bp), h->proto);

	/*
	 *  Ensure we have allt he header info in the first
	 *  Ensure we have all the header info in the first
	 *  block.  Make life easier for other protocols by
	 *  collecting up to the first 64 bytes in the first block.
	 */

M pc/clock.c => pc/clock.c +2 -2
@@ 52,10 52,10 @@ clockintr(Ureg* ureg, void*)

	checkalarms();
	if(m->machno == 0){
		lock(&clock0lock);
		ilock(&clock0lock);
		for(lp = clock0link; lp; lp = lp->link)
			lp->clock();
		unlock(&clock0lock);
		iunlock(&clock0lock);
	}

	if(up == 0 || up->state != Running)

M pc/devata.c => pc/devata.c +15 -5
@@ 346,7 346,7 @@ static int
atactlrprobe(int ctlrno, int irq, int resetok)
{
	Controller *ctlr;
	int atapi, mask, port;
	int atapi, mask, once, port;
	uchar error, status, msb, lsb;

	/*


@@ 399,13 399,16 @@ atactlrprobe(int ctlrno, int irq, int resetok)
		}
	}

	once = 1;
retry:
	atapi = 0;
	mask = 0;
	DPRINT("ata%d: ATAPI %uX %uX %uX\n", ctlrno, status,
		inb(port+Pcylmsb), inb(port+Pcyllsb));
	if(status == 0 && inb(port+Pcylmsb) == 0xEB && inb(port+Pcyllsb) == 0x14){
	if(/*status == 0 &&*/ inb(port+Pcylmsb) == 0xEB && inb(port+Pcyllsb) == 0x14){
		DPRINT("ata%d: ATAPI ok\n", ctlrno);
		intrenable(irq, ataintr, ctlr, ctlr->tbdf);
		if(once)
			intrenable(irq, ataintr, ctlr, ctlr->tbdf);
		atapi |= 0x01;
		mask |= 0x01;
		goto atapislave;


@@ 413,10 416,16 @@ atactlrprobe(int ctlrno, int irq, int resetok)
	if(atactlrwait(ctlr, DHmagic, 0, MS2TK(1)) || waserror()){
		DPRINT("ata%d: Cedd status %ux/%ux/%ux\n", ctlrno,
			inb(port+Pstatus), inb(port+Pcylmsb), inb(port+Pcyllsb));
		if(once){
			once = 0;
			ctlr->cmd = 0;
			goto retry;
		}
		xfree(ctlr);
		return -1;
	}
	intrenable(irq, ataintr, ctlr, ctlr->tbdf);
	if(once)
		intrenable(irq, ataintr, ctlr, ctlr->tbdf);
	ctlr->cmd = Cedd;
	outb(port+Pcmd, Cedd);
	atasleep(ctlr, Hardtimeout);


@@ 1410,7 1419,8 @@ atapart(Drive *dp)
		 *  the last sector if none is found in the second last.
		 */
		i = 0;
		ataxfer(dp, &dp->p[0], Cread, (dp->p[0].end-2)*dp->bytes, dp->bytes, buf);
		ataxfer(dp, &dp->p[0], Cread, (dp->p[0].end-2)*
			(vlong)dp->bytes, dp->bytes, buf);
		buf[dp->bytes-1] = 0;
		n = parsefields((char*)buf, line, Npart+1, "\n");
		if(n > 0 && strncmp(line[0], PARTMAGIC, sizeof(PARTMAGIC)-1) == 0)

M pc/ether82557.c => pc/ether82557.c +4 -4
@@ 554,10 554,10 @@ interrupt(Ureg*, void* arg)
	ctlr = ether->ctlr;

	for(;;){
		lock(&ctlr->rlock);
		ilock(&ctlr->rlock);
		status = csr16r(ctlr, Status);
		csr8w(ctlr, Ack, (status>>8) & 0xFF);
		unlock(&ctlr->rlock);
		iunlock(&ctlr->rlock);

		if(!(status & (StatCX|StatFR|StatCNA|StatRNR|StatMDI|StatSWI)))
			break;


@@ 634,7 634,7 @@ interrupt(Ureg*, void* arg)
		}

		if(status & StatCNA){
			lock(&ctlr->cblock);
			ilock(&ctlr->cblock);

			cb = ctlr->cbtail;
			while(ctlr->cbq){


@@ 653,7 653,7 @@ interrupt(Ureg*, void* arg)
			ctlr->cbtail = cb;

			txstart(ether);
			unlock(&ctlr->cblock);
			iunlock(&ctlr->cblock);

			status &= ~StatCNA;
		}

M pc/etherelnk3.c => pc/etherelnk3.c +5 -5
@@ 949,7 949,7 @@ interrupt(Ureg*, void* arg)
	port = ether->port;
	ctlr = ether->ctlr;

	lock(&ctlr->wlock);
	ilock(&ctlr->wlock);
	w = (STATUS(port)>>13) & 0x07;
	COMMAND(port, SelectRegisterWindow, Wop);



@@ 1102,7 1102,7 @@ interrupt(Ureg*, void* arg)
	}

	COMMAND(port, SelectRegisterWindow, w);
	unlock(&ctlr->wlock);
	iunlock(&ctlr->wlock);
}

static long


@@ 1509,7 1509,7 @@ miir(Ether* ether, int phyad, int regad)

	if(data & 0x10000)
		return -1;
	XCVRDEBUG("phy%d/%d: data=%uX\n", phyad, regad, data);
print("%d/%d: data=%uX\n", phyad, regad, data);

	return data & 0xFFFF;
}


@@ 1524,7 1524,7 @@ scanphy(Ether* ether)
			continue;
		x <<= 6;
		x |= miir(ether, i, 3)>>10;
		print("phy%d: oui %uX reg1 %uX\n", i, x, miir(ether, i, 1));
		XCVRDEBUG("phy%d: oui %uX reg1 %uX\n", i, x, miir(ether, i, 1));
	}
}



@@ 1763,7 1763,7 @@ etherelnk3reset(Ether* ether)
		an = miir(ether, phyaddr, 0x04);
		an &= miir(ether, phyaddr, 0x05) & 0x03E0;
		XCVRDEBUG("mii an: %uX\n", an);
		if(an & 0x380)
		//if(an & 0x380)
			ether->mbps = 100;
		if(an & 0x0140)
			setfullduplex(port);

M pc/screen.h => pc/screen.h +0 -1
@@ 118,4 118,3 @@ extern int	screenaperture(int, int);

/* vga.c */
extern void	vgascreenwin(VGAscr*);


M port/devaudio.c => port/devaudio.c +2 -2
@@ 965,10 965,10 @@ audioread(Chan *c, char *a, long n, vlong off)
				else{
					if(volumes[m].flag & Fin)
						j += snprint(buf+j, sizeof(buf)-j,
						" in %d", liv);
							" in %d", liv);
					if(volumes[m].flag & Fout)
						j += snprint(buf+j, sizeof(buf)-j,
						" out %d", lov);
							" out %d", lov);
				}
			}else{
				if((volumes[m].flag&(Fin|Fout))==(Fin|Fout) &&

M port/devns16552.c => port/devns16552.c +10 -10
@@ 559,7 559,7 @@ ns16552intr(int dev)
		case 4:	/* received data available */
		case 12:
			ch = uartrdreg(p, Data) & 0xff;
			lock(&p->tlock);
			ilock(&p->tlock);
			if(p->xonoff){
				if(ch == CTLS){
					p->blocked = 1;


@@ 568,15 568,15 @@ ns16552intr(int dev)
					 /* clock gets output going again */
				}
			}
			unlock(&p->tlock);
			iunlock(&p->tlock);
			if(p->putc)
				p->putc(p->iq, ch);
			else {
				lock(&p->rlock);
				ilock(&p->rlock);
				if(p->ip < p->ie)
					*p->ip++ = ch;
				p->haveinput = 1;
				unlock(&p->rlock);
				iunlock(&p->rlock);
			}
			break;
	


@@ 587,12 587,12 @@ ns16552intr(int dev)
		case 0:	/* modem status */
			ch = uartrdreg(p, Mstat);
			if(ch & Ctsc){
				lock(&p->tlock);
				ilock(&p->tlock);
				l = p->cts;
				p->cts = ch & Cts;
				if(l == 0 && p->cts)
					p->ctsbackoff = 2; /* clock gets output going again */
				unlock(&p->tlock);
				iunlock(&p->tlock);
			}
			break;
	


@@ 626,7 626,7 @@ uartclock(void)

		/* this amortizes cost of qproduce to many chars */
		if(p->haveinput){
			lock(&p->rlock);
			ilock(&p->rlock);
			if(p->haveinput){
				n = p->ip - p->istage;
				if(n > 0 && p->iq){


@@ 639,17 639,17 @@ uartclock(void)
				}
				p->haveinput = 0;
			}
			unlock(&p->rlock);
			iunlock(&p->rlock);
		}

		/* this adds hysteresis to hardware flow control */
		if(p->ctsbackoff){
			lock(&p->tlock);
			ilock(&p->tlock);
			if(p->ctsbackoff){
				if(--(p->ctsbackoff) == 0)
					ns16552kick0(p);
			}
			unlock(&p->tlock);
			iunlock(&p->tlock);
		}
	}
}