summaryrefslogtreecommitdiff
path: root/sys/src/9/port
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-02-21 18:46:47 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-02-21 18:46:47 +0000
commit14bb9734a611556f14ce17d810993588b3075a1b (patch)
tree3b0e48f93488c9359b92bd21e1b649dc30cd584f /sys/src/9/port
parent4b637a24f9c2db696b6660bc7116441a43281302 (diff)
usbxhci: endpoint address needs to be masked with Epmax from endpoint number
Diffstat (limited to 'sys/src/9/port')
-rw-r--r--sys/src/9/port/usbxhci.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/src/9/port/usbxhci.c b/sys/src/9/port/usbxhci.c
index cf6c489fe..4c2b60a3b 100644
--- a/sys/src/9/port/usbxhci.c
+++ b/sys/src/9/port/usbxhci.c
@@ -1059,7 +1059,7 @@ epclose(Ep *ep)
w[0] = (w[0] & ~(0x1F<<27)) | slot->nep<<27;
/* (input) ep context */
- w += ep->nb*2*8<<ctlr->csz;
+ w += (ep->nb&Epmax)*2*8<<ctlr->csz;
memset(w, 0, 2*32<<ctlr->csz);
dmaflush(1, slot->ibase, 32*33 << ctlr->csz);
@@ -1147,8 +1147,8 @@ initep(Ep *ep)
nexterror();
}
if(ep->mode != OREAD){
- ring = initring(io[OWRITE].ring = &slot->epr[ep->nb*2-1], 8);
- ring->id = ep->nb*2;
+ ring = initring(io[OWRITE].ring = &slot->epr[(ep->nb&Epmax)*2-1], 8);
+ ring->id = (ep->nb&Epmax)*2;
if(ring->id > slot->nep)
slot->nep = ring->id;
ring->slot = slot;
@@ -1157,8 +1157,8 @@ initep(Ep *ep)
w[1] |= 1 << ring->id;
}
if(ep->mode != OWRITE){
- ring = initring(io[OREAD].ring = &slot->epr[ep->nb*2], 8);
- ring->id = ep->nb*2+1;
+ ring = initring(io[OREAD].ring = &slot->epr[(ep->nb&Epmax)*2], 8);
+ ring->id = (ep->nb&Epmax)*2+1;
if(ring->id > slot->nep)
slot->nep = ring->id;
ring->slot = slot;
@@ -1174,7 +1174,7 @@ initep(Ep *ep)
w[0] &= ~(1<<25); // MTT
/* (input) ep context */
- w += ep->nb*2*8<<ctlr->csz;
+ w += (ep->nb&Epmax)*2*8<<ctlr->csz;
if(io[OWRITE].ring != nil){
memset(w, 0, 5*4);
initepctx(w, io[OWRITE].ring, ep);