[U-Boot] [PATCH v2 00/44] dm: blk: Add more driver-model support for block devices

Simon Glass sjg at chromium.org
Sun May 1 19:35:48 CEST 2016


This series adjusts the block device code to support conversion to driver
model. Specifically

- A new 'legacy' block interface is created, allowing block devices to be
defined by a linker list and accessed through function calls
- Block device commands (such as sata and scsi) are adjusted to use these
functions rather than the block device array directly
- These same function calls are then implemented by the block uclass
- The existing block-device table in part.c is dropped
- The opportunity is taken to clean up the code style, as block devices are
one of the few remaining dark corners in U-Boot

It is useful to enable all block device drivers with sandbox. This improves
sandbox code coverage and allows tests to be written. The following are
enabled by this series:

- IDE
- SCSI
- SATA
- Systemace

USB was already enabled. MMC will be enabled by a future series. Note that
these devices do not actually function in sandbox, but the code is compiled.

As mentioned, future work will enable MMC for sandbox including adding
rudimentary sandbox SD card emulation. It would also be possible to create
emulations for IDE, SCSI, SATA and Systemace but that work is not planned.

It should be noted that the current CONFIG_DM_MMC option does not fully
enable driver model for MMC, since the MMC operations are not running
through driver model. This will need to be addressed at some point.

This series is available at u-boot-dm/blka-working

Changes in v2:
- Tweak the cast
- Make the string functions empty, since the implementation is not useful
- Drop the code inside '#if 0'
- Adjust newline output in blk_list_part()
- Mention MMC partition 0 in the comments
- Update the commit message to indicate that IDE doesn't work on sandbox

Simon Glass (44):
  Revert "dm: sandbox: Drop the pre-DM host implementation"
  dm: sandbox: Add a board for sandbox without CONFIG_BLK
  pci: Drop CONFIG_SYS_SCSI_SCAN_BUS_REVERSE
  dm: Rename disk uclass to ahci
  Allow iotrace byte access to use an address of any size
  sandbox: Add string and 16-bit I/O functions
  sandbox: Add dummy SCSI functions
  sandbox: Add dummy SATA functions
  dm: scsi: Remove the forward declarations
  dm: scsi: Fix up code style
  dm: ide: Correct various code style problems
  dm: ide: Remove the forward declarations
  dm: sata: Fix code style problems in cmd/sata.c
  dm: scsi: Rename CONFIG_CMD_SCSI to CONFIG_SCSI
  dm: blk: Add a legacy block interface
  dm: systemace: Add a legacy block interface
  dm: sandbox: Add a legacy host block interface
  dm: usb: Add a legacy block interface for USB storage
  dm: mmc: Add a legacy block interface for MMC
  dm: mmc: Add an implementation of the 'devnum' functions
  dm: scsi: Separate the non-command code into its own file
  dm: ide: Separate the non-command code into its own file
  dm: sata: Separate the non-command code into its own file
  dm: disk: Use legacy block driver info for block device access
  dm: usb: Drop the get_dev() function
  dm: ide: Drop the get_dev() function
  dm: mmc: Drop the get_dev() function
  dm: scsi: Drop the get_dev() function
  dm: sata: Drop the get_dev() function
  dm: systemace: Drop the get_dev() function
  dm: blk: Drop the systemace.h header
  dm: sandbox: Drop the host_get_dev() function
  dm: part: Drop the get_dev() method
  dm: ide: Add support for driver-model block devices
  dm: sandbox: Enable IDE
  dm: scsi: Add support for driver-model block devices
  dm: sandbox: Enable SCSI
  dm: sata: Add support for driver-model block devices
  dm: sandbox: Enable SATA
  dm: blk: Allow blk_create_device() to allocate the device number
  dm: blk: Add a easier way to create a named block device
  dm: systemace: Reorder function to avoid forward declarataions
  dm: systemace: Add driver-mode block-device support
  dm: sandbox: Enable systemace

 README                                         |    4 +-
 api/api_storage.c                              |    2 +-
 arch/arm/include/asm/arch-ls102xa/config.h     |    2 +-
 arch/sandbox/include/asm/io.h                  |   15 +
 arch/x86/Kconfig                               |    3 +
 arch/x86/cpu/broadwell/sata.c                  |    2 +-
 arch/x86/cpu/intel_common/cpu.c                |    2 +-
 arch/x86/cpu/ivybridge/bd82x6x.c               |    2 +-
 arch/x86/cpu/ivybridge/sata.c                  |    2 +-
 board/cm5200/fwupdate.c                        |    2 +-
 board/mpl/pip405/README                        |    6 +-
 board/sandbox/MAINTAINERS                      |    7 +
 cmd/Makefile                                   |    8 +-
 cmd/disk.c                                     |    2 +-
 cmd/ide.c                                      | 1352 +-----------------------
 cmd/mmc.c                                      |    2 +-
 cmd/sata.c                                     |  142 +--
 cmd/scsi.c                                     |  753 ++-----------
 cmd/usb.c                                      |   16 +-
 common/Makefile                                |    6 +
 common/board_r.c                               |    4 +-
 common/ide.c                                   | 1231 +++++++++++++++++++++
 common/sata.c                                  |  115 ++
 common/scsi.c                                  |  592 +++++++++++
 common/spl/spl_sata.c                          |    2 +-
 common/spl/spl_usb.c                           |    2 +-
 common/usb_storage.c                           |   37 +-
 configs/sandbox_noblk_defconfig                |   98 ++
 disk/part.c                                    |   22 +-
 drivers/Makefile                               |    1 +
 drivers/block/Kconfig                          |    5 +-
 drivers/block/Makefile                         |    8 +-
 drivers/block/{disk-uclass.c => ahci-uclass.c} |    6 +-
 drivers/block/blk-uclass.c                     |  324 ++++++
 drivers/block/blk_legacy.c                     |  261 +++++
 drivers/block/sandbox.c                        |  103 +-
 drivers/block/sandbox_scsi.c                   |   29 +
 drivers/block/sata_sandbox.c                   |   33 +
 drivers/block/sym53c8xx.c                      |    2 +-
 drivers/block/systemace.c                      |  110 +-
 drivers/mmc/mmc.c                              |   24 +-
 drivers/pci/pci.c                              |    4 -
 fs/fat/fat.c                                   |    2 +-
 include/blk.h                                  |  228 +++-
 include/config_cmd_all.h                       |    2 +-
 include/config_distro_bootcmd.h                |    6 +-
 include/config_fallbacks.h                     |    2 +-
 include/configs/MPC8544DS.h                    |    2 +-
 include/configs/MPC8572DS.h                    |    2 +-
 include/configs/MPC8610HPCD.h                  |    2 +-
 include/configs/MPC8641HPCN.h                  |    4 +-
 include/configs/PIP405.h                       |    2 +-
 include/configs/am57xx_evm.h                   |    2 +-
 include/configs/cm_t54.h                       |    2 +-
 include/configs/db-88f6820-gp.h                |    2 +-
 include/configs/dra7xx_evm.h                   |    2 +-
 include/configs/efi-x86.h                      |    2 +-
 include/configs/galileo.h                      |    2 +-
 include/configs/highbank.h                     |    2 +-
 include/configs/ls1043aqds.h                   |    2 +-
 include/configs/ls2080aqds.h                   |    2 +-
 include/configs/ls2080ardb.h                   |    2 +-
 include/configs/omap5_uevm.h                   |    2 +-
 include/configs/qemu-x86.h                     |    2 +-
 include/configs/sandbox.h                      |   23 +
 include/configs/sbc8641d.h                     |    2 -
 include/configs/sunxi-common.h                 |    2 +-
 include/configs/x86-common.h                   |    2 +-
 include/configs/xilinx_zynqmp.h                |    2 +-
 include/dm/uclass-id.h                         |    2 +-
 include/ide.h                                  |    8 +
 include/iotrace.h                              |    5 +-
 include/part.h                                 |   15 -
 include/systemace.h                            |   17 -
 include/usb.h                                  |    1 -
 75 files changed, 3390 insertions(+), 2308 deletions(-)
 create mode 100644 common/ide.c
 create mode 100644 common/sata.c
 create mode 100644 common/scsi.c
 create mode 100644 configs/sandbox_noblk_defconfig
 rename drivers/block/{disk-uclass.c => ahci-uclass.c} (72%)
 create mode 100644 drivers/block/blk_legacy.c
 create mode 100644 drivers/block/sandbox_scsi.c
 create mode 100644 drivers/block/sata_sandbox.c
 delete mode 100644 include/systemace.h

-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list