mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
uhci: improved TD matching, working ISOC transfers
While trying to make VX-3000 camera work on XP under KVM I realized that we do not necessarily have to find original TD address. All we care about is the token which identifies the transfer rather well (direction, endpoint, size, etc). This is especially important for the isochronous transfers because otherwise they are being canceled left and right and we do not make much progress. With this patch all devices that used bulk transfers that I've tried so far continue to work just as well. And now my USB web cammera (isoc transfers) is working well tool. It's not as smooth as native Windows but it's pretty darn smooth. The cool thing is that new USB code (both usb-uhci and usb-linux) is totaly generic and does not need any special logic for ISOC. Signed-off-by: Max Krasnyansky <maxk@kernel.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5072 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
472a397fdf
commit
e8ee3c7276
|
@ -265,25 +265,41 @@ static void uhci_async_cancel_all(UHCIState *s)
|
||||||
static UHCIAsync *uhci_async_find_td(UHCIState *s, uint32_t addr, uint32_t token)
|
static UHCIAsync *uhci_async_find_td(UHCIState *s, uint32_t addr, uint32_t token)
|
||||||
{
|
{
|
||||||
UHCIAsync *async = s->async_pending;
|
UHCIAsync *async = s->async_pending;
|
||||||
|
UHCIAsync *match = NULL;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We're looking for the best match here. ie both td addr and token.
|
||||||
|
* Otherwise we return last good match. ie just token.
|
||||||
|
* It's ok to match just token because it identifies the transaction
|
||||||
|
* rather well, token includes: device addr, endpoint, size, etc.
|
||||||
|
*
|
||||||
|
* Also since we queue async transactions in reverse order by returning
|
||||||
|
* last good match we restores the order.
|
||||||
|
*
|
||||||
|
* It's expected that we wont have a ton of outstanding transactions.
|
||||||
|
* If we ever do we'd want to optimize this algorithm.
|
||||||
|
*/
|
||||||
|
|
||||||
while (async) {
|
while (async) {
|
||||||
if (async->td == addr) {
|
if (async->token == token) {
|
||||||
if (async->token == token)
|
/* Good match */
|
||||||
return async;
|
match = async;
|
||||||
|
|
||||||
/*
|
if (async->td == addr) {
|
||||||
* TD was reused for a different transfer.
|
/* Best match */
|
||||||
* Invalidate the original one asap.
|
break;
|
||||||
*/
|
|
||||||
if (async->valid > 0) {
|
|
||||||
async->valid = 0;
|
|
||||||
dprintf("husb: bad reuse. td 0x%x\n", async->td);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async = async->next;
|
async = async->next;
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
if (count > 64)
|
||||||
|
fprintf(stderr, "uhci: warning lots of async transactions\n");
|
||||||
|
|
||||||
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uhci_attach(USBPort *port1, USBDevice *dev);
|
static void uhci_attach(USBPort *port1, USBDevice *dev);
|
||||||
|
|
Loading…
Reference in a new issue