[PATCH v5 00/12] efi_loader: more tightly integrate UEFI disks to driver model

Mark Kettenis mark.kettenis at xs4all.nl
Thu Apr 28 11:09:33 CEST 2022


> Date: Thu, 28 Apr 2022 08:45:51 +0200
> Content-Language: en-US
> From: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: masami.hiramatsu at linaro.org, u-boot at lists.denx.de, sjg at chromium.org,
>  ilias.apalodimas at linaro.org, Tom Rini <trini at konsulko.com>,
>  Mark Kettenis <mark.kettenis at xs4all.nl>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> On 4/28/22 06:52, AKASHI Takahiro wrote:
> > On Wed, Apr 27, 2022 at 12:26:09PM +0900, AKASHI Takahiro wrote:
> >> Heinrich,
> >>
> >> On Tue, Apr 26, 2022 at 07:02:46PM +0200, Heinrich Schuchardt wrote:
> >>> On 4/26/22 16:44, AKASHI Takahiro wrote:
> >>>> On Tue, Apr 26, 2022 at 03:57:26PM +0200, Heinrich Schuchardt wrote:
> >>>>> On 4/26/22 01:44, AKASHI Takahiro wrote:
> >>>>> I expect that boards that booted with previous versions of U-Boot using
> >>>>> the respective defconfig still boot. But they don't. Here is one example
> >>>>> (orangepi_pc_defconfig):
> >>>>>
> >>>>>      Found U-Boot script /boot.scr.uimg
> >>>>>      189 bytes read in 2 ms (91.8 KiB/s)
> >>>>>      ## Executing script at 43100000
> >>>>>      22979 bytes read in 8 ms (2.7 MiB/s)
> >>>>>      98304 bytes read in 8 ms (11.7 MiB/s)
> >>>>>      Booting /EFI\debian\grubarm.efi
> >>>>>      Welcome to GRUB!
> >>>>>
> >>>>>      error: disk `,msdos2' not found.
> >>>>>      grub rescue>
> >>>>>
> >>>>> In U-Boot v2022.04 function efi_disk_register() ensured that all block
> >>>>> devices and their partitions were added as EFI handles.
> >>>> Not the all block devices, but the block devices which have already
> >>>> enumerated when efi_init_obj_list() is called.
> >>>>
> >>>>> But that
> >>>>> function is missing now.
> >>>> What (boot) device are you using here?
> >>>>
> >>>> Please show me the values of env variables, particularly, "boot_targets".
> >>>>
> >>>> Please show me the content of boot.scr.uimg, too.
> >>>>
> >>>> Please show me the output from
> >>>> => dm tree
> >>>> => efidebug devices
> >>>> for 2022.04 and 2022.07-rc1.
> >>>>
> >>>> -Takahiro Akashi
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> I am booting from mmc. Boot.scr just loads the device-tree from mmc-
> >>>
> >>> mmcblk0     179:0    0 29.8G  0 disk
> >>> ├─mmcblk0p1 179:1    0    1G  0 part /boot/efi
> >>> ├─mmcblk0p2 179:2    0    1G  0 part /boot
> >>> └─mmcblk0p3 179:3    0 27.8G  0 part /
> >>
> >> Okay.
> >>
> >>>
> >>> U-Boot 2022.04 (Apr 26 2022 - 16:02:27 +0000) Allwinner Technology
> >>> ------------------------------------------------------------------
> >>>
> >>> grub> ls
> >>> (hd0) (hd0,msdos1) (hd1) (hd1,msdos3) (hd1,msdos2) (hd1,msdos1)
> >>>
> >>> hd0 is a USB stick
> >>> hd1 is the SD card
> >>>
> >>> boot.scr
> >>> --------
> >>>
> >>> #
> >>> # flash-kernel: bootscr.sunxi
> >>> #
> >>>
> >>> # boot script for Allwinner SunXi-based devices
> >>>
> >>> # Mainline u-boot v2014.10 introduces a new default environment and
> >>> # a new common bootcmd handling for all platforms, which is not fully
> >>> # compatible with the old-style environment used by u-boot-sunxi.
> >>> # This script therefore needs to check in which environment it
> >>> # is running and set some variables accordingly.
> >>>
> >>> # On u-boot-sunxi, this script assumes that ${device} and ${partition}
> >>> # are set.
> >>>
> >>> # The new-style environment predefines ${boot_targets}, the old-style
> >>> # environment does not.
> >>> if test -n "${boot_targets}"
> >>> then
> >>>    echo "Mainline u-boot / new-style environment detected."
> >>>    # Mainline u-boot v2014.10 uses ${devtype}, ${devnum} and
> >>>    # ${bootpart} where u-boot-sunxi uses ${device} and ${partition}.
> >>>    # ${distro_bootpart} replaced ${bootpart} in u-boot v2016.01.
> >>>    if test -z "${device}"; then setenv device "${devtype}"; fi
> >>>    if test -z "${partition}${distro_bootpart}"; then setenv partition
> >>> "${devnum}:${bootpart}"; fi
> >>>    if test -z "${partition}"; then setenv partition
> >>> "${devnum}:${distro_bootpart}"; fi
> >>> else
> >>>    echo "U-boot-sunxi / old-style environment detected."
> >>>    # U-boot-sunxi does not predefine kernel_addr_r, fdt_addr_r and
> >>>    # ramdisk_addr_r, so they have to be manually set. Use the values
> >>>    # from mainline u-boot v2014.10, except for ramdisk_addr_r,
> >>>    # which is set to 0x44300000 to allow for initrds larger than
> >>>    # 13MB on u-boot-sunxi.
> >>>    setenv kernel_addr_r 0x42000000
> >>>    setenv fdt_addr_r 0x43000000
> >>>    setenv ramdisk_addr_r 0x44300000
> >>> fi
> >>>
> >>> if test -n "${console}"; then
> >>>    setenv bootargs "${bootargs} console=${console}"
> >>> fi
> >>>
> >>> setenv bootargs  ${bootargs} quiet
> >>>
> >>>
> >>> if test -z "${image_locations}"; then
> >>>     setenv image_locations ${prefix}
> >>> fi
> >>> if test -z "${image_locations}"; then
> >>>     setenv image_locations /boot/ /
> >>> fi
> >>>
> >>> if test -z "${fk_kvers}"; then
> >>>     setenv fk_kvers '5.16.0-4-armmp-lpae'
> >>> fi
> >>>
> >>> if test -n "${fdtfile}"; then
> >>>     setenv fdtpath dtbs/${fk_kvers}/${fdtfile}
> >>> else
> >>>     setenv fdtpath dtb-${fk_kvers}
> >>> fi
> >>>
> >>> for pathprefix in ${image_locations}
> >>> do
> >>>    if test -e ${device} ${partition} ${pathprefix}vmlinuz-${fk_kvers}
> >>>    then
> >>>      load ${device} ${partition} ${kernel_addr_r}
> >>> ${pathprefix}vmlinuz-${fk_kvers} \
> >>>      && load ${device} ${partition} ${fdt_addr_r} ${pathprefix}${fdtpath} \
> >>>      && load ${device} ${partition} ${ramdisk_addr_r}
> >>> ${pathprefix}initrd.img-${fk_kvers} \
> >>>      && echo "Booting Debian ${fk_kvers} from ${device} ${partition}..." \
> >>>      && bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
> >>>    fi
> >>> done
> >>
> >> Nothing special done here.
> >>
> >>>
> >>> U-Boot 2022.04 (Apr 26 2022 - 16:02:27 +0000) Allwinner Technology
> >>>
> >>> => echo $boot_targets
> >>> fel mmc0 usb0 pxe dhcp
> >>>
> >>> => dm tree
> >>>   Class     Index  Probed  Driver                Name
> >>> -----------------------------------------------------------
> >>>   root          0  [ + ]   root_driver           root_driver
> >>>   video         0  [   ]   sunxi_de2             |-- sunxi_de2
> >>>   display       0  [   ]   sunxi_dw_hdmi         |-- sunxi_dw_hdmi
> >>>   simple_bus    0  [ + ]   simple_bus            |-- soc
> >>>   mmc           0  [ + ]   sunxi_mmc             |   |-- mmc at 1c0f000
> >>>   blk           0  [ + ]   mmc_blk               |   |   `-- mmc at 1c0f000.blk
> >>>   phy           0  [ + ]   sun4i_usb_phy         |   |-- phy at 1c19400
> >>>   usb           0  [ + ]   ehci_generic          |   |-- usb at 1c1a000
> >>>   usb_hub       0  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           1  [ + ]   ohci_generic          |   |-- usb at 1c1a400
> >>>   usb_hub       1  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           2  [ + ]   ehci_generic          |   |-- usb at 1c1b000
> >>>   usb_hub       2  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           3  [ + ]   ohci_generic          |   |-- usb at 1c1b400
> >>>   usb_hub       3  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           4  [ + ]   ehci_generic          |   |-- usb at 1c1c000
> >>>   usb_hub       4  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb_mass_s    0  [ + ]   usb_mass_storage      |   |       `--
> >>> usb_mass_storage
> >>>   blk           1  [   ]   usb_storage_blk       |   |           `--
> >>> usb_mass_storage.lun0
> >>>   usb           5  [ + ]   ohci_generic          |   |-- usb at 1c1c400
> >>>   usb_hub       5  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           6  [ + ]   ehci_generic          |   |-- usb at 1c1d000
> >>>   usb_hub       6  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           7  [ + ]   ohci_generic          |   |-- usb at 1c1d400
> >>>   usb_hub       7  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   clk           0  [ + ]   sun8i_h3_ccu          |   |-- clock at 1c20000
> >>>   reset         0  [ + ]   sunxi_reset           |   |   `-- reset
> >>>   gpio          0  [ + ]   gpio_sunxi            |   |-- pinctrl at 1c20800
> >>>   gpio          1  [ + ]   gpio_sunxi            |   |   |-- PA
> >>>   gpio          2  [ + ]   gpio_sunxi            |   |   |-- PB
> >>>   gpio          3  [ + ]   gpio_sunxi            |   |   |-- PC
> >>>   gpio          4  [ + ]   gpio_sunxi            |   |   |-- PD
> >>>   gpio          5  [ + ]   gpio_sunxi            |   |   |-- PE
> >>>   gpio          6  [ + ]   gpio_sunxi            |   |   |-- PF
> >>>   gpio          7  [ + ]   gpio_sunxi            |   |   |-- PG
> >>>   gpio          8  [ + ]   gpio_sunxi            |   |   |-- PH
> >>>   gpio          9  [ + ]   gpio_sunxi            |   |   `-- PI
> >>>   ethernet      0  [ + ]   eth_sun8i_emac        |   |-- ethernet at 1c30000
> >>>   watchdog      0  [ + ]   sunxi_wdt             |   |-- watchdog at 1c20ca0
> >>>   sysreset      0  [   ]   wdt_reboot            |   |   `-- watchdog at 1c20ca0
> >>>   serial        0  [ + ]   ns16550_serial        |   |-- serial at 1c28000
> >>>   clk           1  [ + ]   clk_sun6i_rtc         |   |-- rtc at 1f00000
> >>>   clk           2  [   ]   sun6i_a31_r_ccu       |   |-- clock at 1f01400
> >>>   reset         1  [   ]   sunxi_reset           |   |   `-- reset
> >>>   i2c           0  [   ]   i2c_mvtwsi            |   |-- i2c at 1f02400
> >>>   gpio         10  [ + ]   gpio_sunxi            |   `-- pinctrl at 1f02c00
> >>>   gpio         11  [ + ]   gpio_sunxi            |       `-- PL
> >>>   clk           3  [ + ]   fixed_clock           |-- osc24M_clk
> >>>   clk           4  [   ]   fixed_clock           `-- osc32k_clk
> >>>
> >>>
> >>>
> >>> U-Boot 2022.07-rc1 (Apr 26 2022 - 07:00:52 +0000) Allwinner Technology
> >>>
> >>> => echo $boot_targets
> >>> fel mmc0 usb0 pxe dhcp
> >>>
> >>> => dm tree
> >>>   Class     Index  Probed  Driver                Name
> >>> -----------------------------------------------------------
> >>>   root          0  [ + ]   root_driver           root_driver
> >>>   video         0  [   ]   sunxi_de2             |-- sunxi_de2
> >>>   display       0  [   ]   sunxi_dw_hdmi         |-- sunxi_dw_hdmi
> >>>   simple_bus    0  [ + ]   simple_bus            |-- soc
> >>>   mmc           0  [ + ]   sunxi_mmc             |   |-- mmc at 1c0f000
> >>>   blk           0  [ + ]   mmc_blk               |   |   |-- mmc at 1c0f000.blk
> >>
> >> A block device detected here.
> >>
> >>>   partition     0  [ + ]   blk_partition         |   |   |   |--
> >>> mmc at 1c0f000.blk:1
> >>>   partition     1  [ + ]   blk_partition         |   |   |   |--
> >>> mmc at 1c0f000.blk:2
> >>>   partition     2  [ + ]   blk_partition         |   |   |   `--
> >>> mmc at 1c0f000.blk:3
> >>
> >> Apparently, there are three partition devices,
> >> then we should definitely have corresponding efi_disk objects
> >> as an efi_loader hook is registered against *POST_PROBE* event
> >> (of a *block* device).
> >>
> >> In my patch c822c1a50bd7 ("mmc: call device_probe() after scanning"),
> >> device_probe() has already been installed to mmc_blk_probe().
> >>
> >> Thinking of those circumstances, the natural guess is a *probe* function
> >> for "mmc at 1c0f000.blk" device has never been called in your use case
> >> (even when loading an image from a specific partition, /boot/efi?).
> >>
> >> To confirm this, you may simply try the followings:
> >> => mmc list
> >>     ...
> >> => mmc dev 0 (<- the device number from 'mmc list')
> >> => efi devices
> >>
> >> Then you will find three more efi_disk objects now that the parent
> >> block device is *probed*.
> >>
> >>>   bootdev       0  [   ]   mmc_bootdev           |   |   `--
> >>> mmc at 1c0f000.bootdev
> >>>   phy           0  [ + ]   sun4i_usb_phy         |   |-- phy at 1c19400
> >>>   usb           0  [ + ]   ehci_generic          |   |-- usb at 1c1a000
> >>>   usb_hub       0  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           1  [ + ]   ohci_generic          |   |-- usb at 1c1a400
> >>>   usb_hub       1  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           2  [ + ]   ehci_generic          |   |-- usb at 1c1b000
> >>>   usb_hub       2  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           3  [ + ]   ohci_generic          |   |-- usb at 1c1b400
> >>>   usb_hub       3  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           4  [ + ]   ehci_generic          |   |-- usb at 1c1c000
> >>>   usb_hub       4  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb_mass_s    0  [ + ]   usb_mass_storage      |   |       `--
> >>> usb_mass_storage
> >>>   blk           1  [ + ]   usb_storage_blk       |   |           |--
> >>> usb_mass_storage.lun0
> >>>   partition     3  [ + ]   blk_partition         |   |           |   `--
> >>> usb_mass_storage.lun0:1
> >>>   bootdev       3  [   ]   usb_bootdev           |   |           `--
> >>> usb_mass_storage.lun0.bootdev
> >>>   usb           5  [ + ]   ohci_generic          |   |-- usb at 1c1c400
> >>>   usb_hub       5  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           6  [ + ]   ehci_generic          |   |-- usb at 1c1d000
> >>>   usb_hub       6  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   usb           7  [ + ]   ohci_generic          |   |-- usb at 1c1d400
> >>>   usb_hub       7  [ + ]   usb_hub               |   |   `-- usb_hub
> >>>   clk           0  [ + ]   sun8i_h3_ccu          |   |-- clock at 1c20000
> >>>   reset         0  [ + ]   sunxi_reset           |   |   `-- reset
> >>>   pinctrl       0  [ + ]   sunxi-pinctrl         |   |-- pinctrl at 1c20800
> >>>   gpio          0  [ + ]   gpio_sunxi            |   |   |-- pinctrl at 1c20800
> >>>   gpio          1  [ + ]   gpio_sunxi            |   |   |   |-- PA
> >>>   gpio          2  [ + ]   gpio_sunxi            |   |   |   |-- PB
> >>>   gpio          3  [ + ]   gpio_sunxi            |   |   |   |-- PC
> >>>   gpio          4  [ + ]   gpio_sunxi            |   |   |   |-- PD
> >>>   gpio          5  [ + ]   gpio_sunxi            |   |   |   |-- PE
> >>>   gpio          6  [ + ]   gpio_sunxi            |   |   |   |-- PF
> >>>   gpio          7  [ + ]   gpio_sunxi            |   |   |   `-- PG
> >>>   pinconfig     0  [   ]   pinconfig             |   |   |-- csi-pins
> >>>   pinconfig     1  [   ]   pinconfig             |   |   |-- emac-rgmii-pins
> >>>   pinconfig     2  [   ]   pinconfig             |   |   |-- i2c0-pins
> >>>   pinconfig     3  [   ]   pinconfig             |   |   |-- i2c1-pins
> >>>   pinconfig     4  [   ]   pinconfig             |   |   |-- i2c2-pins
> >>>   pinconfig     5  [ + ]   pinconfig             |   |   |-- mmc0-pins
> >>>   pinconfig     6  [   ]   pinconfig             |   |   |-- mmc1-pins
> >>>   pinconfig     7  [   ]   pinconfig             |   |   |-- mmc2-8bit-pins
> >>>   pinconfig     8  [   ]   pinconfig             |   |   |-- spdif-tx-pin
> >>>   pinconfig     9  [   ]   pinconfig             |   |   |-- spi0-pins
> >>>   pinconfig    10  [   ]   pinconfig             |   |   |-- spi1-pins
> >>>   pinconfig    11  [ + ]   pinconfig             |   |   |-- uart0-pa-pins
> >>>   pinconfig    12  [   ]   pinconfig             |   |   |-- uart1-pins
> >>>   pinconfig    13  [   ]   pinconfig             |   |   |--
> >>> uart1-rts-cts-pins
> >>>   pinconfig    14  [   ]   pinconfig             |   |   |-- uart2-pins
> >>>   pinconfig    15  [   ]   pinconfig             |   |   |--
> >>> uart2-rts-cts-pins
> >>>   pinconfig    16  [   ]   pinconfig             |   |   |-- uart3-pins
> >>>   pinconfig    17  [   ]   pinconfig             |   |   |--
> >>> uart3-rts-cts-pins
> >>>   pinconfig    18  [   ]   pinconfig             |   |   |-- ahci_pwr_pin at 0
> >>>   pinconfig    19  [   ]   pinconfig             |   |   |-- usb0_vbus_pin at 0
> >>>   pinconfig    20  [   ]   pinconfig             |   |   |-- usb1_vbus_pin at 0
> >>>   pinconfig    21  [   ]   pinconfig             |   |   `-- usb2_vbus_pin at 0
> >>>   ethernet      0  [ + ]   eth_sun8i_emac        |   |-- ethernet at 1c30000
> >>>   bootdev       1  [   ]   eth_bootdev           |   |   `--
> >>> ethernet at 1c30000.bootdev
> >>>   watchdog      0  [ + ]   sunxi_wdt             |   |-- watchdog at 1c20ca0
> >>>   sysreset      0  [   ]   wdt_reboot            |   |   `-- watchdog at 1c20ca0
> >>>   serial        0  [ + ]   ns16550_serial        |   |-- serial at 1c28000
> >>>   clk           1  [ + ]   clk_sun6i_rtc         |   |-- rtc at 1f00000
> >>>   clk           2  [ + ]   sun6i_a31_r_ccu       |   |-- clock at 1f01400
> >>>   reset         1  [   ]   sunxi_reset           |   |   `-- reset
> >>>   i2c           0  [   ]   i2c_mvtwsi            |   |-- i2c at 1f02400
> >>>   pinctrl       1  [ + ]   sunxi-pinctrl         |   `-- pinctrl at 1f02c00
> >>>   gpio          8  [ + ]   gpio_sunxi            |       |-- pinctrl at 1f02c00
> >>>   gpio          9  [ + ]   gpio_sunxi            |       |   `-- PL
> >>>   pinconfig    22  [   ]   pinconfig             |       |-- r-ir-rx-pin
> >>>   pinconfig    23  [   ]   pinconfig             |       |-- r-i2c-pins
> >>>   pinconfig    24  [   ]   pinconfig             |       `-- r-pwm-pin
> >>>   clk           3  [ + ]   fixed_clock           |-- osc24M_clk
> >>>   clk           4  [   ]   fixed_clock           |-- osc32k_clk
> >>>   bootstd       0  [   ]   bootstd_drv           `-- bootstd
> >>>   bootmeth      0  [   ]   bootmeth_distro           |-- distro
> >>>   bootmeth      1  [   ]   bootmeth_efi              |-- efi
> >>>   bootmeth      2  [   ]   bootmeth_pxe              |-- pxe
> >>>   bootdev       2  [   ]   system_bootdev            `-- system-bootdev
> >>>
> >>> grub rescue> ls
> >>> (hd0)
> >>>
> >>> Grub does not see any partition at all.
> >>>
> >>> Loading a device from a partition does not create a handle for the device:
> >>
> >> Actually, loading an image does *not* invoke a probe function at all
> >> under the current implementation (of either "part" command,
> >> scan_dev_for_boot_part or even mmc drivers?).
> 
> We call efi_disk_init() after the MMC device is probed. Therefore
> probing of the MCC device does not trigger EVT_DM_POST_PROBE.
> 
> We have to move the efi_disk_init() call before initr_dm().
> 
> [PATCH 1/1] efi_loader: call efi_init_early() earlier
> https://lists.denx.de/pipermail/u-boot/2022-April/482701.html
> 
> With the patch GRUB now sees the MMC device but it is still not seeing
> the partitions:
> 
> grub rescue> ls
> (hd0) (hd1)
> 
> This is strange because devices and protocols look rather normal now:

Do you have the fix for the raw disk support in your tree?  I suspect
that GRUB needs that to read the partition table.

> => dm tree
>   Class     Index  Probed  Driver                Name
> -----------------------------------------------------------
>   root          0  [ + ]   root_driver           root_driver
>   simple_bus    0  [ + ]   simple_bus            |-- soc
>   mmc           0  [ + ]   sunxi_mmc             |   |-- mmc at 1c0f000
>   blk           0  [ + ]   mmc_blk               |   |   |-- mmc at 1c0f000.blk
>   partition     0  [ + ]   blk_partition         |   |   |   |--
> mmc at 1c0f000.blk:1
>   partition     1  [ + ]   blk_partition         |   |   |   |--
> mmc at 1c0f000.blk:2
>   partition     2  [ + ]   blk_partition         |   |   |   `--
> mmc at 1c0f000.blk:3
>   usb           4  [ + ]   ehci_generic          |   |-- usb at 1c1c000
>   usb_hub       4  [ + ]   usb_hub               |   |   `-- usb_hub
>   usb_mass_s    0  [ + ]   usb_mass_storage      |   |       `--
> usb_mass_storage
>   blk           1  [ + ]   usb_storage_blk       |   |           |--
> usb_mass_storage.lun0
>   partition     3  [ + ]   blk_partition         |   |           |   `--
> usb_mass_storage.lun0:1
>   bootdev       3  [   ]   usb_bootdev           |   |           `--
> usb_mass_storage.lun0.bootdev
> 
> => efidebug devices
> Device   Device Path
> ======== ====================
> 79f701e8 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
> 7dffc7ec /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
> 79f70cd8 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)
> 79f70de0
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,MBR,0xb6b4facb,0x800,0x200000)
> 79f711b0
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,MBR,0xb6b4facb,0x200800,0x200000)
> 79f71538
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(3,MBR,0xb6b4facb,0x400800,0x379f800)
> 79f811b8
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)
> 79f81260
> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)/HD(1,MBR,0x0c449046,0x800,0x800)
> 79fdd748 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(0281431d5371,1)
> 
> => efidebug dh
> Handle   Protocols
> ======== ====================
> 79f701e8 Device Path, Device Path To Text, Device Path Utilities,
> Device-Tree Fixup, Unicode Collation 2, HII String, HII Database, Simple
> Text Output, Simple Text Input, Simple Text Input Ex
> 7dffc7ec Device Path
> 79f70cd8 Device Path, Block IO
> 79f70de0 Device Path, Block IO, System Partition, Simple File System
> 79f711b0 Device Path, Block IO, Simple File System
> 79f71538 Device Path, Block IO, Simple File System
> 79f811b8 Device Path, Block IO
> 79f81260 Device Path, Block IO, System Partition, Simple File System
> 79f84978 Driver Binding
> 79fdd748 Simple Network, Device Path, PXE Base Code
> 
> This is the console log *before* the patch:
> 
> U-Boot 2022.07-rc1-00082-g8b2b125e95-dirty (Apr 28 2022 - 06:01:10
> +0000) Allwinner Technology
> 
> CPU:   Allwinner H3 (SUN8I 1680)
> Model: Xunlong Orange Pi PC
> DRAM:  1 GiB
> drivers/mmc/sunxi_mmc.c(723)sunxi_mmc_bind:
> sunxi_set_gate: (CLK#54) unhandled
> Core:  70 devices, 20 uclasses, devicetree: separate
> WDT:   Not starting watchdog at 1c20ca0
> MMC:   drivers/mmc/sunxi_mmc.c(667)sunxi_mmc_probe:
> mmc at 1c0f000: 0
> Loading Environment from FAT... drivers/mmc/mmc-uclass.c(487)mmc_blk_probe:
> drivers/block/blk-uclass.c(746)blk_post_probe:
> drivers/block/blk-uclass.c(752)blk_post_probe:
> disk/part.c(242)part_init:
> part_init: try 'EFI': ret=-1
> part_init: try 'DOS': ret=0
> part_create_block_devices: 3 partitions found in mmc at 1c0f000.blk
> disk/part.c(242)part_init:
> part_init: try 'EFI': ret=-1
> part_init: try 'DOS': ret=0
> Unable to read "uboot.env" from mmc0:1...
> In:    serial
> Out:   serial
> Err:   serial
> Net:   phy interface1
> eth0: ethernet at 1c30000
> lib/efi_loader/efi_disk.c(739)efi_disk_init:
> starting USB...
> Bus usb at 1c1a000: USB EHCI 1.00
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1a400: USB OHCI 1.0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1b000: lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> sunxi_set_gate: (CLK#9) unhandled
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> USB EHCI 1.00
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1b400: USB OHCI 1.0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1c000: USB EHCI 1.00
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1c400: USB OHCI 1.0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1d000: USB EHCI 1.00
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> Bus usb at 1c1d400: USB OHCI 1.0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> scanning bus usb at 1c1a000 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1a400 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1b000 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1b400 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1c000 for devices...
> drivers/block/blk-uclass.c(746)blk_post_probe:
> drivers/block/blk-uclass.c(752)blk_post_probe:
> disk/part.c(242)part_init:
> part_init: try 'EFI': ret=-1
> part_init: try 'DOS': ret=0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> part_create_block_devices: 1 partitions found in usb_mass_storage.lun0
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(568)efi_disk_create_part:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 2 USB Device(s) found
> scanning bus usb at 1c1c400 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1d000 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
> scanning bus usb at 1c1d400 for devices...
> lib/efi_loader/efi_disk.c(622)efi_disk_probe:
> 1 USB Device(s) found
>         scanning usb for storage devices... 1 Storage Device(s) found
> Hit any key to stop autoboot:  0
> 
> Best regards
> 
> Heinrich
> 
> >>
> >> I think that this is weird as the purpose of "probe" is to activate
> >> the device, or "probe - make a device ready for use" according to
> >>      doc/develop/driver-model/design.rst
> >>
> >> So my conclusion is that the current implementation has already broken
> >> the driver model even before my patch was applied.
> >>          -> Simon, you should have a comment here?
> >>
> >> That said, fixing a problem is a different matter.
> >> Probably, we will have to modify "part" command or mmc drivers themselves.
> >
> > Can you figure out an easy way to reproduce the issue?
> > (either on sandbox or qemu-arm)
> > Otherwise, it is difficult for me to investigate it.
> >
> > -Takahiro Akashi
> >
> >
> >> -Takahiro Akashi
> >>
> >>> => efidebug devices
> >>> ** Unable to read file ubootefi.var **
> >>> Failed to load EFI variables
> >>> Device   Device Path
> >>> ======== ====================
> >>> 79f80f08 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
> >>> 7dffc7ec /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
> >>> 79f7f1f8
> >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)
> >>> 79f7f2a0
> >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)/HD(1,MBR,0x0c449046,0x800,0x800)
> >>> 79fdc188 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(0281431d5371,1)
> >>> => bootefi $kernel_addr_r
> >>> Booting /helloworld.efi
> >>> invalid image type: 0
> >>> Hello, world!
> >>> => efidebug devices
> >>> Device   Device Path
> >>> ======== ====================
> >>> 79f80f08 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
> >>> 7dffc7ec /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
> >>> 79f7f1f8
> >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)
> >>> 79f7f2a0
> >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)/HD(1,MBR,0x0c449046,0x800,0x800)
> >>> 79fdc188 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(0281431d5371,1)
> >>> =>
> >>>
> >>> So the current state is a complete mess.
> >>>
> >>> Best regards
> >>>
> >>> Heinrich
> 
> 


More information about the U-Boot mailing list