Update child handle validation in core_disconnect_controller() [Rebase & FF]#1045
Merged
makubacki merged 2 commits intoJul 15, 2026
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
makubacki
marked this pull request as ready for review
November 11, 2025 18:30
os-d
approved these changes
Nov 11, 2025
joschock
approved these changes
Nov 11, 2025
Javagedes
approved these changes
Nov 11, 2025
makubacki
force-pushed
the
disconnect_cont_child_validation
branch
from
December 19, 2025 19:52
92efccb to
1a66d75
Compare
makubacki
force-pushed
the
disconnect_cont_child_validation
branch
2 times, most recently
from
January 23, 2026 23:14
e28a222 to
c2768ec
Compare
1 task
Previously, when a specific child handle was requested but was not a child created by a driver managing the controller, that driver was not skipped. When the driver had no children its `Stop()` was still invoked, and the function reported success even though nothing was disconnected. This change: 1. Skips a driver when a specific child handle is requested but is not present in that driver's child list (checked via `child_handles` being empty after filtering). When no managing driver owns the child, the call returns `NotFound`. 2. Uses `total_children == child_handles.len()` to detect that the requested child was the driver's only child, in which case the driver itself is disconnected (`Stop()` with zero children). This matches the UEFI spec's "if ChildHandle is the only child ... the driver will be disconnected" behavior. Three unit tests are added: - `test_disconnect_specific_child_not_managed_by_driver()`: Checks that a specific child not owned by the single managing driver returns `NotFound` and `Stop()` is never called. - `test_disconnect_specific_child_among_multiple_children()`: Checks that a specific child among several is destroyed (`Stop()` called with that one child) while the driver-level `Stop()` is not called, so the driver stays connected. - `test_disconnect_specific_child_not_owned_by_either_driver()`: Checks that when two drivers are managing the controller and a child owned by neither is requested, that both drivers are skipped and `NotFound` is returned. Note: `EFI_NOT_FOUND` is not listed as a return value in for `DisconnectController()` in the UEFI 2.11 spec (section 7.3.13), but returning it when the requested child is unmanaged matches EDK II behavior. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
makubacki
force-pushed
the
disconnect_cont_child_validation
branch
from
July 14, 2026 22:24
c2768ec to
8196291
Compare
Contributor
✅ QEMU Validation PassedAll QEMU validation jobs completed successfully.
Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/29451283566 Boot Time to EFI Shell
Dependencies
This comment was automatically generated by the Patina QEMU PR Validation Post workflow. |
Collaborator
Author
|
@Javagedes, @os-d, @joschock, I finally returned to rebase this PR and clean up some test logic. Can someone please review again? |
joschock
approved these changes
Jul 14, 2026
The child-specific `core_disconnect_controller()` tests each repeated a lot of related logic to install a driver binding, mark the driver as managing the controller, and register its children. This commit adds two test helpers, `new_test_handle()` and `setup_driver_managing_controller()` to reduce the size of test functions. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
makubacki
force-pushed
the
disconnect_cont_child_validation
branch
from
July 15, 2026 20:59
8196291 to
483270c
Compare
makubacki
enabled auto-merge (rebase)
July 15, 2026 20:59
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 first commit is the actual change and the second consolidates and cleans up related test code.
Update child handle validation in core_disconnect_controller()
Previously, when a specific child handle was requested but was not a
child created by a driver managing the controller, that driver was not
skipped. When the driver had no children its
Stop()was stillinvoked, and the function reported success even though nothing was
disconnected.
This change:
Skips a driver when a specific child handle is requested but is not
present in that driver's child list (checked via
child_handlesbeing empty after filtering). When no managing driver owns the
child, the call returns
NotFound.Uses
total_children == child_handles.len()to detect that therequested child was the driver's only child, in which case the
driver itself is disconnected (
Stop()with zero children). Thismatches the UEFI spec's "if ChildHandle is the only child ... the
driver will be disconnected" behavior.
Three unit tests are added:
test_disconnect_specific_child_not_managed_by_driver(): Checksthat a specific child not owned by the single managing driver
returns
NotFoundandStop()is never called.test_disconnect_specific_child_among_multiple_children(): Checksthat a specific child among several is destroyed (
Stop()calledwith that one child) while the driver-level
Stop()is not called,so the driver stays connected.
test_disconnect_specific_child_not_owned_by_either_driver(): Checksthat when two drivers are managing the controller and a child owned
by neither is requested, that both drivers are skipped and
NotFoundis returned.
Note:
EFI_NOT_FOUNDis not listed as a return value in forDisconnectController()in the UEFI 2.11 spec (section 7.3.13), butreturning it when the requested child is unmanaged matches EDK II
behavior.
patina_dxe_core: Consolidate disconnect controller test setup logic
The child-specific
core_disconnect_controller()tests each repeateda lot of related logic to install a driver binding, mark the driver as
managing the controller, and register its children.
This commit adds two test helpers,
new_test_handle()andsetup_driver_managing_controller()to reduce the overall size oftest functions.
How This Was Tested
test_disconnect_specific_child_not_managed_by_driver()fails without the change and passes with itIntegration Instructions