diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-04-23 20:03:01 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-04-23 20:03:01 +0200 |
commit | 41908149de00ab5830c5c72ef3a300a050b2b3bf (patch) | |
tree | 21e8c4f1697b73705a50cf35f2cda257ec47acb2 /sys/src/9/port/usbehci.c | |
parent | 07bf5a24ab5b702f8b4ee89fb501204aaaa5b17b (diff) |
nusb: resolve endpoint id conflict with different input and output types
ftrvxmtrx repots devices that use the endpoint number for
input and output of different types like:
nusb/ether: parsedesc endpoint 5[7] 07 05 81 03 08 00 09 # ep1 in intr
nusb/ether: parsedesc endpoint 5[7] 07 05 82 02 00 02 00
nusb/ether: parsedesc endpoint 5[7] 07 05 01 02 00 02 00 # ep1 out bulk
the previous change tried to work arround this but had the
concequence that only the lastly defined endpoint was
usable.
this change addresses the issue by allowing up to 32 endpoints
per device (16 output + 16 input endpoints) in devusb. the
hci driver will ignore the 4th bit and will only use the
lower 4 bits as endpoint address when talking to the usb
device.
when we encounter a conflict, we map the input endpoint
to the upper id range 16..31 and the output endpoint
to id 0..15 so two distinct endpoints are created.
Diffstat (limited to 'sys/src/9/port/usbehci.c')
-rw-r--r-- | sys/src/9/port/usbehci.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/src/9/port/usbehci.c b/sys/src/9/port/usbehci.c index 45b48145a..2db838780 100644 --- a/sys/src/9/port/usbehci.c +++ b/sys/src/9/port/usbehci.c @@ -2578,7 +2578,7 @@ epctlio(Ep *ep, Ctlio *cio, void *a, long count) /* set the address if unset and out of configuration state */ if(ep->dev->state != Dconfig && ep->dev->state != Dreset) if(cio->usbid == 0){ - cio->usbid = (ep->nb&Epmax) << 7 | ep->dev->nb&Devmax; + cio->usbid = (ep->nb&Epmax)<<7 | (ep->dev->nb&Devmax); coherence(); qhsetaddr(cio->qh, cio->usbid); } @@ -2688,8 +2688,8 @@ isofsinit(Ep *ep, Isoio *iso) td->data = iso->data + i * ep->maxpkt; td->epc = ep->dev->port << Stdportshift; td->epc |= ep->dev->hub << Stdhubshift; - td->epc |= ep->nb << Stdepshift; - td->epc |= ep->dev->nb << Stddevshift; + td->epc |= (ep->nb&Epmax) << Stdepshift; + td->epc |= (ep->dev->nb&Devmax) << Stddevshift; td->mfs = 034 << Stdscmshift | 1 << Stdssmshift; if(ep->mode == OREAD){ td->epc |= Stdin; @@ -2743,7 +2743,7 @@ isohsinit(Ep *ep, Isoio *iso) td->buffer[p] = pa; pa += 0x1000; } - td->buffer[0] |= ep->nb << Itdepshift | ep->dev->nb << Itddevshift; + td->buffer[0] |= (ep->nb&Epmax)<<Itdepshift | (ep->dev->nb&Devmax)<<Itddevshift; if(ep->mode == OREAD) td->buffer[1] |= Itdin; else @@ -2789,7 +2789,7 @@ isoopen(Ctlr *ctlr, Ep *ep) default: error("iso i/o is half-duplex"); } - iso->usbid = ep->nb << 7 | ep->dev->nb & Devmax; + iso->usbid = (ep->nb&Epmax)<<7 | (ep->dev->nb&Devmax); iso->state = Qidle; coherence(); iso->debug = ep->debug; @@ -2926,7 +2926,7 @@ epopen(Ep *ep) case Tintr: io = ep->aux = smalloc(sizeof(Qio)*2); io[OREAD].debug = io[OWRITE].debug = ep->debug; - usbid = (ep->nb&Epmax) << 7 | ep->dev->nb &Devmax; + usbid = (ep->nb&Epmax)<<7 | (ep->dev->nb&Devmax); assert(ep->pollival != 0); if(ep->mode != OREAD){ if(ep->toggle[OWRITE] != 0) |