From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>,
U-Boot Mailing List <u-boot@lists.denx.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Alexander Graf <agraf@csgraf.de>
Subject: Re: [BUG] efi_loader: incorrect creation of device paths
Date: Wed, 24 Nov 2021 12:10:32 +0900 [thread overview]
Message-ID: <20211124031032.GB9598@laputa> (raw)
In-Reply-To: <6df46f32-f76e-ef2d-aaee-d0349c480789@gmx.de>
On Sat, Nov 20, 2021 at 01:54:30PM +0100, Heinrich Schuchardt wrote:
> Hello Takahiro,
>
> in a prior mail we have discussed the creation of device paths for USB
> mass storage devices.
>
> On the sand boxyou get the following devices after 'usb start':
>
> Class Index Probed Driver Name
> -----------------------------------------------------------
> usb 0 [ + ] usb_sandbox |-- usb@1
> usb_hub 0 [ + ] usb_hub | `-- hub
> usb_mass_s 0 [ + ] usb_mass_storage | |--
> usb_mass_storage
> blk 3 [ ] usb_storage_blk | | `--
> usb_mass_storage.lun0
> usb_mass_s 1 [ + ] usb_mass_storage | |--
> usb_mass_storage
> blk 4 [ ] usb_storage_blk | | `--
> usb_mass_storage.lun0
> usb_mass_s 2 [ + ] usb_mass_storage | `--
> usb_mass_storage
> blk 5 [ ] usb_storage_blk | `--
> usb_mass_storage.lun0
>
> For of these storage devices we try to create the same device path which
> is not allowable:
>
> => usb start
> starting USB...
> Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found
> scanning usb for storage devices... 3 Storage Device(s) found
> =>
> => efidebug dh
> Scanning disk mmc2.blk...
> handle 0000000015e34f00,
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0)
> Scanning disk mmc1.blk...
> handle 0000000015e36b30,
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)
> Scanning disk mmc0.blk...
> handle 0000000015e35b00,
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2)
> Scanning disk usb_mass_storage.lun0...
> handle 0000000015e35c10,
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x1234,0x5678,0x9,0x0,0x0)/UsbClass(0x1234,0x5678,0x0,0x0,0x0)
> fs_devread read outside partition 2
> Failed to mount ext2 filesystem...
> BTRFS: superblock end 69632 is larger than device size 512
> Scanning disk usb_mass_storage.lun0...
> handle 0000000015e361f0,
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x1234,0x5678,0x9,0x0,0x0)/UsbClass(0x1234,0x5678,0x0,0x0,0x0)
> ERROR: failure to add disk device usb_mass_storage.lun0, r = 20
> Error: Cannot initialize UEFI sub-system, r = 20
>
> I will provide a patch that will allow the first USB device to be used
> and avoids stopping the boot process. But we really have to walk the dm
> tree to create a device patch for USB devices based on port IDs.
>
> We should add a new field to struct uclass_driver:
>
> struct efi_device_path *get_node(udevice *dev);
>
> This function shall return a pointer to an freshly allocated buffer with
> the device node for the device. To build the devicepath we can then walk
> the dm tree.
I'm not sure this is an acceptable solution.
Let me make sure:
The goal would be to create a device path like
.../USB(0x1,0x0)/HD(1,...)
instead of
.../UsbHub(0x0,0x0,0x0,0x3)/UsbMassStorage(0x46f4,0x1,0x0,0x0)/HD(1,...)
as we already see this format for SCSI:
.../Scsi(0,0)/HD(1,..)
Right?
-Takahiro Akashi
> To make migration easier: If the function pointer or the return value is
> NULL we can create a CTRL() node as dummy using the uclass_id and the
> device number.
>
> Best regards
>
> Heinrich
next prev parent reply other threads:[~2021-11-24 3:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-20 12:54 [BUG] efi_loader: incorrect creation of device paths Heinrich Schuchardt
2021-11-24 3:10 ` AKASHI Takahiro [this message]
2021-11-25 5:44 ` AKASHI Takahiro
2021-12-03 7:12 ` AKASHI Takahiro
2021-12-03 16:32 ` Heinrich Schuchardt
2021-12-06 4:16 ` AKASHI Takahiro
2021-12-06 11:41 ` Mark Kettenis
2021-12-07 1:33 ` AKASHI Takahiro
2023-07-19 10:15 ` Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211124031032.GB9598@laputa \
--to=takahiro.akashi@linaro.org \
--cc=agraf@csgraf.de \
--cc=ilias.apalodimas@linaro.org \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox