mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-29 08:00:26 +09:00
efi_loader: fix DisconnectController() for sole child
If ChildHandle indicates the sole child of the driver, disconnect the driver. This fixes the test results for UEFI SCT 2.6 A sub-tests 5.1.3.12.43, 5.1.3.12.44, 5.1.3.12.45. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
cdeb7b8f98
commit
314bed6c85
@ -3523,6 +3523,7 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
size_t number_of_children = 0;
|
size_t number_of_children = 0;
|
||||||
efi_status_t r;
|
efi_status_t r;
|
||||||
struct efi_object *efiobj;
|
struct efi_object *efiobj;
|
||||||
|
bool sole_child;
|
||||||
|
|
||||||
EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
|
EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
|
||||||
child_handle);
|
child_handle);
|
||||||
@ -3545,16 +3546,18 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create list of child handles */
|
/* Create list of child handles */
|
||||||
if (child_handle) {
|
|
||||||
number_of_children = 1;
|
|
||||||
child_handle_buffer = &child_handle;
|
|
||||||
} else {
|
|
||||||
r = efi_get_child_controllers(efiobj,
|
r = efi_get_child_controllers(efiobj,
|
||||||
driver_image_handle,
|
driver_image_handle,
|
||||||
&number_of_children,
|
&number_of_children,
|
||||||
&child_handle_buffer);
|
&child_handle_buffer);
|
||||||
if (r != EFI_SUCCESS)
|
if (r != EFI_SUCCESS)
|
||||||
return r;
|
return r;
|
||||||
|
sole_child = (number_of_children == 1);
|
||||||
|
|
||||||
|
if (child_handle) {
|
||||||
|
number_of_children = 1;
|
||||||
|
free(child_handle_buffer);
|
||||||
|
child_handle_buffer = &child_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the driver binding protocol */
|
/* Get the driver binding protocol */
|
||||||
@ -3579,7 +3582,7 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Remove the driver */
|
/* Remove the driver */
|
||||||
if (!child_handle) {
|
if (!child_handle || sole_child) {
|
||||||
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
||||||
controller_handle,
|
controller_handle,
|
||||||
0, NULL));
|
0, NULL));
|
||||||
|
Loading…
Reference in New Issue
Block a user