On 17.01.18 20:16, Heinrich Schuchardt wrote:
> U-Boot devices and EFI handles can be related, e.g. an
> IDE disk relates to a handle with the EFI_BLOCK_IO_PROTOCOL.
> Provide pointers to store these links.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>

You actually wouldn't need any of these changes I think. With a small
change to the block driver, even the need for "dev" disappears.

Alex

diff --git a/lib/efi_driver/efi_block_device.c
b/lib/efi_driver/efi_block_device.c
index 837787d563..71c752d107 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -91,19 +91,19 @@ static ulong efi_bl_write(struct udevice *dev,
lbaint_t blknr, lbaint_t blkcnt,
        return blkcnt;
 }

-static int efi_bl_bind_partions(efi_handle_t handle)
+static int efi_bl_bind_partions(efi_object *obj, struct udevice *bdev)
 {
        struct efi_object *obj = efi_search_obj(handle);
        struct blk_desc *desc;
        const char *if_typename;

-       if (!obj || !obj->dev)
+       if (!obj || !bdev)
                return -ENOENT;
-       desc = dev_get_uclass_platdata(obj->dev);
+       desc = dev_get_uclass_platdata(bdev);
        if_typename = blk_get_if_type_name(desc->if_type);

        return efi_disk_create_partitions(handle, desc, if_typename,
-                                         desc->devnum, obj->dev->name);
+                                         desc->devnum, bdev->name);
 }

 /*
@@ -137,11 +137,10 @@ static int efi_bl_bind(efi_handle_t handle, void
*interface)
                return ret;
        EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name);
        bdev->platdata = interface;
-       obj->dev = bdev;

        ret = blk_prepare_device(bdev);

-       disks = efi_bl_bind_partions(handle);
+       disks = efi_bl_bind_partions(obj, bdev);
        EFI_PRINT("Found %d partions\n", disks);

        return 0;
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to