[PATCH v4 0/1] blk: Rationalise the block interface

Simon Glass sjg at chromium.org
Sat Sep 17 17:00:08 CEST 2022


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.

Changes in v4:
- Fix comments from Takahiro Akashi missed on the previous revision

Changes in v3:
- Drop previously applied patches
- Rebase on -next after EFI changes

Changes in v2:
- Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()

Simon Glass (1):
  blk: Rename if_type to uclass_id

 board/st/common/stm32mp_dfu.c |   2 +-
 cmd/bcb.c                     |   4 +-
 cmd/blk_common.c              |  18 ++---
 cmd/lsblk.c                   |   2 +-
 cmd/mmc.c                     |   4 +-
 common/spl/spl_sata.c         |   2 +-
 common/spl/spl_usb.c          |   2 +-
 common/usb_storage.c          |   6 +-
 disk/disk-uclass.c            |   8 +-
 disk/part.c                   |  14 ++--
 doc/usage/partitions.rst      |   2 +-
 drivers/ata/sata.c            |   2 +-
 drivers/block/blk-uclass.c    | 145 +++++++++++++++++-----------------
 drivers/block/blk_legacy.c    |  58 +++++++-------
 drivers/block/ide.c           |   8 +-
 drivers/block/sandbox.c       |   8 +-
 drivers/mmc/mmc-uclass.c      |   2 +-
 drivers/mmc/mmc_legacy.c      |   8 +-
 drivers/net/fsl_enetc.c       |  12 +--
 drivers/net/fsl_enetc.h       |   2 +-
 drivers/scsi/scsi.c           |   6 +-
 drivers/virtio/virtio_blk.c   |   2 +-
 drivers/xen/pvblock.c         |   2 +-
 fs/fat/fat.c                  |   2 +-
 include/blk.h                 | 122 ++++++++++++++--------------
 include/efi_loader.h          |   4 +-
 lib/efi_loader/efi_disk.c     |  12 +--
 lib/efi_loader/efi_var_file.c |   4 +-
 28 files changed, 231 insertions(+), 232 deletions(-)

-- 
2.37.3.968.ga6b4b080e4-goog



More information about the U-Boot mailing list