Re: [BUG] efi_loader: incorrect creation of device paths
On 03.12.21 17:32, Heinrich Schuchardt wrote: On 11/25/21 06:44, AKASHI Takahiro wrote: Heinrich, On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: 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 15e34f00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) Scanning disk mmc1.blk... handle 15e36b30, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) Scanning disk mmc0.blk... handle 15e35b00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) Scanning disk usb_mass_storage.lun0... handle 15e35c10, /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 15e361f0, /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? Please try the tweak attached below. (I think what I did here is trivial.) If you like, I will post it as a patch. (See "10.3.4.5.1 USB Device Path Example".) -Takahiro Akashi From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Thu, 25 Nov 2021 14:20:08 +0900 Subject: [PATCH] efi_loader: disk: usb mass-storage - use path_usb instead of path_usb_class for existing USB dp nodes - add a dp node for UCLASS_USB => usb start starting USB... Bus xhci_pci: Register 8001040 NbrPorts 8 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 4 USB Device(s) found scanning usb for storage devices... 2 Storage Device(s) found => dm tree Class Index Probed Driver Name --- root 0 [ + ] root_driver root_driver ... pci 0 [ + ] pci_generic_ecam |-- pcie@1000 pci_generi 0 [ ] pci_generic_drv | |-- pci_0:0.0 virtio 32 [ + ] virtio-pci.l | |-- virtio-pci.l#0 ethernet 0 [ + ] virtio-net | | `-- virtio-net#32 usb 0 [ + ] xhci_pci | `-- xhci_pci usb_hub 0 [ + ] usb_hub | `-- usb_hub usb_dev_ge 0 [ + ] usb_dev_generic_drv | |-- generic_bus_0_dev_2 usb_mass_s 0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 0 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s 1 [ + ] usb_mass_storage | `-- usb_mass_storage blk 1 [ ] usb_storage_blk | `-- usb_mass_storage.lun0 ... => efidebug devices Scanning disk usb_mass_storage.lun0... Scanning disk usb_mass_storage.lun0... Found 6
Re: [BUG] efi_loader: incorrect creation of device paths
Hi Mark, Thank you for the comment. On Mon, Dec 06, 2021 at 12:41:28PM +0100, Mark Kettenis wrote: > > Date: Mon, 6 Dec 2021 13:16:23 +0900 > > From: AKASHI Takahiro > > > > On Fri, Dec 03, 2021 at 05:32:49PM +0100, Heinrich Schuchardt wrote: > > > On 11/25/21 06:44, AKASHI Takahiro wrote: > > > > Heinrich, > > > > > > > > On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: > > > > > 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 DriverName > > > > > > --- > > > > > > usb 0 [ + ] usb_sandbox |-- usb@1 > > > > > > usb_hub 0 [ + ] usb_hub | `-- hub > > > > > > usb_mass_s0 [ + ] usb_mass_storage | |-- > > > > > > usb_mass_storage > > > > > > blk 3 [ ] usb_storage_blk | | `-- > > > > > > usb_mass_storage.lun0 > > > > > > usb_mass_s1 [ + ] usb_mass_storage | |-- > > > > > > usb_mass_storage > > > > > > blk 4 [ ] usb_storage_blk | | `-- > > > > > > usb_mass_storage.lun0 > > > > > > usb_mass_s2 [ + ] 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 15e34f00, > > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > > > > > > Scanning disk mmc1.blk... > > > > > > handle 15e36b30, > > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > > > > > > Scanning disk mmc0.blk... > > > > > > handle 15e35b00, > > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > > > > > > Scanning disk usb_mass_storage.lun0... > > > > > > handle 15e35c10, > > > > > > /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 15e361f0, > > > > > > /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? > > > > > > > > Please try the tweak attached below. > > > > (I think what I did here is trivial.) > > > > > > > > If you like, I will post it as a patch. > > > > (See "10.3.4.5.1 USB Device Path Example".) > > > > > > > > -Takahiro Akashi > > > > > > > > > > > From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 > > > > > > > 00:00:00 2001 > > > > > > > From: AKASHI Takahiro > > > > > > > Date: Thu, 25 Nov 2021 14:20:08 +0900 > > > > > > > Subject: [PATCH] efi_loader: disk: usb mass-storage > > > > > > > > - use path_usb instead of path_usb_class for existing USB dp nodes > > > > - add a dp node for UCLASS_USB > >
Re: [BUG] efi_loader: incorrect creation of device paths
> Date: Mon, 6 Dec 2021 13:16:23 +0900 > From: AKASHI Takahiro > > On Fri, Dec 03, 2021 at 05:32:49PM +0100, Heinrich Schuchardt wrote: > > On 11/25/21 06:44, AKASHI Takahiro wrote: > > > Heinrich, > > > > > > On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: > > > > 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 DriverName > > > > > --- > > > > > usb 0 [ + ] usb_sandbox |-- usb@1 > > > > > usb_hub 0 [ + ] usb_hub | `-- hub > > > > > usb_mass_s0 [ + ] usb_mass_storage | |-- > > > > > usb_mass_storage > > > > > blk 3 [ ] usb_storage_blk | | `-- > > > > > usb_mass_storage.lun0 > > > > > usb_mass_s1 [ + ] usb_mass_storage | |-- > > > > > usb_mass_storage > > > > > blk 4 [ ] usb_storage_blk | | `-- > > > > > usb_mass_storage.lun0 > > > > > usb_mass_s2 [ + ] 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 15e34f00, > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > > > > > Scanning disk mmc1.blk... > > > > > handle 15e36b30, > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > > > > > Scanning disk mmc0.blk... > > > > > handle 15e35b00, > > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > > > > > Scanning disk usb_mass_storage.lun0... > > > > > handle 15e35c10, > > > > > /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 15e361f0, > > > > > /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? > > > > > > Please try the tweak attached below. > > > (I think what I did here is trivial.) > > > > > > If you like, I will post it as a patch. > > > (See "10.3.4.5.1 USB Device Path Example".) > > > > > > -Takahiro Akashi > > > > > > > > > From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 > > > > > > 2001 > > > > > > From: AKASHI Takahiro > > > > > > Date: Thu, 25 Nov 2021 14:20:08 +0900 > > > > > > Subject: [PATCH] efi_loader: disk: usb mass-storage > > > > > > - use path_usb instead of path_usb_class for existing USB dp nodes > > > - add a dp node for UCLASS_USB > > > > > > => usb start > > > starting USB... > > > Bus xhci_pci: Register 8001040 NbrPorts 8 > > > Starting the controller > > > USB XHCI 1.00 > > > scanning bus xhci_pci for devices... 4 USB Device(s) found > > > scanning usb for storage devices... 2 Storage Device(s) found > > > => dm tree > > > Class Index Probed Driver
Re: [BUG] efi_loader: incorrect creation of device paths
On Fri, Dec 03, 2021 at 05:32:49PM +0100, Heinrich Schuchardt wrote: > On 11/25/21 06:44, AKASHI Takahiro wrote: > > Heinrich, > > > > On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: > > > 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 DriverName > > > > --- > > > > usb 0 [ + ] usb_sandbox |-- usb@1 > > > > usb_hub 0 [ + ] usb_hub | `-- hub > > > > usb_mass_s0 [ + ] usb_mass_storage | |-- > > > > usb_mass_storage > > > > blk 3 [ ] usb_storage_blk | | `-- > > > > usb_mass_storage.lun0 > > > > usb_mass_s1 [ + ] usb_mass_storage | |-- > > > > usb_mass_storage > > > > blk 4 [ ] usb_storage_blk | | `-- > > > > usb_mass_storage.lun0 > > > > usb_mass_s2 [ + ] 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 15e34f00, > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > > > > Scanning disk mmc1.blk... > > > > handle 15e36b30, > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > > > > Scanning disk mmc0.blk... > > > > handle 15e35b00, > > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > > > > Scanning disk usb_mass_storage.lun0... > > > > handle 15e35c10, > > > > /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 15e361f0, > > > > /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? > > > > Please try the tweak attached below. > > (I think what I did here is trivial.) > > > > If you like, I will post it as a patch. > > (See "10.3.4.5.1 USB Device Path Example".) > > > > -Takahiro Akashi > > > > > > > From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 > > > > > 2001 > > > > > From: AKASHI Takahiro > > > > > Date: Thu, 25 Nov 2021 14:20:08 +0900 > > > > > Subject: [PATCH] efi_loader: disk: usb mass-storage > > > > - use path_usb instead of path_usb_class for existing USB dp nodes > > - add a dp node for UCLASS_USB > > > > => usb start > > starting USB... > > Bus xhci_pci: Register 8001040 NbrPorts 8 > > Starting the controller > > USB XHCI 1.00 > > scanning bus xhci_pci for devices... 4 USB Device(s) found > > scanning usb for storage devices... 2 Storage Device(s) found > > => dm tree > > Class Index Probed DriverName > > --- > > root 0 [ + ] root_driver root_driver > > ... > > pci 0 [ + ] pci_generic_ecam |-- pcie@1000 > > pci_generi0 [ ] pci_generic_drv | |-- pci_0:0.0 > > virtio 32 [ + ] virtio-pci.l
Re: [BUG] efi_loader: incorrect creation of device paths
On 11/25/21 06:44, AKASHI Takahiro wrote: Heinrich, On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: 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 DriverName --- usb 0 [ + ] usb_sandbox |-- usb@1 usb_hub 0 [ + ] usb_hub | `-- hub usb_mass_s0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 3 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s1 [ + ] usb_mass_storage | |-- usb_mass_storage blk 4 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s2 [ + ] 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 15e34f00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) Scanning disk mmc1.blk... handle 15e36b30, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) Scanning disk mmc0.blk... handle 15e35b00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) Scanning disk usb_mass_storage.lun0... handle 15e35c10, /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 15e361f0, /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? Please try the tweak attached below. (I think what I did here is trivial.) If you like, I will post it as a patch. (See "10.3.4.5.1 USB Device Path Example".) -Takahiro Akashi From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Thu, 25 Nov 2021 14:20:08 +0900 Subject: [PATCH] efi_loader: disk: usb mass-storage - use path_usb instead of path_usb_class for existing USB dp nodes - add a dp node for UCLASS_USB => usb start starting USB... Bus xhci_pci: Register 8001040 NbrPorts 8 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 4 USB Device(s) found scanning usb for storage devices... 2 Storage Device(s) found => dm tree Class Index Probed DriverName --- root 0 [ + ] root_driver root_driver ... pci 0 [ + ] pci_generic_ecam |-- pcie@1000 pci_generi0 [ ] pci_generic_drv | |-- pci_0:0.0 virtio 32 [ + ] virtio-pci.l | |-- virtio-pci.l#0 ethernet 0 [ + ] virtio-net| | `-- virtio-net#32 usb 0 [ + ] xhci_pci | `-- xhci_pci usb_hub 0 [ + ] usb_hub | `-- usb_hub usb_dev_ge0 [ + ] usb_dev_generic_drv | |-- generic_bus_0_dev_2 usb_mass_s0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 0 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s1 [ + ] usb_mass_storage | `-- usb_mass_storage blk 1 [ ] usb_storage_blk | `-- usb_mass_storage.lun0 ... => efidebug devices Scanning disk usb_mass_storage.lun0... Scanning disk usb_mass_storage.lun0... Found 6 disks Missing RNG device for EFI_RNG_PROTOCOL ** Unable
Re: [BUG] efi_loader: incorrect creation of device paths
Heinrich, On Thu, Nov 25, 2021 at 02:44:28PM +0900, AKASHI Takahiro wrote: > Heinrich, > > On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: > > 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 DriverName > > > --- > > > usb 0 [ + ] usb_sandbox |-- usb@1 > > > usb_hub 0 [ + ] usb_hub | `-- hub > > > usb_mass_s0 [ + ] usb_mass_storage | |-- > > > usb_mass_storage > > > blk 3 [ ] usb_storage_blk | | `-- > > > usb_mass_storage.lun0 > > > usb_mass_s1 [ + ] usb_mass_storage | |-- > > > usb_mass_storage > > > blk 4 [ ] usb_storage_blk | | `-- > > > usb_mass_storage.lun0 > > > usb_mass_s2 [ + ] 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 15e34f00, > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > > > Scanning disk mmc1.blk... > > > handle 15e36b30, > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > > > Scanning disk mmc0.blk... > > > handle 15e35b00, > > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > > > Scanning disk usb_mass_storage.lun0... > > > handle 15e35c10, > > > /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 15e361f0, > > > /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? > > Please try the tweak attached below. > (I think what I did here is trivial.) > > If you like, I will post it as a patch. > (See "10.3.4.5.1 USB Device Path Example".) Any comment on my proposal? > -Takahiro Akashi > > >>> From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 2001 > >>> From: AKASHI Takahiro > >>> Date: Thu, 25 Nov 2021 14:20:08 +0900 > >>> Subject: [PATCH] efi_loader: disk: usb mass-storage > > - use path_usb instead of path_usb_class for existing USB dp nodes > - add a dp node for UCLASS_USB > > => usb start > starting USB... > Bus xhci_pci: Register 8001040 NbrPorts 8 > Starting the controller > USB XHCI 1.00 > scanning bus xhci_pci for devices... 4 USB Device(s) found >scanning usb for storage devices... 2 Storage Device(s) found > => dm tree > Class Index Probed DriverName > --- > root 0 [ + ] root_driver root_driver > ... > pci 0 [ + ] pci_generic_ecam |-- pcie@1000 > pci_generi0 [ ] pci_generic_drv | |-- pci_0:0.0 > virtio 32 [ + ] virtio-pci.l | |-- virtio-pci.l#0 > ethernet 0 [ + ] virtio-net| | `-- virtio-net#32 > usb 0 [ + ] xhci_pci | `-- xhci_pci > usb_hub 0 [ + ] usb_hub | `-- usb_hub > usb_dev_ge0 [ + ]
Re: [BUG] efi_loader: incorrect creation of device paths
Heinrich, On Wed, Nov 24, 2021 at 12:10:32PM +0900, AKASHI Takahiro wrote: > 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 DriverName > > --- > > usb 0 [ + ] usb_sandbox |-- usb@1 > > usb_hub 0 [ + ] usb_hub | `-- hub > > usb_mass_s0 [ + ] usb_mass_storage | |-- > > usb_mass_storage > > blk 3 [ ] usb_storage_blk | | `-- > > usb_mass_storage.lun0 > > usb_mass_s1 [ + ] usb_mass_storage | |-- > > usb_mass_storage > > blk 4 [ ] usb_storage_blk | | `-- > > usb_mass_storage.lun0 > > usb_mass_s2 [ + ] 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 15e34f00, > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > > Scanning disk mmc1.blk... > > handle 15e36b30, > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > > Scanning disk mmc0.blk... > > handle 15e35b00, > > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > > Scanning disk usb_mass_storage.lun0... > > handle 15e35c10, > > /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 15e361f0, > > /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? Please try the tweak attached below. (I think what I did here is trivial.) If you like, I will post it as a patch. (See "10.3.4.5.1 USB Device Path Example".) -Takahiro Akashi >>> From cda91e9d8144f89f0d73738b338289a7940bbe0e Mon Sep 17 00:00:00 2001 >>> From: AKASHI Takahiro >>> Date: Thu, 25 Nov 2021 14:20:08 +0900 >>> Subject: [PATCH] efi_loader: disk: usb mass-storage - use path_usb instead of path_usb_class for existing USB dp nodes - add a dp node for UCLASS_USB => usb start starting USB... Bus xhci_pci: Register 8001040 NbrPorts 8 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 4 USB Device(s) found scanning usb for storage devices... 2 Storage Device(s) found => dm tree Class Index Probed DriverName --- root 0 [ + ] root_driver root_driver ... pci 0 [ + ] pci_generic_ecam |-- pcie@1000 pci_generi0 [ ] pci_generic_drv | |-- pci_0:0.0 virtio 32 [ + ] virtio-pci.l | |-- virtio-pci.l#0 ethernet 0 [ + ] virtio-net| | `-- virtio-net#32 usb 0 [ + ] xhci_pci | `-- xhci_pci usb_hub 0 [ + ] usb_hub | `-- usb_hub usb_dev_ge0 [ + ] usb_dev_generic_drv | |-- generic_bus_0_dev_2 usb_mass_s0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 0 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s1 [ + ] usb_mass_storage | `-- usb_mass_storage blk 1 [ ]
Re: [BUG] efi_loader: incorrect creation of device paths
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 DriverName > --- > usb 0 [ + ] usb_sandbox |-- usb@1 > usb_hub 0 [ + ] usb_hub | `-- hub > usb_mass_s0 [ + ] usb_mass_storage | |-- > usb_mass_storage > blk 3 [ ] usb_storage_blk | | `-- > usb_mass_storage.lun0 > usb_mass_s1 [ + ] usb_mass_storage | |-- > usb_mass_storage > blk 4 [ ] usb_storage_blk | | `-- > usb_mass_storage.lun0 > usb_mass_s2 [ + ] 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 15e34f00, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) > Scanning disk mmc1.blk... > handle 15e36b30, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) > Scanning disk mmc0.blk... > handle 15e35b00, > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) > Scanning disk usb_mass_storage.lun0... > handle 15e35c10, > /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 15e361f0, > /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
[BUG] efi_loader: incorrect creation of device paths
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 DriverName --- usb 0 [ + ] usb_sandbox |-- usb@1 usb_hub 0 [ + ] usb_hub | `-- hub usb_mass_s0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 3 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s1 [ + ] usb_mass_storage | |-- usb_mass_storage blk 4 [ ] usb_storage_blk | | `-- usb_mass_storage.lun0 usb_mass_s2 [ + ] 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 15e34f00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0) Scanning disk mmc1.blk... handle 15e36b30, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1) Scanning disk mmc0.blk... handle 15e35b00, /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2) Scanning disk usb_mass_storage.lun0... handle 15e35c10, /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 15e361f0, /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. 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