[coreboot] New patch to review for coreboot: 12ce567 libpayload: UHCI driver contained too much magic

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Wed Oct 3 08:33:08 CEST 2012


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1555

-gerrit

commit 12ce567ab2937dc8358fd12cadac8ba9f18853e0
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Wed Oct 3 08:23:56 2012 +0200

    libpayload: UHCI driver contained too much magic
    
    The handling of finalize in uhci_bulk was confusing, and so its
    behaviour changed.
    If set, the driver is supposed to add a trailing empty packet iff
    the last packet is of maximum packet size. This helps the device to
    decide if the transfer is completed simply by waiting for a packet
    that isn't full length.
    
    Change-Id: I162e8c1e034924d0de6fdcb971c94cf3a5ea31eb
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 payloads/libpayload/drivers/usb/uhci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c
index 6cc6b28..7647707 100644
--- a/payloads/libpayload/drivers/usb/uhci.c
+++ b/payloads/libpayload/drivers/usb/uhci.c
@@ -429,7 +429,10 @@ uhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize)
 	int maxpsize = ep->maxpacketsize;
 	if (maxpsize == 0)
 		fatal("MaxPacketSize == 0!!!");
-	int numpackets = (size + maxpsize - 1) / maxpsize + finalize;
+	int numpackets = (size + maxpsize - 1) / maxpsize;
+	if (finalize && ((size % maxpsize) == 0)) {
+		numpackets++;
+	}
 	if (numpackets == 0)
 		return 0;
 	td_t *tds = create_schedule (numpackets);




More information about the coreboot mailing list