grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Long USB transfers problem


From: Aleš Nesrsta
Subject: [PATCH] Long USB transfers problem
Date: Sat, 01 Dec 2012 23:46:49 +0100

Hi,
I found some USB problem:

Some part of GRUB wants read "long" data block from USB mass storage
device when GRUB opens USB disk, e.g. when "ls" command is entered first
time after EHCI/UHCI/OHCI module is loaded.
"Long" means data block of 0x8000 bytes length - it is not too much
nowadays :-)

But:
Some USB devices have too low limit of bulk data packet size, e.g. 32
bytes or less - so, in such case the USB driver needs to use lot of
Transfer Descriptors (TDs) to transfer 32Kbytes of data.
Unfortunately, number of TDs is limited in GRUB driver(s) - and there is
not enough TDs in this situation.
The result is internal error, no data transfer is initiated by driver
and error code is returned to calling function from usbms.c.

It is vary bad situation: USB device receives CBW command to transfer
0x8000 bytes - but transfer of data is never started because driver run
out of TDs...
Some devices could be automatically recovered from such situation and
works normally later when GRUB tries read disk by smaller parts.
But some devices remains confused even if they are reset by USBMS
specific reset command.

So, I wrote simple experimental patch which splits "long" transfer into
smaller parts - it looks to solve this issue.
Patch solves only read transfer - AFAIK GRUB loader is not designed to
write some data into disk, so there probably never be transfer of "long"
data block in direction into USB mass storage device.
Maximal size 2Kbyte of USB data transfer data block (defined in
usbtrans.h) looks to be more or less optimal value.

It is probably not critical patch because this situation happens mainly
if USB device is full speed device - i.e. this problem is related mainly
to very old USB flash disks or some (older) special mass storage devices
like GPS devices, cameras, card readers etc. - which will be probably
never used as boot devices... (but - who knows...)  :-) 

BR,
Ales

Attachment: usb_patch_121201_0
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]