* EFI_DRIVER_BINDING_PROTOCOL.
* @child_protocol: Protocol supported by the child handles generated by
* the EFI driver.
+ * @init: Function called by the EFI uclass after installing the
+ * driver binding protocol.
* @bind: Function called by the EFI uclass to attach the
* driver to EFI driver to a handle.
*/
struct efi_driver_ops {
const efi_guid_t *protocol;
const efi_guid_t *child_protocol;
+ 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);
};
return ret;
}
+/**
+ * efi_bl_init() - initialize block device driver
+ *
+ * @this: extended driver binding protocol
+ */
+static efi_status_t
+efi_bl_init(struct efi_driver_binding_extended_protocol *this)
+{
+ return EFI_SUCCESS;
+}
+
/* Block device driver operators */
static const struct blk_ops efi_blk_ops = {
.read = efi_bl_read,
static const struct efi_driver_ops driver_ops = {
.protocol = &efi_block_io_guid,
.child_protocol = &efi_block_io_guid,
+ .init = efi_bl_init,
.bind = efi_bl_bind,
};
bp->bp.start = efi_uc_start;
bp->bp.stop = efi_uc_stop;
bp->bp.version = 0xffffffff;
- bp->ops = drv->ops;
+ bp->ops = ops;
ret = efi_create_handle(&bp->bp.driver_binding_handle);
if (ret != EFI_SUCCESS) {
bp->bp.image_handle = bp->bp.driver_binding_handle;
ret = efi_add_protocol(bp->bp.driver_binding_handle,
&efi_guid_driver_binding_protocol, bp);
- if (ret != EFI_SUCCESS) {
- efi_delete_handle(bp->bp.driver_binding_handle);
- free(bp);
- goto out;
+ if (ret != EFI_SUCCESS)
+ goto err;
+ if (ops->init) {
+ ret = ops->init(bp);
+ if (ret != EFI_SUCCESS)
+ goto err;
}
out:
return ret;
+
+err:
+ efi_delete_handle(bp->bp.driver_binding_handle);
+ free(bp);
+ return ret;
}
/**
if (ret != EFI_SUCCESS)
goto out;
+ /* Initialize EFI driver uclass */
+ ret = efi_driver_init();
+ if (ret != EFI_SUCCESS)
+ goto out;
+
ret = efi_disk_init();
out:
return ret;
if (ret != EFI_SUCCESS)
goto out;
- /* Initialize EFI driver uclass */
- ret = efi_driver_init();
- if (ret != EFI_SUCCESS)
- goto out;
-
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) {
ret = efi_load_capsule_drivers();
if (ret != EFI_SUCCESS)