[PATCH 0/2] efi_loader: fix device-path for USB devices

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sun Mar 19 16:18:07 CET 2023


EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub and hence are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Given a driver model tree

    root       0 root_driver   root_driver
    usb        0 ehci_generic  |-- usb at 1c1a000
    usb_hub    0 usb_hub          `-- usb_hub
    usb_hub    1 usb_hub              `-- usb_hub
    usb_mass_s 2 usb_mass_storage         `-- usb_mass_storage
    blk        4 usb_storage_blk              |-- usb_mass_storage.lun0

where the USB mass storage device is connected to port 4 of the 2nd hub,
the device path for LUN 0 will be:

    /VenHw()/USB(0x0,0x0)/USB(0x1,0x0)/USB(0x4,0x0)/Ctrl(0x0)

Heinrich Schuchardt (2):
  efi_loader: support for Ctrl() device path node
  efi_loader: fix device-path for USB devices

 include/efi_api.h                        |  6 ++++
 lib/efi_loader/efi_device_path.c         | 45 +++++++++++++++++-------
 lib/efi_loader/efi_device_path_to_text.c |  7 ++++
 3 files changed, 46 insertions(+), 12 deletions(-)

-- 
2.39.2



More information about the U-Boot mailing list