aboutsummaryrefslogtreecommitdiffstats
path: root/lib/efi_driver/efi_uclass.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-10-05 11:28:47 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-10-06 22:54:58 +0200
commit8f8fe1d458664aaa15fa82de78dfdb0eca74b2ca (patch)
tree4ce4f091b1cfe1c427de7d32f6e1e406d5f52d41 /lib/efi_driver/efi_uclass.c
parentec4f675f9ebec2535f2cd050aed7f9c106a5bee9 (diff)
downloadu-boot-8f8fe1d458664aaa15fa82de78dfdb0eca74b2ca.tar.gz
efi_driver: add init function to EFI block driver
For handling added and removed block devices we need to register events which has to be done when the driver is installed. This patch only creates an empty init function that will be filled with code later on. The function needs to be called before any EFI block devices are used. Move the efi_driver_init() call to early init. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib/efi_driver/efi_uclass.c')
-rw-r--r--lib/efi_driver/efi_uclass.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
index 0a16c594e3a..2193f8493fd 100644
--- a/lib/efi_driver/efi_uclass.c
+++ b/lib/efi_driver/efi_uclass.c
@@ -284,7 +284,7 @@ static efi_status_t efi_add_driver(struct driver *drv)
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) {
@@ -294,13 +294,20 @@ static efi_status_t efi_add_driver(struct driver *drv)
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;
}
/**