Repository navigation
UsbDFU mode - #2001
Draft
Aaron (apop5) wants to merge 4 commits into
Draft
UsbDFU mode#2001Aaron (apop5) wants to merge 4 commits into
Aaron (apop5) wants to merge 4 commits into
Conversation
Contributor
✅ QEMU Validation PassedSource Dependencies
Results
Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/40787462513 This comment was automatically generated by the Mu QEMU PR Validation workflow. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/202608 #2001 +/- ##
=================================================
Coverage ? 2.04%
=================================================
Files ? 1675
Lines ? 422965
Branches ? 6057
=================================================
Hits ? 8646
Misses ? 414193
Partials ? 126
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add a googletest that will exercise the Runtime->Runtime interfaces transition on UsbIo->UsbPortReset. Exercise the Runtime->DFU transition on UsbPortReset and DFU->Runtime transition on UsbPortReset
Aaron (apop5)
force-pushed
the
personal/apop5/usb
branch
from
October 28, 2026 23:19
0ed3fe3 to
a60e089
Compare
|
|
||
| if ((ConfigDesc == NULL) && (NewDev.DevDesc->Desc.NumConfigurations != 0)) { | ||
| ConfigDesc = NewDev.DevDesc->Configs[0]; | ||
| Replace = TRUE; |
Contributor
There was a problem hiding this comment.
Once you know Replace is TRUE, can you skip the rest of the checks?
John Schock (joschock)
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The 202608 edk2 UsbBusDxe, on UsbPortReset, updated endpoint states,
read and discarded a fresh descriptor tree, then selected a configuration from
the cached descriptors (what interfaces that existed prior to the port reset).
This was done to prevent recursive connect calls.
It did not reconcile changed device identities or interface layouts with the installed UsbIo Protocol.
Changed device identities can occur for multiple
reasons. For the broken case we have, the identity is changed when a consumer
uses the UsbIo protocol to have the device enter DFU (device firmware update) mode
and the device exposes new interfaces after the next UsbPortReset call.
The resulting implementation refreshes compatible interfaces in place and
synchronously disconnects and replaces incompatible interfaces. It does not
connect function drivers from the reset path.
Reset behavior
For a configured, non-hub device:
remain compatible, update the existing interface descriptor pointers.
original caller TPL is above
TPL_CALLBACK.dependent children for every old interface, then uninstall USB I/O and
Device Path protocols. Keep the old descriptor tree alive throughout teardown.
adopt its descriptors, and publish its interfaces.
ConnectController()on the new interfaces.The physical
USB_DEVICEallocation and address remain in place. A successfulpersonality-changing reset invalidates all old USB I/O pointers, including the
one used to call reset. The caller must locate the new interface afterward.
The reset implementation does not dereference the removed interface after
teardown.
An unchanged-layout reset retains existing instances, including during driver
binding. Compatibility compares the standard device descriptor and default
interface classes and endpoint descriptors. It is not a byte-for-byte comparison
of all alternate settings or class-specific descriptors.
Supporting changes propagate configuration-teardown errors, avoid
freeing descriptors still referenced by partially published interfaces, and
stop port enumeration if the previous device could not be removed.
UsbDisconnectDriver()attempts disconnection even when the bus's cachedIsManagedflag is clear, so externally connected consumers are not skipped.Connection and disconnection helpers preserve a caller already at or below
TPL_CALLBACKinstead of unconditionally changing its TPL.How This Was Tested
Ran on physical platform. Physical platform used UsbIo to send a device to
DFU mode. Then would attempt to locate the new UsbIo interface to send
a firmware update to the newly discovered DFU interface.
Prior to changes, the UsbIo DFU interface would not be found.
After the changes, the DFU interface was available.
Integration Instructions
No Integration necessary.