[U-Boot] [RFC 0/3] dm, efi: integrate efi_disk into DM

AKASHI Takahiro takahiro.akashi at linaro.org
Tue Jan 29 02:59:53 UTC 2019


This patch set came from the past discussion[1] on my "removable device
support" patch and is intended to be an attempt to integrate efi_disk
(more precisely, EFI_BLOCK_IO_PROTOCOL-capable efi object) into u-boot's
Driver Model as much seamlessly as possible

[1] https://lists.denx.de/pipermail/u-boot/2019-January/354010.html

Basic idea is
* create UCLASS_PARTITION
* enumerate all the partitions when a block device is probed
* hook up a creation of UCLASS_BLK or UCLASS_PARTITION device
  to efi handler for efi_disk attributes to be properly set up

Since this patch is a prototype (or POC, proof-of-concept), the aim here
is to discuss further about how in a better shape we will be able to
merge the two worlds.


Example operation:
(Two scsi disks, one with no partition, one with two partitions)

U-Boot 2019.01-rc3-00024-ga81a6f87ad48 (Jan 29 2019 - 10:56:45 +0900)

DRAM:  1 GiB
In:    pl011 at 9000000
Out:   pl011 at 9000000
Err:   pl011 at 9000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
=> efi devices
Device           Device Path
================ ====================
000000007ef01350 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
=> scsi rescan

Reset SCSI
scanning bus for devices...
Target spinup took 0 ms.
Target spinup took 0 ms.
SATA link 2 timeout.
SATA link 3 timeout.
SATA link 4 timeout.
SATA link 5 timeout.
AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x3f impl SATA mode
flags: 64bit ncq only 
  Device 0: (0:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
            Type: Hard Disk
            Capacity: 16.0 MB = 0.0 GB (32768 x 512)
  Device 0: (1:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
            Type: Hard Disk
            Capacity: 256.0 MB = 0.2 GB (524288 x 512)
=> efi devices
Device           Device Path
================ ====================
000000007ef01350 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
000000007ef0b2c0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)
000000007ef0b7b0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(1,0)
000000007ef0c760 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(1,0)/HD(-1,MBR,0x086246ba,0x17ff56048,0x7eeeb770)
000000007ef0cb50 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(1,0)/HD(-1,MBR,0x086246ba,0x17ff56048,0x7eeeb770)
=> dm tree
 Class    index  Probed  Driver                Name
-----------------------------------------------------------
 root        0  [ + ]   root_driver           root_driver
 ...
 pci         0  [ + ]   pci_generic_ecam      |-- pcie at 10000000
 pci_generi  0  [   ]   pci_generic_drv       |   |-- pci_0:0.0
 virtio      32  [   ]   virtio-pci.l          |   |-- virtio-pci.l#0
 ahci        0  [ + ]   ahci_pci              |   `-- ahci_pci
 scsi        0  [ + ]   ahci_scsi             |       `-- ahci_scsi
 blk         0  [   ]   scsi_blk              |           |-- ahci_scsi.id0lun0
 blk         1  [   ]   scsi_blk              |           `-- ahci_scsi.id1lun0
 partition   0  [   ]   blk_partition         |               |-- ahci_scsi.id1lun0:1
 partition   1  [   ]   blk_partition         |               `-- ahci_scsi.id1lun0:2
 ...

Thanks,
-Takahiro Akashi

AKASHI Takahiro (3):
  dm: blk: add UCLASS_PARTITION
  efi_loader: associate BLK/PARTITION device to efi_disk
  drivers: align block device drivers with DM-efi integration

 common/usb_storage.c              |  27 ++++-
 drivers/block/blk-uclass.c        |  61 ++++++++++
 drivers/core/device.c             |   3 +
 drivers/scsi/scsi.c               |  22 ++++
 include/blk.h                     |  24 ++++
 include/dm/device.h               |   4 +
 include/dm/uclass-id.h            |   1 +
 lib/efi_driver/efi_block_device.c |  30 ++---
 lib/efi_loader/efi_disk.c         | 192 +++++++++++++++++++++---------
 9 files changed, 283 insertions(+), 81 deletions(-)

-- 
2.19.1



More information about the U-Boot mailing list