From 14bb9734a611556f14ce17d810993588b3075a1b Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 21 Feb 2022 18:46:47 +0000 Subject: usbxhci: endpoint address needs to be masked with Epmax from endpoint number --- sys/src/9/port/usbxhci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/src') 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<csz; + w += (ep->nb&Epmax)*2*8<csz; memset(w, 0, 2*32<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<csz; + w += (ep->nb&Epmax)*2*8<csz; if(io[OWRITE].ring != nil){ memset(w, 0, 5*4); initepctx(w, io[OWRITE].ring, ep); -- cgit v1.2.3