microsoft / mu_basecore

Project Mu BaseCore
https://microsoft.github.io/mu/
Other
239 stars 122 forks source link

[Rebase & FF] 202405: MdeModulePkg: UsbEnumer.c - Reset USB port during enumeration if GetPortStatus returns device error #1047

Closed VivianNK closed 1 month ago

VivianNK commented 1 month ago

Description

During USB device enumeration, issuing a hot reset on a port is skipped if there is a reset change status already detected on the port. This can happen when enumerating devices after a host controller soft reset (which drives a hot reset down the ports).

However, in certain cases an attached device may not be responsive even if the reset change and connection status bits are set. For e.g., according to xHCI spec section 4.19.5.1 the port reset change bits can be set when a hot reset driven on the port transitions to a warm reset and completes with errors. For such instances it is worthwhile to force a hot reset during enumeration to try and recover unresponsive devices.

During enumeration check whether querying port status returns EFI_DEVICE_ERROR and try a port reset if there is a device attached to the port.


Cherry picked from

6a5d43a9e8


How This Was Tested

Tested in 2311

Integration Instructions

N/A

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (release/202405@ec43e8d). Learn more about missing BASE report.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/202405 #1047 +/- ## ================================================= Coverage ? 0.60% ================================================= Files ? 641 Lines ? 219231 Branches ? 1337 ================================================= Hits ? 1317 Misses ? 217869 Partials ? 45 ``` | [Flag](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1047/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | | |---|---|---| | [MdeModulePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1047/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.60% <ø> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.