summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-09-16 15:35:47 -0400
committerTom Rini <[email protected]>2022-09-16 15:35:47 -0400
commite17213b781ca86b40d2432aac1c6481308cff396 (patch)
treecce42cf3f4efee4ef239560c0a3c8eeb0ec47110 /lib
parent6ec7207ab3c4dad098967fef5df75e25240fd852 (diff)
parentec8bdc914c8328993cee62e01b4107b802cf45cc (diff)
Merge branch '2022-09-16-rationalize-the-block-interface' into next
The block interface has two separate implementations, one using driver model and one not. The latter is really only needed for SPL, where size constraints allegedly don't allow use of driver model. Of course we still need space for filesystems and other code, so it isn't clear that driver model is anything more than the straw that breaks the camel's back. The driver model version uses a uclass ID for the interface time, but converts back and forth between that and if_type, which is the legacy type. The HAVE_BLOCK_DEVICE define is mostly a hangover from the old days. At present its main purpose is to enable the legacy block implementation in SPL. Finally the use of 'select' to enable BLK does not work very well. It causes kconfig errors when another option depends on BLK and it is not recommended by the kconfig style guide. This series aims to clean things up: - Enable BLK based on whether different media types are used, but still allow boards to disable it - Rename HAVE_BLOCK_DEVICE to indicates its real purpose - Drop if_type and use the uclass instead - Drop some obsolete if_type values An issue not resolved by this series is that the sandbox host interface does not actually have a device. At present it uses the root device, which was convenience for the driver model conversion but not really correct. It should be possible to clean this up, in a future series. Another minor issue is the use of UCLASS_USB for a mass-storage device. This has been the case for a while and is not addresed by this series, other than to add a comment. Note that this test relies on Tom Rini's series to drop various boards including warp and cm_t335 Finally, a patch is included to make binman put fake files in a subdirectory, since repeated runs of certain boards can cause unrelated failues (e.g. chromebook_coral) when fake files are left around.
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_driver/efi_block_device.c4
-rw-r--r--lib/efi_loader/Kconfig1
-rw-r--r--lib/efi_loader/efi_disk.c4
-rw-r--r--lib/efi_loader/efi_var_file.c2
4 files changed, 5 insertions, 6 deletions
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index d57d281f850..3177ab67b81 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -128,7 +128,7 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
if (!obj)
return -ENOENT;
- devnum = blk_find_max_devnum(IF_TYPE_EFI_LOADER);
+ devnum = blk_find_max_devnum(UCLASS_EFI_LOADER);
if (devnum == -ENODEV)
devnum = 0;
else if (devnum < 0)
@@ -140,7 +140,7 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
sprintf(name, "efiblk#%d", devnum);
/* Create driver model udevice for the EFI block io device */
- ret = blk_create_device(parent, "efi_blk", name, IF_TYPE_EFI_LOADER,
+ ret = blk_create_device(parent, "efi_blk", name, UCLASS_EFI_LOADER,
devnum, io->media->block_size,
(lbaint_t)io->media->last_block, &bdev);
if (ret)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 5cfff8c56bc..476a22d7ea3 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -20,7 +20,6 @@ config EFI_LOADER
select EVENT_DYNAMIC
select LIB_UUID
imply PARTITION_UUIDS
- select HAVE_BLOCK_DEVICE
select REGEX
imply FAT
imply FAT_WRITE
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index a34ca46a11e..819dcb4f131 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -640,7 +640,7 @@ static int efi_disk_probe(void *ctx, struct event *event)
* has already created an efi_disk at this moment.
*/
desc = dev_get_uclass_plat(dev);
- if (desc->if_type != IF_TYPE_EFI_LOADER) {
+ if (desc->if_type != UCLASS_EFI_LOADER) {
ret = efi_disk_create_raw(dev);
if (ret)
return -1;
@@ -675,7 +675,7 @@ static int efi_disk_delete_raw(struct udevice *dev)
return -1;
desc = dev_get_uclass_plat(dev);
- if (desc->if_type != IF_TYPE_EFI_LOADER) {
+ if (desc->if_type != UCLASS_EFI_LOADER) {
diskobj = container_of(handle, struct efi_disk_obj, header);
efi_free_pool(diskobj->dp);
}
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 76a2ff9e412..994e66392fb 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -38,7 +38,7 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void)
char part_str[PART_STR_LEN];
int r;
- if (!efi_system_partition.if_type) {
+ if (efi_system_partition.if_type == UCLASS_INVALID) {
log_err("No EFI system partition\n");
return EFI_DEVICE_ERROR;
}