[PATCH 09/16] efi_driver: efi_uclass: Add unbind method to efi_driver_ops
Adriano Cordova
adrianox at gmail.com
Tue Mar 11 17:47:51 CET 2025
Signed-off-by: Adriano Cordova <adriano.cordova at canonical.com>
---
include/efi_driver.h | 4 ++++
lib/efi_driver/efi_uclass.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/include/efi_driver.h b/include/efi_driver.h
index 63a95e4cf80..8f785f79459 100644
--- a/include/efi_driver.h
+++ b/include/efi_driver.h
@@ -36,6 +36,8 @@ struct efi_driver_binding_extended_protocol {
* driver binding protocol.
* @bind: Function called by the EFI uclass to attach the
* driver to EFI driver to a handle.
+ * @unbind: Function called by the EFI uclass to detach the
+ * driver to EFI driver to a handle.
*/
struct efi_driver_ops {
const efi_guid_t *protocol;
@@ -43,6 +45,8 @@ struct efi_driver_ops {
efi_status_t (*init)(struct efi_driver_binding_extended_protocol *this);
efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
efi_handle_t handle, void *interface);
+ efi_status_t (*unbind)(struct efi_driver_binding_extended_protocol *this,
+ efi_handle_t handle);
};
#endif /* _EFI_DRIVER_H */
diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
index fc8808374a1..36a86817eb7 100644
--- a/lib/efi_driver/efi_uclass.c
+++ b/lib/efi_driver/efi_uclass.c
@@ -249,6 +249,10 @@ static efi_status_t EFIAPI efi_uc_stop(
if (ret != EFI_SUCCESS)
log_err("Cannot free EFI memory pool\n");
+ ret = bp->ops->unbind(bp, controller_handle);
+ if (ret != EFI_SUCCESS)
+ goto out;
+
/* Detach driver from controller */
ret = efi_close_protocol(controller_handle, bp->ops->protocol,
this->driver_binding_handle,
--
2.48.1
More information about the U-Boot
mailing list