[PATCH v2 00/24] blk: Rationalise the block interface

Simon Glass sjg at chromium.org
Fri Aug 12 03:34:39 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 v2:
- Update commit message
- Fix SPL_PARTITIONS too
- Add SATA also
- Refer to a suffix, not a prefix
- Add new patch to handle UCLASS_EFI_MEDIA in dev_print()
- Add new patch to drop ifname field from struct efi_disk_obj
- Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()

Simon Glass (24):
  disk: Correct help for TPL_PARTITIONS
  blk: Enable CONFIG_BLK for all media
  ata: Fix an instance of SPL_SATA_SUPPORT
  sandbox: Avoid defining HAVE_BLOCK_DEVICE in Konfig
  disk: Use Makefile to omit partition drivers
  blk: Use a function for whether block devices are available
  cmd: Drop use of HAVE_BLOCK_DEVICE
  blk: Drop unnecessary #ifdef in in blk_legacy
  blk: Rename HAVE_BLOCK_DEVICE
  blk: Select SPL_LEGACY_BLOCK automatically
  blk: Drop unnecessary CONFIG_SPL_LEGACY_BLOCK in defconfigs
  blk: Hide the BLK and SPL_LEGACY_BLOCK options
  blk: Drop IF_TYPE_DOC
  ide: Use a flag for an ATAPI device
  blk: Drop IF_TYPE_ATAPI
  blk: Drop IF_TYPE_SD
  blk: Rename var in blk_get_devnum_by_typename()
  blk: Rewrite if_type to name functions
  efi: Correct assumption about if_type
  blk: Switch over to using uclass IDs
  disk: Handle UCLASS_EFI_MEDIA in dev_print()
  blk: Drop if_type
  efi: Drop ifname field from struct efi_disk_obj
  blk: Rename if_type to uclass_id

 arch/Kconfig                                  |   1 -
 arch/arm/Kconfig                              |   1 -
 .../mach-stm32mp/cmd_stm32prog/stm32prog.c    |   4 +-
 board/st/common/stm32mp_dfu.c                 |   2 +-
 board/toradex/common/tdx-cfg-block.c          |   4 +-
 cmd/Kconfig                                   |   5 -
 cmd/Makefile                                  |   2 +-
 cmd/bcb.c                                     |   4 +-
 cmd/blk_common.c                              |  18 +-
 cmd/ide.c                                     |   2 +-
 cmd/lsblk.c                                   |   2 +-
 cmd/mmc.c                                     |  10 +-
 cmd/mvebu/bubt.c                              |   2 +-
 cmd/nvme.c                                    |   4 +-
 cmd/pvblock.c                                 |   2 +-
 cmd/sata.c                                    |   4 +-
 cmd/scsi.c                                    |   2 +-
 cmd/usb.c                                     |   2 +-
 cmd/virtio.c                                  |   2 +-
 common/spl/Kconfig                            |   2 -
 common/spl/spl_sata.c                         |   2 +-
 common/spl/spl_usb.c                          |   2 +-
 common/usb_storage.c                          |  10 +-
 configs/M5253DEMO_defconfig                   |   1 +
 configs/axm_defconfig                         |   1 -
 configs/bcm968380gerg_ram_defconfig           |   1 -
 .../gardena-smart-gateway-mt7688_defconfig    |   1 -
 configs/nsim_hs38_defconfig                   |   1 -
 configs/qemu-ppce500_defconfig                |   1 -
 disk/Kconfig                                  |   8 +-
 disk/Makefile                                 |   4 +
 disk/disk-uclass.c                            |  11 +-
 disk/part.c                                   | 161 ++++++-------
 disk/part_amiga.c                             |   4 -
 disk/part_dos.c                               |   4 -
 disk/part_efi.c                               |   3 -
 disk/part_iso.c                               |   3 -
 disk/part_mac.c                               |   3 -
 doc/develop/driver-model/migration.rst        |   2 +-
 doc/develop/uefi/uefi.rst                     |   2 +-
 doc/usage/partitions.rst                      |   2 +-
 drivers/Makefile                              |   3 +-
 drivers/ata/Kconfig                           |   4 +-
 drivers/ata/dwc_ahsata.c                      |   2 +-
 drivers/ata/fsl_sata.c                        |   2 +-
 drivers/ata/sata.c                            |   2 +-
 drivers/ata/sata_mv.c                         |   2 +-
 drivers/ata/sata_sil.c                        |   2 +-
 drivers/block/Kconfig                         |  20 +-
 drivers/block/Makefile                        |   2 +-
 drivers/block/blk-uclass.c                    | 219 +++++++++---------
 drivers/block/blk_legacy.c                    |  60 +++--
 drivers/block/efi_blk.c                       |   2 +-
 drivers/block/ide.c                           |  16 +-
 drivers/block/sandbox.c                       |  14 +-
 drivers/dfu/dfu_mmc.c                         |   6 +-
 drivers/mmc/Kconfig                           |   1 -
 drivers/mmc/mmc-uclass.c                      |  12 +-
 drivers/mmc/mmc_legacy.c                      |   8 +-
 drivers/mmc/mmc_write.c                       |   4 +-
 drivers/net/fsl_enetc.c                       |  12 +-
 drivers/net/fsl_enetc.h                       |   2 +-
 drivers/nvme/Kconfig                          |   2 -
 drivers/nvme/nvme.c                           |   2 +-
 drivers/scsi/Kconfig                          |   2 -
 drivers/scsi/scsi.c                           |  12 +-
 drivers/tee/optee/rpmb.c                      |   4 +-
 drivers/virtio/Kconfig                        |   1 -
 drivers/virtio/virtio_blk.c                   |   4 +-
 drivers/xen/Kconfig                           |   1 -
 drivers/xen/pvblock.c                         |   6 +-
 env/mmc.c                                     |   4 +-
 fs/fat/fat.c                                  |   4 +-
 include/blk.h                                 | 141 +++++------
 include/efi_api.h                             |   4 +-
 include/efi_loader.h                          |   4 +-
 include/mmc.h                                 |   2 +-
 lib/efi_driver/efi_block_device.c             |   4 +-
 lib/efi_loader/Kconfig                        |   1 -
 lib/efi_loader/efi_device_path.c              |   2 +-
 lib/efi_loader/efi_device_path_to_text.c      |   4 +-
 lib/efi_loader/efi_disk.c                     |  28 ++-
 lib/efi_loader/efi_net.c                      |   2 +-
 lib/efi_loader/efi_var_file.c                 |   4 +-
 test/dm/blk.c                                 |  24 +-
 85 files changed, 444 insertions(+), 515 deletions(-)

-- 
2.37.1.595.g718a3a8f04-goog



More information about the U-Boot mailing list