public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Raymond Mao <raymond.mao@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Masahisa Kojima <masahisa.kojima@linaro.org>,
	Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v3 2/3] Boot var automatic management for removable medias
Date: Tue, 23 May 2023 09:22:23 +0300	[thread overview]
Message-ID: <ZGxbn9v3jWEGFgin@hera> (raw)
In-Reply-To: <CAEfUkUJYdHR+gyo4+bX5JkcwCiwmO5rjj9=TeyGpcmRxRbQqQg@mail.gmail.com>

On Tue, May 16, 2023 at 10:17:14AM -0400, Raymond Mao wrote:
> Hi Ilias,
>
> On Tue, 16 May 2023 at 01:59, Ilias Apalodimas <ilias.apalodimas@linaro.org>
> wrote:
>
> > On Tue, May 02, 2023 at 12:12:19PM -0700, Raymond Mao wrote:
> > > Changes for complying to EFI spec §3.5.1.1
> > > 'Removable Media Boot Behavior'.
> > > Boot variables can be automatically generated during a removable
> > > media is probed. At the same time, unused boot variables will be
> > > detected and removed.
> > >
> > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> > > ---
> > > Changes in v2
> > > - Ignore EFI_NOT_FOUND returned from
> > >   efi_bootmgr_update_media_device_boot_option which means no boot
> > >   options scanned.
> > > Changes in v3
> > > - Split the patch into moving and renaming functions and
> > >   individual patches for each changed functionality
> > >
> > >  lib/efi_loader/efi_disk.c         |  7 +++++++
> > >  lib/efi_loader/efi_variable.c     | 10 +++++++++-
> > >  lib/efi_loader/efi_variable_tee.c |  5 +++++
> > >  3 files changed, 21 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > > index d2256713a8..ca5f07f2ec 100644
> > > --- a/lib/efi_loader/efi_disk.c
> > > +++ b/lib/efi_loader/efi_disk.c
> > > @@ -687,6 +687,13 @@ int efi_disk_probe(void *ctx, struct event *event)
> > >                       return -1;
> > >       }
> > >
> > > +     /* only do the boot option management when UEFI sub-system is
> > initialized */
> > > +     if (efi_obj_list_initialized == EFI_SUCCESS) {
> > > +             ret = efi_bootmgr_update_media_device_boot_option();
> > > +             if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
> > > +                     return -1;
> > > +     }
> > > +
> > >       return 0;
> > >  }
> > >
> > > diff --git a/lib/efi_loader/efi_variable.c
> > b/lib/efi_loader/efi_variable.c
> > > index be95ed44e6..fe71144358 100644
> > > --- a/lib/efi_loader/efi_variable.c
> > > +++ b/lib/efi_loader/efi_variable.c
> > > @@ -476,6 +476,14 @@ efi_status_t efi_init_variables(void)
> > >                       log_err("Invalid EFI variable seed\n");
> > >       }
> > >
> > > +     ret = efi_init_secure_state();
> > > +     if (ret != EFI_SUCCESS)
> > > +             return ret;
> > >
> > > -     return efi_init_secure_state();
> > > +     /* update boot option management after variable service
> > initialized */
> > > +     ret = efi_bootmgr_update_media_device_boot_option();
> > > +     if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
> > > +             return ret;
> > > +
> > > +     return EFI_SUCCESS;
> > >  }
> > > diff --git a/lib/efi_loader/efi_variable_tee.c
> > b/lib/efi_loader/efi_variable_tee.c
> > > index dfef18435d..2995d4a583 100644
> > > --- a/lib/efi_loader/efi_variable_tee.c
> > > +++ b/lib/efi_loader/efi_variable_tee.c
> > > @@ -748,5 +748,10 @@ efi_status_t efi_init_variables(void)
> > >       if (ret != EFI_SUCCESS)
> > >               return ret;
> > >
> > > +     /* update boot option management after variable service
> > initialized */
> > > +     ret = efi_bootmgr_update_media_device_boot_option();
> > > +     if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
> > > +             return ret;
> >
> > You don't need this if, just return ret
> >
> We have to differentiate EFI_NOT_FOUND here for no removable medias are
> detected, otherwise efi_init_obj_list() will return failure if the return
> code of efi_init_variables() is not EFI_SUCCESS.
>

Ah fair enough.  This seems fine then, please resend the series with the
changes in patch #3

Thanks
/Ilias
> >
> > > +
> > >       return EFI_SUCCESS;
> > >  }
> > > --
> > > 2.25.1
> > >
> >
> > Regards
> > /Ilias
> >


  reply	other threads:[~2023-05-23  6:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 19:12 [PATCH v3 1/3] Move bootorder and bootoption apis to lib Raymond Mao
2023-05-02 19:12 ` [PATCH v3 2/3] Boot var automatic management for removable medias Raymond Mao
2023-05-16  5:59   ` Ilias Apalodimas
2023-05-16 14:17     ` Raymond Mao
2023-05-23  6:22       ` Ilias Apalodimas [this message]
2023-05-02 19:12 ` [PATCH v3 3/3] Load option with short device path for boot vars Raymond Mao
2023-05-16  5:57   ` Ilias Apalodimas
2023-05-16 14:26     ` Raymond Mao
2023-05-16  5:58 ` [PATCH v3 1/3] Move bootorder and bootoption apis to lib Ilias Apalodimas
2023-05-16 14:32   ` Raymond Mao

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=ZGxbn9v3jWEGFgin@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=raymond.mao@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