[U-Boot] [PATCH 1/1] efi_driver: set block size for EFI block device

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Oct 24 20:49:00 UTC 2019


Copy the block size from the block IO protocol to the U-Boot block device
descriptor. This information is used by the ext4 file system driver.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_driver/efi_block_device.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index cf02341931..9de526a95b 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -137,6 +137,7 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
 	struct efi_block_io *io = interface;
 	int disks;
 	struct efi_blk_platdata *platdata;
+	struct blk_desc *desc;

 	EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, io);

@@ -174,6 +175,11 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
 		return ret;
 	EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name);

+	/* Set block size */
+	desc = dev_get_uclass_platdata(bdev);
+	desc->blksz = io->media->block_size;
+	desc->log2blksz = LOG2(desc->blksz);
+
 	/* Create handles for the partions of the block device */
 	disks = efi_bl_bind_partitions(handle, bdev);
 	EFI_PRINT("Found %d partitions\n", disks);
--
2.20.1



More information about the U-Boot mailing list