public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/3] efi_loader: enumerate disk devices every time
Date: Fri, 11 Jan 2019 13:51:35 +0900	[thread overview]
Message-ID: <20190111045133.GI20286@linaro.org> (raw)
In-Reply-To: <CAPnjgZ3=22+AsK5atquOtW98jDYg-uVHFVJuqr-ZFNG6tbL0mg@mail.gmail.com>

On Thu, Jan 10, 2019 at 05:57:11AM -0700, Simon Glass wrote:
> Hi,
> 
> On Wed, 9 Jan 2019 at 02:06, Alexander Graf <agraf@suse.de> wrote:
> >
> >
> >
> > On 13.12.18 08:58, AKASHI Takahiro wrote:
> > > Heinrich,
> > >
> > > On Tue, Dec 11, 2018 at 08:55:41PM +0100, Heinrich Schuchardt wrote:
> > >> On 11/15/18 5:58 AM, AKASHI Takahiro wrote:
> > >>> Currently, efi_init_obj_list() scan disk devices only once, and never
> > >>> change a list of efi disk devices. This will possibly result in failing
> > >>> to find a removable storage which may be added later on. See [1].
> > >>>
> > >>> In this patch, called is efi_disk_update() which is responsible for
> > >>> re-scanning UCLASS_BLK devices and removing/adding efi disks if necessary.
> > >>>
> > >>> For example,
> > >>>
> > >>> => efishell devices
> > >>> Scanning disk pci_mmc.blk...
> > >>> Found 3 disks
> > >>> Device Name
> > >>> ============================================
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,MBR,0x086246ba,0x40800,0x3f800)
> > >>> => usb start
> > >>> starting USB...
> > >>> USB0:   USB EHCI 1.00
> > >>> scanning bus 0 for devices... 3 USB Device(s) found
> > >>>        scanning usb for storage devices... 1 Storage Device(s) found
> > >>> => efishell devices
> > >>> Scanning disk usb_mass_storage.lun0...
> > >>> Device Name
> > >>> ============================================
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,MBR,0x086246ba,0x40800,0x3f800)
> > >>> /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USBClass(0,0,9,0,1)/USBClass(46f4,1,0,0,0)/HD(1,0x01,0,0x40,0x14fe4c)
> > >>>
> > >>> Without this patch, the last device, USB mass storage, won't show up.
> > >>>
> > >>> [1] https://lists.denx.de/pipermail/u-boot/2018-October/345307.html
> > >>>
> > >>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > >>
> > >> Why should we try to fix something in the EFI subsystems that goes wrong
> > >> in the handling of device enumeration.
> > >
> > > No.
> > > This is a natural result from how efi disks are currently implemented on u-boot.
> > > Do you want to totally re-write/re-implement efi disks?
> >
> > Could we just make this event based for now? Call a hook from the
> > storage dm subsystem when a new u-boot block device gets created to
> > issue a sync of that in the efi subsystem?
> >
> 
> Please no. We don't want EFI hooks around the place. EFI should use
> DM, not the other way around.

Right, but every efi disk is associated with a backing "u-boot"
block devices (even more, this is not 1-to-1 mapping but many-to-1 due to
partitions).
Without any sort of event/hook mechanism, we can know of all block
devices only by enumerating them at some point as in my current
approach. Do you want to accept this?

(Even in a hacky way. See efi_disk_register():
        for (if_type = 0; if_type < IF_TYPE_COUNT; if_type++)
		...
                printf("Scanning disks on %s...\n", if_typename);
                for (i = 0; i < 4; i++) {    <= !!!
                        desc = blk_get_devnum_by_type(if_type, i);
	...
)

> > That hook would obviously only do something (or get registered?) when
i 
> > the efi object stack is initialized.
> >
> > The long term goal IMHO should still be though to just merge DM and EFI
> > objects. But we're still waiting on the deprecation of non-DM devices
> > for that.
> 
> I think think 'merge' is the right word. Perhaps 'create EFI devices
> in DM' is a better term.

How different is your idea from UCLASS_BLK device(efi_block_device.c)?

The current implementation of UCLASS_BLK, in my opinion, is somehow
in a half way; an instance of UCLASS_BLK is created only when a
efi driver is bound to a controller.
In the meantime, efi disks (efi objects which support UEFI_BLOCK_IO_PROTOCOL)
is implicitly created in efi_disk_add_dev() without any *binding*.

> Anyway, let's do that now. As I may have mentioned we should never
> have enabled EFI on pre-DM boards :-) It has just lead to duplication.
> 
> In any case, the migration deadline for DM_MMC (for example) is the
> upcoming merge window, so the time is now.
> 
> As things stand this patch looks reasonable to me. It is a natural
> consequence of duplicating the DM tables.

I think so, yes.

-Takahiro Akashi

> Regards,
> Simon

  reply	other threads:[~2019-01-11  4:51 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15  4:58 [U-Boot] [PATCH v2 0/3] efi_loader: add removable device support AKASHI Takahiro
2018-11-15  4:58 ` [U-Boot] [PATCH v2 1/3] efi_loader: export efi_locate_handle() function AKASHI Takahiro
2018-11-15  4:58 ` [U-Boot] [PATCH v2 2/3] efi_loader: enumerate disk devices every time AKASHI Takahiro
2018-12-11 19:55   ` Heinrich Schuchardt
2018-12-13  7:58     ` AKASHI Takahiro
2019-01-09  1:05       ` AKASHI Takahiro
2019-01-09  9:06       ` Alexander Graf
2019-01-10  2:13         ` AKASHI Takahiro
2019-01-10  6:21           ` Alexander Graf
2019-01-10  7:26             ` AKASHI Takahiro
2019-01-10  7:30               ` Alexander Graf
2019-01-10  8:02                 ` AKASHI Takahiro
2019-01-10  8:15                   ` Alexander Graf
2019-01-10  9:16                     ` AKASHI Takahiro
2019-01-10  9:22                       ` Alexander Graf
2019-01-10 19:22                         ` Heinrich Schuchardt
2019-01-11  5:08                           ` AKASHI Takahiro
2019-01-11  4:29                         ` AKASHI Takahiro
2019-01-11  7:57                           ` Alexander Graf
2019-01-12 21:32                             ` Simon Glass
2019-01-12 22:00                               ` Alexander Graf
2019-01-16 21:34                                 ` Simon Glass
2019-01-22  8:29                             ` AKASHI Takahiro
2019-01-22  9:08                               ` Alexander Graf
2019-01-22 19:39                                 ` Simon Glass
2019-01-22 21:04                                   ` Heinrich Schuchardt
2019-01-23  8:06                                     ` AKASHI Takahiro
2019-01-23 21:58                                     ` Simon Glass
2019-01-24  0:53                                       ` AKASHI Takahiro
2019-01-24 20:18                                         ` Simon Glass
2019-01-24 21:19                                           ` Heinrich Schuchardt
2019-01-25  2:27                                             ` AKASHI Takahiro
2019-01-23  9:51                                   ` Alexander Graf
2019-01-23 22:01                                     ` Simon Glass
2019-01-25  8:27                                     ` AKASHI Takahiro
2019-01-25  8:52                                       ` Alexander Graf
2019-01-25  9:18                                         ` AKASHI Takahiro
2019-01-25  9:31                                           ` Alexander Graf
2019-01-28  8:56                                             ` AKASHI Takahiro
2019-01-28  9:36                                               ` Alexander Graf
2019-01-29  0:46                                               ` Simon Glass
2019-01-29  1:22                                                 ` AKASHI Takahiro
2019-01-23  8:12                                 ` AKASHI Takahiro
2019-01-23  9:30                                   ` Alexander Graf
2019-01-10 12:57         ` Simon Glass
2019-01-11  4:51           ` AKASHI Takahiro [this message]
2019-01-11  8:00             ` Alexander Graf
2019-01-11 13:03               ` Mark Kettenis
2018-11-15  4:58 ` [U-Boot] [PATCH v2 3/3] efi_loader: remove block device details from efi file AKASHI Takahiro
2019-01-09  9:18   ` Alexander Graf
2019-01-10  0:37     ` AKASHI Takahiro
2019-01-10  6:22       ` Alexander Graf
2019-01-10  6:36         ` AKASHI Takahiro

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=20190111045133.GI20286@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.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