From e3ef0d30cfcc10556842fb85ec25efb91f7cf7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Nesrsta?= Date: Wed, 18 Dec 2013 18:59:49 +0100 Subject: [PATCH] * grub-core/bus/usb/ehci.c: Fix handling of newborn transfers. Avoid confusing them with already completed transfers. --- ChangeLog | 6 ++++++ grub-core/bus/usb/ehci.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8053cb377..3b899210d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-12-18 Aleš Nesrsta + + * grub-core/bus/usb/ehci.c: Fix handling of newborn transfers. + + Avoid confusing them with already completed transfers. + 2013-12-18 Vladimir Serbinenko Remove xen VFB. diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c index 593a55ac2..c0feefafe 100644 --- a/grub-core/bus/usb/ehci.c +++ b/grub-core/bus/usb/ehci.c @@ -1513,7 +1513,7 @@ grub_ehci_check_transfer (grub_usb_controller_t dev, struct grub_ehci *e = dev->data; struct grub_ehci_transfer_controller_data *cdata = transfer->controller_data; - grub_uint32_t token; + grub_uint32_t token, token_ftd; grub_dprintf ("ehci", "check_transfer: EHCI STATUS=%08x, cdata=%p, qh=%p\n", @@ -1541,13 +1541,18 @@ grub_ehci_check_transfer (grub_usb_controller_t dev, return grub_ehci_parse_notrun (dev, transfer, actual); token = grub_le_to_cpu32 (cdata->qh_virt->td_overlay.token); + /* If the transfer consist from only one TD, we should check */ + /* if the TD was really executed and deactivated - to prevent */ + /* false detection of transfer finish. */ + token_ftd = grub_le_to_cpu32 (cdata->td_first_virt->token); /* Detect QH halted */ if ((token & GRUB_EHCI_STATUS_HALTED) != 0) return grub_ehci_parse_halt (dev, transfer, actual); /* Detect QH not active - QH is not active and no next TD */ - if ((token & GRUB_EHCI_STATUS_ACTIVE) == 0) + if (token && ((token & GRUB_EHCI_STATUS_ACTIVE) == 0) + && ((token_ftd & GRUB_EHCI_STATUS_ACTIVE) == 0)) { /* It could be finish at all or short packet condition */ if ((grub_le_to_cpu32 (cdata->qh_virt->td_overlay.next_td)