From 63cf3cfa115b97cebcef542609aaa4e13dfc151b Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 31 Aug 2014 11:14:05 +0200 Subject: [PATCH] EHCI: Simplify short packet logic to use alternate pointer. The alternate pointer is the software equivalent of the alternate physical address in the hardware queue head part. The controller follows that path, so we can follow the alternate pointer as well. Simplifies and generalizes the logic. --- src/add-ons/kernel/busses/usb/ehci.cpp | 19 ++++++++----------- src/add-ons/kernel/busses/usb/ehci_hardware.h | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 9bae7f1716..80d0315f4b 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -1646,19 +1646,16 @@ EHCI::FinishTransfers() if (((status >> EHCI_QTD_PID_SHIFT) & EHCI_QTD_PID_MASK) == EHCI_QTD_PID_IN && ((status >> EHCI_QTD_BYTES_SHIFT) & EHCI_QTD_BYTES_MASK) - !=0) { - // a short packet condition existed on this descriptor - if ((transfer->transfer->TransferPipe()->Type() - & USB_OBJECT_CONTROL_PIPE) != 0) { - // for control pipes, the next descriptor - // executed is the Status descriptor - while (!(descriptor->next_phy & EHCI_ITEM_TERMINATE)) { - descriptor = descriptor->next_log; - } + != 0) { + // a short packet condition existed on this descriptor, + // follow the alternate next pointer if set + if (descriptor->alt_next_log != NULL) { + descriptor = descriptor->alt_next_log; continue; } - // for bulk/interrupt pipes, no other descriptors are - // executed + + // no alternate next, transfer is done + callbackStatus = B_OK; transferDone = true; break; } diff --git a/src/add-ons/kernel/busses/usb/ehci_hardware.h b/src/add-ons/kernel/busses/usb/ehci_hardware.h index 5cd33c979b..1348303859 100644 --- a/src/add-ons/kernel/busses/usb/ehci_hardware.h +++ b/src/add-ons/kernel/busses/usb/ehci_hardware.h @@ -207,7 +207,7 @@ typedef struct ehci_qtd { // Software Part uint32 this_phy; struct ehci_qtd *next_log; - void *alt_next_log; + struct ehci_qtd *alt_next_log; size_t buffer_size; void *buffer_log; } _PACKED ehci_qtd;