[PATCH v5 04/28] efi: Locate all block devices in the app

Simon Glass sjg at chromium.org
Fri Dec 17 17:37:15 CET 2021


Hi Heinrich,

On Thu, 9 Dec 2021 at 12:23, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 12/4/21 10:43, Heinrich Schuchardt wrote:
> > On 12/4/21 16:56, Simon Glass wrote:
> >> When starting the app, locate all block devices and make them available
> >> to U-Boot. This allows listing partitions and accessing files in
> >> filesystems.
> >>
> >> EFI also has the concept of 'disks', meaning boot media. For now, this
> >> is not obviously useful in U-Boot, but add code to at least locate these.
> >> This can be expanded later as needed.
> >>
> >> Series-changes; 2
> >> - Store device path in struct efi_media_plat
> >> - Don't export efi_bind_block()
> >> - Only bind devices for media devices, not for partitions
> >> - Show devices that are processed
> >> - Update documentation
> >>
> >> Signed-off-by: Simon Glass <sjg at chromium.org>
> >> ---
> >>
> >> (no changes since v1)
> >>
> >>   doc/develop/uefi/u-boot_on_efi.rst |   4 +-
> >>   include/efi.h                      |   6 +-
> >>   include/efi_api.h                  |  15 ++
> >>   lib/efi/efi_app.c                  | 223 +++++++++++++++++++++++++++++
> >>   4 files changed, 243 insertions(+), 5 deletions(-)
[..]

> >> +static int setup_disks(void)
> >> +{
> >> +    /* This is not fully implemented yet */
>
> see hint below.
>
> >> +    return 0;
> >> +
> >> +    efi_guid_t efi_disk_guid = EFI_DISK_IO_PROTOCOL_GUID;
>
> U-Boot does not implement the EFI_DISK_IO_PROTOCOL. So you will not be
> able to run U-Boot as an EFI app loaded by U-Boot which might be nice
> for testing.
>
> The more basic protocol is the EFI_BLOCK_IO_PROTOCOL. The difference is
> that the EFI_BLOCK_IO_PROTOCOL requires using a properly aligned buffer.
>
> >> +    struct efi_boot_services *boot = efi_get_boot();
> >> +    struct efi_disk *disk;
> >> +    int ret;
> >> +
> >> +    if (!boot)
> >> +        return log_msg_ret("sys", -ENOSYS);
> >> +    ret = boot->locate_protocol(&efi_disk_guid, NULL, (void **)&disk);
>
> If you want to find all handles implementing a protocol, you can use
> EFI_BOOT_SERVICES.LocateHandleBuffer() with SearchType ByProtocol.
>
> I guess we should add this patch to U-Boot once it is completed.

OK, let's drop this code then.

[..]
Regards,
Simon


More information about the U-Boot mailing list