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] efi_loader: execute image's unload function
Date: Fri, 28 Sep 2018 13:24:42 +0900	[thread overview]
Message-ID: <20180928042440.GA32578@linaro.org> (raw)
In-Reply-To: <44e004c6-171b-23bf-66e6-42312d9d6e8a@gmx.de>

Heinrich,

On Fri, Sep 28, 2018 at 04:35:57AM +0200, Heinrich Schuchardt wrote:
> On 08/09/2018 08:50 AM, AKASHI Takahiro wrote:
> > Currently, unload function in EFI_LOADED_IMAGE_PROTOCOL is never called
> > at UnloadImage Boot Service. This is not compliant to UEFI specification.
> > See chapter "9.1 EFI Loaded Image Protocol."
> 
> With all the patches we got into U-Boot (+HII protocols, +HOB and DXE
> tables) we now can start the EFI shell. But I do not succeed to run the
> SCT. Could you, please, provide an overview what is needed.
> 
> I use the sct-prepare target in
> https://github.com/xypron/u-boot-build/blob/qemu-arm64/Makefile to set
> up my disk image with the SCT.
> 
> Are we missing further patches or is there something wrong with the
> image I generate?

I have the same problem since I rebased my own branch to Alex's
efi-next this week. I'm trying to understand what's happening now.

I will address your comments below later.

Thanks,
-Takahiro Akashi


> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  include/efi_api.h             | 4 +++-
> >  lib/efi_loader/efi_boottime.c | 9 +++++++++
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/efi_api.h b/include/efi_api.h
> > index a4343ae98e2..b2806fba3b8 100644
> > --- a/include/efi_api.h
> > +++ b/include/efi_api.h
> > @@ -326,6 +326,8 @@ struct efi_system_table {
> >  
> >  #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
> >  
> > +typedef efi_status_t (EFIAPI *efi_image_unload_t)(efi_handle_t *image_handle);
> 
> In the rest of efi_api.h we never used typedefs for function prototypes.
> I would prefer to use the explicit type.
> 
> In scripts/checkpatch.pl this will create a warning.
> 
> > +
> >  struct efi_loaded_image {
> >  	u32 revision;
> >  	void *parent_handle;
> > @@ -339,7 +341,7 @@ struct efi_loaded_image {
> >  	aligned_u64 image_size;
> >  	unsigned int image_code_type;
> >  	unsigned int image_data_type;
> > -	unsigned long unload;
> > +	efi_image_unload_t unload;
> >  
> >  	/* Below are efi loader private fields */
> >  #ifdef CONFIG_EFI_LOADER
> > diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> > index 80061e10ebc..d6fcf7e0049 100644
> > --- a/lib/efi_loader/efi_boottime.c
> > +++ b/lib/efi_loader/efi_boottime.c
> > @@ -1843,9 +1843,18 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
> >   */
> >  static efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle)
> >  {
> > +	struct efi_loaded_image *info = image_handle;
> 
> Please, do not assume the the image_handle points to the
> EFI_LOADED_IMAGE_PROTOCOL. Anyway this is not valid anymore after
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=c982874e930d5d673501cd94df07bcbd215d5883
> 
> Best regards
> 
> Heinrich
> 
> >  	struct efi_object *efiobj;
> > +	efi_status_t ret;
> >  
> >  	EFI_ENTRY("%p", image_handle);
> > +
> > +	if (info->unload) {
> > +		ret = info->unload(image_handle);
> > +		if (ret != EFI_SUCCESS)
> > +			return EFI_EXIT(ret);
> > +	}
> > +
> >  	efiobj = efi_search_obj(image_handle);
> >  	if (efiobj)
> >  		list_del(&efiobj->link);
> > 
> 

  reply	other threads:[~2018-09-28  4:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  6:50 [U-Boot] [PATCH] efi_loader: execute image's unload function AKASHI Takahiro
2018-09-28  2:35 ` [U-Boot] " Heinrich Schuchardt
2018-09-28  4:24   ` AKASHI Takahiro [this message]
2018-09-30 20:21     ` Heinrich Schuchardt
2018-10-02  5:04     ` 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=20180928042440.GA32578@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