From 31759f43902b9089e76b90400f164350152e26e5 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 17 Oct 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-10-17 --- pc/devusb.c | 21 ++++++++++++++------- pc/ether82557.c | 3 ++- port/devaudio.c | 6 +++--- port/devpipe.c | 1 + port/devproc.c | 10 ++++++++-- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/pc/devusb.c b/pc/devusb.c index ca7913376a6be2d71bd4bd1847f42db60206d39f..8391866ebdea5680f7edc0cedf8f261aff76e677 100644 --- a/pc/devusb.c +++ b/pc/devusb.c @@ -832,10 +832,6 @@ schedendpt(Endpt *e) e->etd = nil; e->remain = 0; e->nbytes = 0; - e->foffset = 0; - e->toffset = 0; - e->poffset = 0; - e->buffered = 0; td = e->td0; for(i = e->sched; i < NFRAME; i += e->pollms){ bp = e->bp0 + e->maxpkt*i/e->pollms; @@ -1595,6 +1591,10 @@ usbopen(Chan *c, int omode) else error("can't schedule USB endpoint"); } + e->foffset = 0; + e->toffset = 0; + e->poffset = 0; + e->buffered = 0; eptactivate(e); } incref(d); @@ -1687,6 +1687,7 @@ isoio(Endpt *e, void *a, long n, ulong offset, int w) p = a; ub = &ubus; if (offset != 0 && offset != e->foffset){ + iprint("offset %lud, foffset %lud\n", offset, e->foffset); /* Seek to a specific position */ frnum = (IN(Frnum) + 8) & 0x3ff; td = e->td0 +frnum; @@ -1857,9 +1858,15 @@ epstatus(char *s, int n, Endpt *e, int i) l = 0; l += snprint(s+l, n-l, "%2d %#6.6lux %10lud bytes %10lud blocks\n", i, e->csp, e->nbytes, e->nblocks); - if (e->iso && e->toffset){ - l += snprint(s+l, n-l, "bufsize %6d buffered %6d offset %10lud time %19lld\n", - e->maxpkt, e->buffered, e->toffset, e->time); + if (e->iso){ + l += snprint(s+l, n-l, "bufsize %6d buffered %6d", + e->maxpkt, e->buffered); + if(e->toffset) + l += snprint(s+l, n-l, " offset %10lud time %19lld\n", + e->toffset, e->time); + if (n-l > 0) + s[l++] = '\n'; + s[l] = '\0'; } return l; } diff --git a/pc/ether82557.c b/pc/ether82557.c index aa31b3b486f7e3ab692caa879e1f7eab50392a25..4789c7311770cbb828ddeb4ed7493924ce1e7b12 100644 --- a/pc/ether82557.c +++ b/pc/ether82557.c @@ -902,9 +902,10 @@ i82557pci(void) switch(p->did){ default: continue; + case 0x1209: /* INtel 82559ER */ case 0x1229: /* Intel 8255[789] */ case 0x1031: /* Intel 82562EM */ - case 0x2449: /* Intel ????? */ + case 0x2449: /* Intel 82562ET */ break; } diff --git a/port/devaudio.c b/port/devaudio.c index 80b48ec2b66d6b782d7e20874f3df3d6b419a061..80b0ea804d9d61e0cdaa8b65cde738d9a5fe12e2 100644 --- a/port/devaudio.c +++ b/port/devaudio.c @@ -409,7 +409,6 @@ sb16startdma(void) sbcmd(count>>8); audio.active = 1; - audio.tottime = todget(nil); contindma(); iunlock(&blaster); } @@ -501,7 +500,6 @@ ess1688startdma(void) ess1688w(0xB8, x|0x05); audio.active = 1; - audio.tottime = todget(nil); contindma(); iunlock(&blaster); } @@ -896,6 +894,8 @@ audioopen(Chan *c, int omode) } audio.amode = amode; setempty(); + if (amode == Aread) + audio.totcount -= Bufsize; audio.curcount = 0; qunlock(&audio); mxvolume(); @@ -1017,7 +1017,7 @@ audioread(Chan *c, void *v, long n, vlong off) case Qstatus: buf[0] = 0; snprint(buf, sizeof(buf), "bufsize %6d buffered %6d offset %10lud time %19lld\n", - Bufsize, audio.buffered, audio.totcount, audio.tottime); + Bufsize, audio.buffered, audio.totcount<0?0:audio.totcount, audio.tottime); return readstr(offset, a, n, buf); case Qvolume: diff --git a/port/devpipe.c b/port/devpipe.c index d348abc93bde16cf9c1ea8fc07693f372b3a96ac..23c48e632593907f965244ec44db22470a09b9e8 100644 --- a/port/devpipe.c +++ b/port/devpipe.c @@ -98,6 +98,7 @@ pipegen(Chan *c, char*, Dirtab *tab, int ntab, int i, Dir *dp) devdir(c, c->qid, "#|", 0, eve, DMDIR|0555, dp); return 1; } + i++; /* skip . */ if(tab==0 || i>=ntab) return -1; diff --git a/port/devproc.c b/port/devproc.c index f24ab2469b2cb222d6ca056c519058a75be7ee5f..cd4fe877d4101d4ceb998e15e3faef637c6b6890 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -85,6 +85,7 @@ procgen(Chan *c, char *name, Dirtab *tab, int, int s, Dir *dp) { Qid qid; Proc *p; + char *ename; Segment *q; ulong pid, path, perm, len; @@ -97,8 +98,8 @@ procgen(Chan *c, char *name, Dirtab *tab, int, int s, Dir *dp) if(c->qid.path == Qdir){ if(name != nil){ /* ignore s and use name to find pid */ - pid = strtol(name, &name, 0); - if(pid==0 || name[0]!='\0') + pid = strtol(name, &ename, 10); + if(pid==0 || ename[0]!='\0') return -1; s = procindex(pid); if(s < 0) @@ -111,6 +112,11 @@ procgen(Chan *c, char *name, Dirtab *tab, int, int s, Dir *dp) if(pid == 0) return 0; sprint(up->genbuf, "%lud", pid); + /* + * String comparison is done in devwalk so name must match its formatted pid + */ + if(name != nil && strcmp(name, up->genbuf) != 0) + return -1; mkqid(&qid, (s+1)<genbuf, 0, p->user, DMDIR|0555, dp); return 1;