From: henz <patrick.h...@hpe.com> Timeouts in the XhciDxe driver are taking longer than expected due to the timeout loops not accounting for code execution time. As en example, 5 second timeouts have been observed to take around 36 seconds to complete. Use SetTimer and Create/CheckEvent from Boot Services to determine when timeout occurred. This patch was tested using forced timeouts and print statements with QEmu as well as phycial hardware. The forced timeouts were implemented in code via static variables that guaranteed a timeout the first time the function with the broken timeout was called.
Example: XhcExecTransfer ( . . ) { . . static int do_once = 1; // test line . . do { Finished = XhcCheckUrbResult (Xhc, Urb); if (do_once) Finished = 0; // test line if (Finished) { break; } gBS->Stall (XHC_1_MICROSECOND); } while (!EFI_ERROR(TimerStatus) && EFI_ERROR(gBS->CheckEvent (TimeoutEvent))); do_once = 0; // test line Using this forced timeout approach the correct timeouts were observed on both hardware and in QEmu. Similar broken timeout loops have been found in the Uhci and Ehci drivers. This patch does not fix those issues. Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> Cc: Ray Ni <ray...@intel.com> Signed-off-by: Patrick Henz <patrick.h...@hpe.com> Patrick Henz (1): MdeModulePkg/XhciDxe: Fix Broken Timeouts MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 28 ++++++++++++++++--- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 34 +++++++++++++++++------- 2 files changed, 49 insertions(+), 13 deletions(-) -- 2.27.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#64944): https://edk2.groups.io/g/devel/message/64944 Mute This Topic: https://groups.io/mt/76576825/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-