From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 52355C433F5 for ; Wed, 1 Jun 2022 00:29:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8929783E63; Wed, 1 Jun 2022 02:29:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="z2765F77"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9919483E92; Wed, 1 Jun 2022 02:29:15 +0200 (CEST) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 69E2683E43 for ; Wed, 1 Jun 2022 02:29:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42f.google.com with SMTP id j6so410154pfe.13 for ; Tue, 31 May 2022 17:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=+ce4aWmrZBKxF4Yv6mdzlNnOHtmlUa2y/8t3ppUtCjE=; b=z2765F77ok9dgfMaKCx5Nxar7dOoiMNT7yMoT49m8WpmJ69dyijdq6a1o0pPCyJcq6 e3RaBBINn4l6F0FIsdCrftZD7YkM1R580M7M8Q4cBVbirKmHm1IxwG8yqkvTDxz+mnNK xdeX3mqhRcXgAt7D+u4Z8kTnH28C4G/THwjTTDGGTz1eEiFmDX1RPrB59gwS51ZEZlfC Ptf6O6v1R2pkVg62RfbG28S5V3GdWK3yMBQSlDXK0lVuT7gHlnq3FT+Q6GczhMEd6w9c 2FN1wXEoGe3GQ0CUkRZV+7jymKhf32bzt8/6yYtH8DbFyMk8tm3JfpXWpUPQQdi7+Ozt Ac8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=+ce4aWmrZBKxF4Yv6mdzlNnOHtmlUa2y/8t3ppUtCjE=; b=nA+Q5kNJfd1Lc2wdbLksX3C9jCMGi4Y4d0Q4wyEbp4d6UqAPuWhD/e8yusVfjSSR/S f6jNH2WeQYc4OS2taIfadM2Q5HEt/OE9obVDp9Z3j/1TSVTWHP0F/JzLXcztSPp9B7C6 BcoaSLz2SBc6LjB0TcmWdb2ZU64ftrf4i+PlFol83uaykQQUV0YwBxV9fLYvMDPuXrtG c/Vn5sbx7bdPBji8QKuek//5dS0tDK0VwTVGqx3V8vW4lqTFyv8O1EAAYjIyQen9cgNP iQsvVDCuXRTLPWxxLdFB4/yJy4BKYhA2xCU8umSj6cEBFIlM/DjRSWD9LdKA1YefOdPm y/bg== X-Gm-Message-State: AOAM5320EJfK/bURNjjoUXguiyEi29GEhwxWvS1Qx8CgnneWORPavBUd 7GtciYkYfJxfyc/5+9VQprYP+A== X-Google-Smtp-Source: ABdhPJzhaXbnhn50Rlvrv2RWw504oKeapO5Ku2vUuppcIm0jTHm328JhBYWK5zbXIy7Dbr/IO17lXA== X-Received: by 2002:a63:d40f:0:b0:3fa:247c:f07d with SMTP id a15-20020a63d40f000000b003fa247cf07dmr41369945pgh.459.1654043346789; Tue, 31 May 2022 17:29:06 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:753f:c927:92c8:dd77]) by smtp.gmail.com with ESMTPSA id g12-20020a17090a7d0c00b001e30207ae98sm104926pjl.7.2022.05.31.17.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 17:29:06 -0700 (PDT) Date: Wed, 1 Jun 2022 09:29:02 +0900 From: AKASHI Takahiro To: Simon Glass Cc: Heinrich Schuchardt , mark.kettenis@xs4all.nl, u-boot@lists.denx.de Subject: Re: [PATCH] efi_loader: disk: allow blk devices even without UCLASS_PARTITION Message-ID: <20220601002902.GC42623@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Heinrich Schuchardt , mark.kettenis@xs4all.nl, u-boot@lists.denx.de References: <20220428044916.52250-1-takahiro.akashi@linaro.org> <706b0e6e-59d1-52f7-3fc9-55285491bf62@gmx.de> <20220509053310.GC34398@laputa> <20220519051102.GB48050@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220519051102.GB48050@laputa> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Thu, May 19, 2022 at 02:11:02PM +0900, AKASHI Takahiro wrote: > Hi Simon, > > On Mon, May 09, 2022 at 02:33:10PM +0900, AKASHI Takahiro wrote: > > Simon, > > > > On Thu, Apr 28, 2022 at 12:43:03PM +0200, Heinrich Schuchardt wrote: > > > On 4/28/22 06:49, AKASHI Takahiro wrote: > > > > While GPT partition is mandated in UEFI specification, CONFIG_PARTITION is > > > > seen optional under the current implementation. > > > > So modify efi_disk_rw_blocks() to allow accepting UCLASS_BLK devices. > > > > > > > > Fixes: commit d97e98c887ed ("efi_loader: disk: use udevice instead of blk_desc") > > > > Signed-off-by: AKASHI Takahiro > > > > --- > > > > lib/efi_loader/efi_disk.c | 29 +++++++++++++++-------------- > > > > 1 file changed, 15 insertions(+), 14 deletions(-) > > > > > > > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > > > > index 8fb5b2363c45..f5b462fb164a 100644 > > > > --- a/lib/efi_loader/efi_disk.c > > > > +++ b/lib/efi_loader/efi_disk.c > > > > @@ -99,21 +99,22 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, > > > > if (buffer_size & (blksz - 1)) > > > > return EFI_BAD_BUFFER_SIZE; > > > > > > > > -#if CONFIG_IS_ENABLED(PARTITIONS) > > > > - if (direction == EFI_DISK_READ) > > > > - n = dev_read(diskobj->dev, lba, blocks, buffer); > > > > - else > > > > - n = dev_write(diskobj->dev, lba, blocks, buffer); > > > > -#else > > > > - /* dev is always a block device (UCLASS_BLK) */ > > > > - struct blk_desc *desc; > > > > + if (CONFIG_IS_ENABLED(PARTITIONS) && > > > > + device_get_uclass_id(diskobj->dev) == UCLASS_PARTITION) { > > > > + if (direction == EFI_DISK_READ) > > > > + n = dev_read(diskobj->dev, lba, blocks, buffer); > > > > + else > > > > + n = dev_write(diskobj->dev, lba, blocks, buffer); > > > > > > Thanks for the patch. It solves the problem with the block IO protocol. > > > > > > Why should dev_read() and dev_write only work for UCLASS_PARTITION? > > > > I don't remember well, but I have expected that even a whole disk be > > represented as a partition (0). > > > > > Can't we make it work for any block device? I think the treatment of > > > different types of block devices should be moved to disk/disk-uclass.c. > > > > @Simon, what are your thoughts? > > Gentle ping. Any comment here? Ping again. I hope that you have some opinion here as the maintainer of DM. -Takahiro Akashi > -Takahiro Akashi > > > > > -Takahiro Akashi > > > > > I will pull this patch as a fast fix. But this should not be the final > > > design. > > > > > > Reviewed-by: Heinrich Schuchardt > > > > > > > + } else { > > > > + /* dev is a block device (UCLASS_BLK) */ > > > > + struct blk_desc *desc; > > > > > > > > - desc = dev_get_uclass_plat(diskobj->dev); > > > > - if (direction == EFI_DISK_READ) > > > > - n = blk_dread(desc, lba, blocks, buffer); > > > > - else > > > > - n = blk_dwrite(desc, lba, blocks, buffer); > > > > -#endif > > > > + desc = dev_get_uclass_plat(diskobj->dev); > > > > + if (direction == EFI_DISK_READ) > > > > + n = blk_dread(desc, lba, blocks, buffer); > > > > + else > > > > + n = blk_dwrite(desc, lba, blocks, buffer); > > > > + } > > > > > > > > /* We don't do interrupts, so check for timers cooperatively */ > > > > efi_timer_check(); > > >