]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_driver: provide driver binding protocol to bind function
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 4 Oct 2022 17:12:59 +0000 (19:12 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 6 Oct 2022 20:54:57 +0000 (22:54 +0200)
DisconnectController() is based on the open protocol information created
when the driver opens a protocol with BY_CHILD_CONTROLLER or BY_DRIVER.

To create an open protocol information it is required to supply the handle
of the driver as agent handle. This information is available as field
DriverBindingHandle in the driver binding protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
include/efi_driver.h
lib/efi_driver/efi_block_device.c
lib/efi_driver/efi_uclass.c

index de38abe83bd400b22f19521b17ccc4fb3044e305..71e0d3194ea82a7bcf0d5c35b32b8fed9ca46f98 100644 (file)
 
 #include <efi_loader.h>
 
+/**
+ * struct efi_driver_binding_extended_protocol - extended driver binding protocol
+ *
+ * This structure adds internal fields to the driver binding protocol.
+ *
+ * @bp:                driver binding protocol
+ * @ops:       operations supported by the driver
+ */
+struct efi_driver_binding_extended_protocol {
+       struct efi_driver_binding_protocol bp;
+       const struct efi_driver_ops *ops;
+};
+
 /**
  * struct efi_driver_ops - operations support by an EFI driver
  *
 struct efi_driver_ops {
        const efi_guid_t *protocol;
        const efi_guid_t *child_protocol;
-       efi_status_t (*bind)(efi_handle_t handle, void *interface);
-};
-
-/**
- * struct efi_driver_binding_extended_protocol - extended driver binding protocol
- *
- * This structure adds internal fields to the driver binding protocol.
- *
- * @bp:                driver binding protocol
- * @ops:       operations supported by the driver
- */
-struct efi_driver_binding_extended_protocol {
-       struct efi_driver_binding_protocol bp;
-       const struct efi_driver_ops *ops;
+       efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
+                            efi_handle_t handle, void *interface);
 };
 
 #endif /* _EFI_DRIVER_H */
index e9eabbde58da5b8be8dc994caa444e43a7601db6..f440067f702bedeeecc255142c031f79b8b95420 100644 (file)
@@ -174,11 +174,14 @@ err:
 /**
  * efi_bl_bind() - bind to a block io protocol
  *
+ * @this:      driver binding protocol
  * @handle:    handle
  * @interface: block io protocol
  * Return:     status code
  */
-static efi_status_t efi_bl_bind(efi_handle_t handle, void *interface)
+static efi_status_t efi_bl_bind(
+                       struct efi_driver_binding_extended_protocol *this,
+                       efi_handle_t handle, void *interface)
 {
        efi_status_t ret = EFI_SUCCESS;
        struct efi_object *obj = efi_search_obj(handle);
index aabee0e2601b4ea2ce82877ff944e08d6858f4dc..0a16c594e3ae937db00741b8eba595b00d433ca6 100644 (file)
@@ -146,7 +146,7 @@ static efi_status_t EFIAPI efi_uc_start(
        ret = check_node_type(controller_handle);
        if (ret != EFI_SUCCESS)
                goto err;
-       ret = bp->ops->bind(controller_handle, interface);
+       ret = bp->ops->bind(bp, controller_handle, interface);
        if (ret == EFI_SUCCESS)
                goto out;