From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 01/10] efi_loader: disk: add efi_disk_is_system_part()
Date: Tue, 28 Apr 2020 08:54:13 +0900 [thread overview]
Message-ID: <20200427235413.GB16947@laputa> (raw)
In-Reply-To: <12671674-0df8-4aeb-8a92-f3672a696f4e@gmx.de>
Heinrich,
On Mon, Apr 27, 2020 at 09:57:25PM +0200, Heinrich Schuchardt wrote:
> On 4/27/20 11:48 AM, AKASHI Takahiro wrote:
> > This function will check if a given handle to device is a EFI system
> > partition. It will be utilised in implementing capsule-on-disk feature.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> Just a reminder for me:
>
> This patch depends on
> "part: detect EFI system partition"
> https://lists.denx.de/pipermail/u-boot/2020-April/408150.html
Yes, and I explicitly mentioned it in "prerequisite patches"
of the cover letter.
(I objected to the patch 2/2 though.)
> > ---
> > include/efi_loader.h | 2 ++
> > lib/efi_loader/efi_disk.c | 22 ++++++++++++++++++++++
> > 2 files changed, 24 insertions(+)
> >
> > diff --git a/include/efi_loader.h b/include/efi_loader.h
> > index b7bccf50b30c..d4510462d616 100644
> > --- a/include/efi_loader.h
> > +++ b/include/efi_loader.h
> > @@ -393,6 +393,8 @@ efi_status_t efi_disk_register(void);
> > int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
> > const char *if_typename, int diskid,
> > const char *pdevname);
> > +/* Check if it is EFI system partition */
> > +bool efi_disk_is_system_part(efi_handle_t handle);
> > /* Called by bootefi to make GOP (graphical) interface available */
> > efi_status_t efi_gop_register(void);
> > /* Called by bootefi to make the network interface available */
> > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > index fd3df80b0b96..9f58a8642c85 100644
> > --- a/lib/efi_loader/efi_disk.c
> > +++ b/lib/efi_loader/efi_disk.c
> > @@ -588,3 +588,25 @@ efi_status_t efi_disk_register(void)
> >
> > return EFI_SUCCESS;
> > }
> > +
>
> Please, provide a function description, cf.
> https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation
That is the thing that I've forgot to address in this version.
> > +bool efi_disk_is_system_part(efi_handle_t handle)
> > +{
> > + struct efi_handler *handler;
> > + struct efi_disk_obj *diskobj;
> > + disk_partition_t info;
> > + efi_status_t ret;
> > + int r;
> > +
> > + /* check if this is a block device */
> > + ret = efi_search_protocol(handle, &efi_block_io_guid, &handler);
> > + if (ret != EFI_SUCCESS)
> > + return false;
> > +
> > + diskobj = container_of(handle, struct efi_disk_obj, header);
>
> This is just a complicated way of saying:
>
> diskobj = (struct efi_disk_obj *)handle;
>
> I would rather avoid container_of() here though it is not wrong.
My code doesn't rely on the fact that 'handle' is the first
element of 'struct efi_disk_obj'
So use of container_of has no disadvantage.
Thanks,
-Takahiro Akashi
> Best regards
>
> Heinrich
>
> > +
> > + r = part_get_info(diskobj->desc, diskobj->part, &info);
> > + if (r)
> > + return false;
> > +
> > + return info.bootable & PART_EFI_SYSTEM_PARTITION;
> > +}
> >
next prev parent reply other threads:[~2020-04-27 23:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 9:48 [PATCH 00/10] efi_loader: add capsule update support AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 01/10] efi_loader: disk: add efi_disk_is_system_part() AKASHI Takahiro
2020-04-27 19:57 ` Heinrich Schuchardt
2020-04-27 23:54 ` AKASHI Takahiro [this message]
2020-05-01 7:06 ` Heinrich Schuchardt
2020-05-05 22:33 ` Heinrich Schuchardt
2020-04-27 9:48 ` [PATCH 02/10] efi_loader: add option to initialise EFI subsystem early AKASHI Takahiro
2020-04-27 20:09 ` Heinrich Schuchardt
2020-04-28 0:16 ` AKASHI Takahiro
2020-05-17 7:29 ` Heinrich Schuchardt
2020-05-18 1:43 ` AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 03/10] efi_loader: define UpdateCapsule api AKASHI Takahiro
2020-05-17 8:02 ` Heinrich Schuchardt
2020-05-18 1:34 ` AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 04/10] efi_loader: capsule: add capsule_on_disk support AKASHI Takahiro
2020-04-27 20:28 ` Heinrich Schuchardt
2020-04-28 0:28 ` AKASHI Takahiro
2020-04-30 12:52 ` Sughosh Ganu
2020-04-30 19:51 ` Heinrich Schuchardt
2020-05-07 2:50 ` AKASHI Takahiro
2020-05-07 12:05 ` Sughosh Ganu
2020-04-27 9:48 ` [PATCH 05/10] efi_loader: capsule: add memory range capsule definitions AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 06/10] efi_loader: capsule: support firmware update AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 07/10] efi_loader: add simple firmware management protocol for FIT image AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 08/10] cmd: add "efidebug capsule" command AKASHI Takahiro
2020-04-30 12:38 ` Sughosh Ganu
2020-05-07 1:58 ` AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 09/10] tools: add mkeficapsule command for UEFI capsule update test AKASHI Takahiro
2020-04-27 20:15 ` Heinrich Schuchardt
2020-04-28 1:52 ` AKASHI Takahiro
2020-04-27 9:48 ` [PATCH 10/10] test/py: add a test for efi firmware update capsule AKASHI Takahiro
2020-04-27 20:33 ` [PATCH 00/10] efi_loader: add capsule update support Heinrich Schuchardt
2020-04-27 23:45 ` 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=20200427235413.GB16947@laputa \
--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