diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-09-02 14:11:23 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-09-02 14:11:23 +0200 |
commit | 9e65fced986d6dfcc3d00077c592ef5bc9138d0b (patch) | |
tree | fc7fca570f1552e6349ceeedcba47f53498d2ea5 | |
parent | 3cf8b41f8b91b4db26d41a1a6437ba2f9a631c86 (diff) |
usbohci: virtual box fix from richard miller
-rw-r--r-- | sys/src/9/pc/usbohci.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/src/9/pc/usbohci.c b/sys/src/9/pc/usbohci.c index f3d0e0068..fc7f9f2bd 100644 --- a/sys/src/9/pc/usbohci.c +++ b/sys/src/9/pc/usbohci.c @@ -1146,10 +1146,10 @@ qhinterrupt(Ctlr *, Ep *ep, Qio *io, Td *td, int) switch(err){ case Tddataovr: /* Overrun is not an error */ case Tdok: - /* can't make this assertion in virtualbox */ -// if(td->cbp != 0) -// panic("ohci: full packet but cbp != 0"); - break; + /* virtualbox doesn't always report underflow on short packets */ + if(td->cbp == 0) + break; + /* fall through */ case Tddataund: /* short input packets are ok */ if(mode == OREAD){ @@ -1338,12 +1338,16 @@ epgettd(Ep *ep, Qio *io, Td **dtdp, int flags, void *a, int count) Td *td, *dtd; Block *bp; - if(ep->maxpkt > 0x2000) - panic("ohci: max packet > two pages"); - if(ep->maxpkt < count) - error("maxpkt too short"); - bp = allocb(ep->maxpkt); /* panics if no mem */ - assert(bp != nil); + if(count <= BY2PG) + bp = allocb(count); + else{ + if(count > 2*BY2PG) + panic("ohci: transfer > two pages"); + /* maximum of one physical page crossing allowed */ + bp = allocb(count+BY2PG); + bp->rp = (uchar*)PGROUND((uintptr)bp->rp); + bp->wp = bp->rp; + } dtd = *dtdp; td = dtd; td->bp = bp; @@ -1494,7 +1498,7 @@ epio(Ep *ep, Qio *io, void *a, long count, int mustlock) ltd = td0 = ed->tds; load = tot = 0; do{ - n = ep->maxpkt; + n = 2*BY2PG; if(count-tot < n) n = count-tot; if(c != nil && io->tok != Tdtokin) |