Hello,
I'm revisiting this problem.
https://mail-index.netbsd.org/port-arm/2023/06/18/msg008275.html
If interested, could you please test new patch?
Differences from previous are
- Set ival = 2^xp_ival, not 2^(xp_ival - 1) in xhci_device_isoc_enter.
Perhaps this is the reason why previous patch does not work.
- Roundup xp_isoc_next to ival, not ival * USB_UFRAMES_PER_FRAME,
as xp_isoc_next and ival are in microframe units.
Index: src/sys/dev/usb/xhci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/xhci.c,v
retrieving revision 1.188
diff -u -u -p -r1.188 xhci.c
--- src/sys/dev/usb/xhci.c 30 Jan 2025 10:51:39 -0000 1.188
+++ src/sys/dev/usb/xhci.c 2 May 2025 08:29:51 -0000
@@ -132,6 +132,7 @@ struct xhci_pipe {
int16_t xp_isoc_next; /* next frame */
uint8_t xp_maxb; /* max burst */
uint8_t xp_mult;
+ uint8_t xp_ival;
};
#define XHCI_COMMAND_RING_TRBS 256
@@ -3983,6 +3984,8 @@ xhci_setup_maxburst(struct usbd_pipe *pi
break;
}
+ /* for TBC calculation */
+ xpipe->xp_ival = ival;
xpipe->xp_maxb = maxb + 1;
xpipe->xp_mult = mult + 1;
@@ -4604,9 +4607,9 @@ xhci_device_isoc_enter(struct usbd_xfer
usb_syncmem(dma, 0, xfer->ux_length,
isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
- ival = xfer->ux_pipe->up_endpoint->ue_edesc->bInterval;
- if (ival >= 1 && ival <= 16)
- ival = 1 << (ival - 1);
+ ival = xpipe->xp_ival;
+ if (ival >= 0 && ival <= 18)
+ ival = 1 << ival;
else
ival = 1; /* fake something up */
@@ -4615,8 +4618,8 @@ xhci_device_isoc_enter(struct usbd_xfer
DPRINTF("mfindex %jx", (uintmax_t)mfindex, 0, 0, 0);
mfindex = XHCI_MFINDEX_GET(mfindex + 1);
- mfindex /= USB_UFRAMES_PER_FRAME;
- mfindex += 7; /* 7 frames is max possible IST */
+ /* 7 frames is max possible IST */
+ mfindex += 7 * USB_UFRAMES_PER_FRAME;
xpipe->xp_isoc_next = roundup2(mfindex, ival);
}
@@ -4639,7 +4642,8 @@ xhci_device_isoc_enter(struct usbd_xfer
XHCI_TRB_3_TLBPC_SET(tlbpc) |
XHCI_TRB_3_IOC_BIT;
if (XHCI_HCC_CFC(sc->sc_hcc)) {
- control |= XHCI_TRB_3_FRID_SET(xpipe->xp_isoc_next);
+ control |= XHCI_TRB_3_FRID_SET(xpipe->xp_isoc_next /
+ USB_UFRAMES_PER_FRAME);
#if 0
} else if (xpipe->xp_isoc_next == -1) {
control |= XHCI_TRB_3_FRID_SET(xpipe->xp_isoc_next);
@@ -4653,7 +4657,8 @@ xhci_device_isoc_enter(struct usbd_xfer
#endif
xhci_xfer_put_trb(xx, i, parameter, status, control);
- xpipe->xp_isoc_next += ival;
+ xpipe->xp_isoc_next =
+ XHCI_MFINDEX_GET(xpipe->xp_isoc_next + ival);
offs += len;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.