From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Tom Rini <trini@konsulko.com>,
Christian Melki <christian.melki@t2data.com>,
Bin Meng <bmeng.cn@gmail.com>, Alexander Graf <agraf@csgraf.de>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v4 09/34] efi: Add EFI uclass for media
Date: Mon, 8 Nov 2021 14:29:40 +0900 [thread overview]
Message-ID: <20211108052940.GF16401@laputa> (raw)
In-Reply-To: <CAPnjgZ2X++h0Vv-d73m6F_BFtVgXwq2LA2e0MvXqFOJKeYYpxQ@mail.gmail.com>
On Sun, Nov 07, 2021 at 09:43:22AM -0700, Simon Glass wrote:
> Hi Heinrich,
>
> On Sun, 7 Nov 2021 at 01:21, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> >
> >
> > On 11/4/21 04:09, Simon Glass wrote:
> > > At present UCLASS_EFI is used to represent an EFI filesystem among other
> > > things. The description of this uclass is "EFI managed devices" which is
> > > pretty vague. The only driver that uses this uclass is in fact not a real
> > > U-Boot driver, since its operations do not include a struct udevice.
> > >
> > > Rather than mess with this, create a new UCLASS_EFI_MEDIA uclass to handle
> > > EFI media such as disks. Make this the uclass to use for EFI media so that
> > > it can be used with 'part list', for example.
> > >
> > > The existing implementation using UCLASS_EFI remains as is, for
> > > discussion.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > > (no changes since v2)
> > >
> > > Changes in v2:
> > > - Add MAINTAINERS entry
> > > - Show the correct interface type with 'part list'
> > > - Update the commit message to explain things better
> > >
> > > MAINTAINERS | 3 +++
> > > arch/sandbox/dts/test.dts | 4 ++++
> > > disk/part.c | 5 ++++-
> > > drivers/block/Kconfig | 23 +++++++++++++++++++++++
> > > drivers/block/Makefile | 3 +++
> > > drivers/block/blk-uclass.c | 2 +-
> > > drivers/block/efi-media-uclass.c | 15 +++++++++++++++
> > > drivers/block/sb_efi_media.c | 20 ++++++++++++++++++++
> > > include/dm/uclass-id.h | 1 +
> > > test/dm/Makefile | 1 +
> > > test/dm/efi_media.c | 24 ++++++++++++++++++++++++
> > > 11 files changed, 99 insertions(+), 2 deletions(-)
> > > create mode 100644 drivers/block/efi-media-uclass.c
> > > create mode 100644 drivers/block/sb_efi_media.c
> > > create mode 100644 test/dm/efi_media.c
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index 00ff572d4d2..3e8f10c72fa 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -712,8 +712,11 @@ W: https://u-boot.readthedocs.io/en/latest/develop/uefi/u-boot_on_efi.html
> > > F: board/efi/efi-x86_app
> > > F: configs/efi-x86_app*
> > > F: doc/develop/uefi/u-boot_on_efi.rst
> > > +F: drivers/block/efi-media-uclass.c
> > > +F: drivers/block/sb_efi_media.c
> > > F: lib/efi/efi_app.c
> > > F: scripts/build-efi.sh
> > > +F: test/dm/efi_media.c
> > >
> > > EFI PAYLOAD
> > > M: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > > index 8cd688e8d26..2cea4a43c87 100644
> > > --- a/arch/sandbox/dts/test.dts
> > > +++ b/arch/sandbox/dts/test.dts
> > > @@ -498,6 +498,10 @@
> > > compatible = "sandbox,clk-ccf";
> > > };
> > >
> > > + efi-media {
> > > + compatible = "sandbox,efi-media";
> > > + };
> > > +
> > > eth@10002000 {
> > > compatible = "sandbox,eth";
> > > reg = <0x10002000 0x1000>;
> > > diff --git a/disk/part.c b/disk/part.c
> > > index a6a8f7052bd..2560f6a50bc 100644
> > > --- a/disk/part.c
> > > +++ b/disk/part.c
> > > @@ -296,8 +296,11 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
> > > case IF_TYPE_VIRTIO:
> > > puts("VirtIO");
> > > break;
> > > + case IF_TYPE_EFI:
> > > + puts("EFI");
> > > + break;
> > > default:
> > > - puts ("UNKNOWN");
> > > + puts("UNKNOWN");
> > > break;
> > > }
> > > printf (" device %d -- Partition Type: %s\n\n",
> > > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > > index 56a4eec05ac..755fdccb574 100644
> > > --- a/drivers/block/Kconfig
> > > +++ b/drivers/block/Kconfig
> > > @@ -61,6 +61,29 @@ config TPL_BLOCK_CACHE
> > > help
> > > This option enables the disk-block cache in TPL
> > >
> > > +config EFI_MEDIA
> > > + bool "Support EFI media drivers"
> > > + default y if EFI || SANDBOX
> > > + help
> > > + Enable this to support media devices on top of UEFI. This enables
> > > + just the uclass so you also need a specific driver to make this do
> > > + anything.
> > > +
> > > + For sandbox there is a test driver.
> > > +
> > > +if EFI_MEDIA
> > > +
> > > +config EFI_MEDIA_SANDBOX
> > > + bool "Sandbox EFI media driver"
> > > + depends on SANDBOX
> > > + default y
> > > + help
> > > + Enables a simple sandbox media driver, used for testing just the
> > > + EFI_MEDIA uclass. It does not do anything useful, since sandbox does
> > > + not actually support running on top of UEFI.
> > > +
> > > +endif # EFI_MEDIA
> > > +
> > > config IDE
> > > bool "Support IDE controllers"
> > > select HAVE_BLOCK_DEVICE
> > > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > > index 94ab5c6f906..3778633da1d 100644
> > > --- a/drivers/block/Makefile
> > > +++ b/drivers/block/Makefile
> > > @@ -14,3 +14,6 @@ obj-$(CONFIG_IDE) += ide.o
> > > endif
> > > obj-$(CONFIG_SANDBOX) += sandbox.o
> > > obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o
> > > +
> > > +obj-$(CONFIG_EFI_MEDIA) += efi-media-uclass.o
> > > +obj-$(CONFIG_EFI_MEDIA_SANDBOX) += sb_efi_media.o
> > > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> > > index 83682dcc181..2db7ce5de20 100644
> > > --- a/drivers/block/blk-uclass.c
> > > +++ b/drivers/block/blk-uclass.c
> > > @@ -44,7 +44,7 @@ static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = {
> > > [IF_TYPE_SATA] = UCLASS_AHCI,
> > > [IF_TYPE_HOST] = UCLASS_ROOT,
> > > [IF_TYPE_NVME] = UCLASS_NVME,
> > > - [IF_TYPE_EFI] = UCLASS_EFI,
> > > + [IF_TYPE_EFI] = UCLASS_EFI_MEDIA,
> >
> > Don't break existing code. Create a new if_type here.
>
> My understanding is that this is not actually used at present. The
> tests appear to pass without trouble.
>
> What problem are you seeing?
I can agree with Simon's claim that the notion of UCLASS_EFI sounds vague.
In my understanding, it is expected to represent any UEFI driver/application
who will convert "UEFI protocol" to "U-Boot device", the only example
right now is "efi_block" device.
One of issues that I can see is that any instance of UCLASS_EFI doesn't
appear in DM tree. I have made an experimental patch which makes UCLASS_EFI
a pseudo U-Boot device. DM tree would look like:
root
|-- 'EFI block driver' (CLASS_EFI for block_io_protocol)
|-- 'efi_blk' (CLASS_BLK with TYPE_EFI)
This way, the meaning of UCLASS_EFI should be much clearer?
# In fact, the actual implementer of BLOCK_IO_PROTOCOL is
# a loaded UEFI application, though.
-Takahiro Akashi
> Regards,
> Simon
next prev parent reply other threads:[~2021-11-08 5:29 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 3:09 [PATCH v4 00/34] efi: Improvements to U-Boot running on top of UEFI Simon Glass
2021-11-04 3:09 ` [PATCH v4 01/34] efi: Add a script to build an image for testing on UEFI Simon Glass
2021-11-07 7:43 ` Heinrich Schuchardt
2021-11-04 3:09 ` [PATCH v4 02/34] efi: Enable DM_ETH for the app Simon Glass
2021-11-04 3:09 ` [PATCH v4 03/34] efi: Drop the OF_EMBED warning for EFI Simon Glass
2021-11-04 3:09 ` [PATCH v4 04/34] x86: Create a 32/64-bit selection for the app Simon Glass
2021-11-04 3:09 ` [PATCH v4 05/34] efi: Create a 64-bit app Simon Glass
2021-11-04 3:09 ` [PATCH v4 06/34] x86: Don't duplicate global_ptr in 64-bit EFI app Simon Glass
2021-11-07 7:59 ` Heinrich Schuchardt
2021-11-04 3:09 ` [PATCH v4 07/34] efi: Add a way to obtain boot services in the app Simon Glass
2021-11-07 8:06 ` Heinrich Schuchardt
2021-11-04 3:09 ` [PATCH v4 08/34] efi: Add video support to " Simon Glass
2021-11-07 8:10 ` Heinrich Schuchardt
2021-11-04 3:09 ` [PATCH v4 09/34] efi: Add EFI uclass for media Simon Glass
2021-11-07 8:16 ` Heinrich Schuchardt
2021-11-07 16:43 ` Simon Glass
2021-11-08 5:29 ` AKASHI Takahiro [this message]
2021-11-08 15:39 ` Heinrich Schuchardt
2021-11-08 15:58 ` Simon Glass
2021-11-13 3:24 ` Simon Glass
2021-11-13 9:23 ` Heinrich Schuchardt
2021-11-13 18:14 ` Simon Glass
2021-12-04 15:28 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 10/34] efi: Add a media/block driver for EFI block devices Simon Glass
2021-11-04 3:09 ` [PATCH v4 11/34] efi: Locate all block devices in the app Simon Glass
2021-11-04 3:09 ` [PATCH v4 12/34] patman: Use a ValueError exception if tools.Run() fails Simon Glass
2021-11-14 0:34 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 13/34] binman: Report an error if test files fail to compile Simon Glass
2021-11-14 0:34 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 14/34] binman: Support reading the offset of an ELF-file symbol Simon Glass
2021-11-14 0:34 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 15/34] binman: Tidy up comments on _DoTestFile() Simon Glass
2021-11-14 0:34 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 16/34] binman: Support updating the dtb in an ELF file Simon Glass
2021-11-14 0:34 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 17/34] efi: serial: Support arrow keys Simon Glass
2021-11-04 3:09 ` [PATCH v4 18/34] bloblist: Support allocating the bloblist Simon Glass
2021-12-05 19:46 ` Simon Glass
2021-11-04 3:09 ` [PATCH v4 19/34] x86: Allow booting a kernel from the EFI app Simon Glass
2021-11-04 3:09 ` [PATCH v4 20/34] x86: Don't process the kernel command line unless enabled Simon Glass
2021-11-04 3:09 ` [PATCH v4 21/34] x86: efi: Add room for the binman definition in the dtb Simon Glass
2021-11-04 3:09 ` [PATCH v4 22/34] efi: Drop device_path from struct efi_priv Simon Glass
2021-11-04 3:09 ` [PATCH v4 23/34] efi: Add comments to " Simon Glass
2021-11-04 3:09 ` [PATCH v4 28/34] efi: Check for failure when initing the app Simon Glass
2021-11-04 3:09 ` [PATCH v4 29/34] efi: Mention that efi_info_get() is only used in the stub Simon Glass
2021-11-04 3:09 ` [PATCH v4 30/34] efi: Show when allocated pages are used Simon Glass
2021-11-04 3:09 ` [PATCH v4 31/34] efi: Allow easy selection of serial-only operation Simon Glass
2021-11-04 3:09 ` [PATCH v4 32/34] efi: Update efi_get_next_mem_desc() to avoid needing a map Simon Glass
2021-11-04 3:09 ` [PATCH v4 33/34] efi: Support the efi command in the app Simon Glass
2021-11-04 3:09 ` [PATCH v4 34/34] efi: Show the system-table revision Simon Glass
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=20211108052940.GF16401@laputa \
--to=takahiro.akashi@linaro.org \
--cc=agraf@csgraf.de \
--cc=bmeng.cn@gmail.com \
--cc=christian.melki@t2data.com \
--cc=ilias.apalodimas@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--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