Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC0B2C433F5 for ; Mon, 8 Nov 2021 15:39:46 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C8226120D for ; Mon, 8 Nov 2021 15:39:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4C8226120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CFA6A83857; Mon, 8 Nov 2021 16:39:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="JPrOs6VL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F79183845; Mon, 8 Nov 2021 16:39:41 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 11AAB8385C for ; Mon, 8 Nov 2021 16:39:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1636385972; bh=uqXXoqeIghJNn/E9L8KiJ0oquobNYZE8rlGGcJDXG/Y=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=JPrOs6VL6Ki2VaI/JL6ALGk9DOF7jDuXs6QbrPFYugdiiiXhWLxWWL1rf4tDdxl0N Cs4YXoCokPnIuVJRjG2LWuY2+o24CnAIMBi8pj6FCVmqu7KVKzwcg+zchEwaI5nBAK 3aGATMNT6bKb0R+ioD/V2Vuq1IzI9t7if1ojD+BM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.157]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MpUUm-1mNCZs2DVM-00pu5c; Mon, 08 Nov 2021 16:39:32 +0100 Message-ID: <37b7efce-9661-6d08-1b97-3dfaa0956ef7@gmx.de> Date: Mon, 8 Nov 2021 16:39:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH v4 09/34] efi: Add EFI uclass for media Content-Language: en-US To: AKASHI Takahiro , Simon Glass , Ilias Apalodimas , Tom Rini , Christian Melki , Bin Meng , Alexander Graf , U-Boot Mailing List References: <20211104030936.2446706-1-sjg@chromium.org> <20211103210920.v4.9.I50ca59e389adf282bbff50eecc593f010a89c0f7@changeid> <9634500b-604a-a79e-3785-5d49ea21d84b@gmx.de> <20211108052940.GF16401@laputa> From: Heinrich Schuchardt In-Reply-To: <20211108052940.GF16401@laputa> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:aDPBpDD+J6QJ7jKISS1+Nr12T19RWhWtxM7IxNf1Rwmw8FldHjS 69KQJf6Z3TlDHSOr82hIWIYqr1d72MmaF0tU7TyEmbOOiSnymB8hJfwWIJahgv5d5L4hOr+ YyxSeyZ1KOsWMtRc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LeZfmFU4hw W+jl57d1WtTU5anxhd/lYAiTjdoH1PumfWV2pWOHnbZOwSF3MMCoWa/7DSEq73R/JrkJ41pN6 h7kZ8BYeqOT0INBdpDi8fq26HAOlMuqwC69rnrDT3USOTzEE4SHAFDKuUeNe873EOrziUvQS9 4cyxDfG7ZITbQc= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 11/8/21 06:29, AKASHI Takahiro wrote: > 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 w= rote: >>> >>> >>> >>> On 11/4/21 04:09, Simon Glass wrote: >>>> At present UCLASS_EFI is used to represent an EFI filesystem among ot= her >>>> 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 h= andle >>>> 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 >>>> --- >>>> >>>> (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 >>>> 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 =3D "sandbox,clk-ccf"; >>>> }; >>>> >>>> + efi-media { >>>> + compatible =3D "sandbox,efi-media"; >>>> + }; >>>> + >>>> eth@10002000 { >>>> compatible =3D "sandbox,eth"; >>>> reg =3D <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 ena= bles >>>> + just the uclass so you also need a specific driver to make th= is 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 sandb= ox 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) +=3D ide.o >>>> endif >>>> obj-$(CONFIG_SANDBOX) +=3D sandbox.o >>>> obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) +=3D blkcache.o >>>> + >>>> +obj-$(CONFIG_EFI_MEDIA) +=3D efi-media-uclass.o >>>> +obj-$(CONFIG_EFI_MEDIA_SANDBOX) +=3D 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_COU= NT] =3D { >>>> [IF_TYPE_SATA] =3D UCLASS_AHCI, >>>> [IF_TYPE_HOST] =3D UCLASS_ROOT, >>>> [IF_TYPE_NVME] =3D UCLASS_NVME, >>>> - [IF_TYPE_EFI] =3D UCLASS_EFI, >>>> + [IF_TYPE_EFI] =3D 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. None of these tests uses the 'load efi 0:1' command! The iftype-uclass relationship is used during the look up. Please, stick to separate if_types per uclass. Best regards Heinrich >> >> What problem are you seeing? > > I can agree with Simon's claim that the notion of UCLASS_EFI sounds vagu= e. > In my understanding, it is expected to represent any UEFI driver/applica= tion > 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