[coreboot] New patch to review for coreboot: 9f93993 libpayload: Split EHCI bulk transfers on packet boundaries over qTDs

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Mar 12 00:27:38 CET 2013


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2651

-gerrit

commit 9f939937defc6d2fbb8ea82850454995d9e85fd0
Author: Julius Werner <jwerner at chromium.org>
Date:   Fri Jan 11 16:25:52 2013 -0800

    libpayload: Split EHCI bulk transfers on packet boundaries over qTDs
    
    EHCI controllers see transfers as a queue of transfer descriptors
    (qTDs), each of which can represent an aligned area of up to 20KB. Each
    qTD is processed separately, which means that a single USB packet cannot
    span multiple qTDs.
    
    While this should not be a problem according to the specification, some
    USB storage devices seem to get confused when a packet in the middle of
    a transfer is smaller than the maximum packet size (512 bytes) due to
    falling on a qTD boundary. This patch aligns the total transfer length
    per qTD to 512 bytes to avoid that problem (any excess bytes will simply
    roll over to the next qTD).
    
    Change-Id: I0b5db07507699a3861b30c1a5ee774c45dda7fdd
    Signed-off-by: Julius Werner <jwerner at chromium.org>
---
 payloads/libpayload/drivers/usb/ehci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c
index d33fec5..972962c 100644
--- a/payloads/libpayload/drivers/usb/ehci.c
+++ b/payloads/libpayload/drivers/usb/ehci.c
@@ -241,6 +241,10 @@ static int fill_td(qtd_t *td, void* data, int datalen)
 			}
 			datalen -= 4096;
 			total_len += 4096;
+
+			/* end TD at a packet boundary if transfer not complete */
+			if (page_no == 5)
+				total_len &= ~511;
 		}
 	}
 	td->token |= total_len << QTD_TOTAL_LEN_SHIFT;



More information about the coreboot mailing list