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 6DDF2C433F5 for ; Mon, 9 May 2022 05:33:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E42A83B32; Mon, 9 May 2022 07:33:20 +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="uJOQ8GOA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DCA4383B32; Mon, 9 May 2022 07:33:18 +0200 (CEST) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 E2F9A802EB for ; Mon, 9 May 2022 07:33:15 +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-pj1-x102e.google.com with SMTP id gj17-20020a17090b109100b001d8b390f77bso16061076pjb.1 for ; Sun, 08 May 2022 22:33:15 -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=Jiklt6cmv34/rBVVK450sQMHsEeL5elrgShXkFqahgc=; b=uJOQ8GOANtA1gDEhDBuHHy7zF7C4GKazhLKa53bdQxy0SobThdWFHYWoiAub46IOFm uS3Ayvnj0wasbQbcu3IO5/jTjtBbo252Y0GJEc9tTCJDZflPGuej0E+alOj1k5JoTSEk 6s0gSulk/0b5fi+LWdkuFDfP9AXpvTBcSkhsZWgBirnvKJuojmrOA3KlQ+g/dprKLTX3 ByRivGwF1Ed8dChdIyt6n1RQaEvECOi4hNEjHtkJxlBlUTvWWPIm7qhInrkOVVuMe7ZR nVBHNhJDwZ6ju/jG7gK0+89Slqw+papq2EufL3YkK70V/Q+8sYFBwhE9xxv1tp1MvQF3 B8cQ== 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=Jiklt6cmv34/rBVVK450sQMHsEeL5elrgShXkFqahgc=; b=mRsMwA5rsKUBeD/nouzFlrUbi/Ryd6P/zZx1wrivWeDMwU7ROOCMweGCgcVGlIN5t+ Df4EJQem2gzDJGutBHS1tulU6AH5elRVUZSAjz4Ph6+/2XATJuDFFuWyWJ4CfRdeSFYP TLtNW86qb8imRB3jsYl4tWSF2Bm1QZemzTRDrT+qQRZlWlxmgqmrLmUGQkQqrZocrxhm 3exm5eTkEaVaizpD6PRE4OXLSkUmtZZavqMre6KCz9+RLbz5N6yJn8Hne171S9TkXkHI hRzWi6oUrsEny0WF07eqdTpeR3b90ReFgMftKMrwM6rpNyYBVhZLgUNcfoa9pU+Ib/rd fnmg== X-Gm-Message-State: AOAM531J374BXPiMhILltgVsv9JjswEX3i2W9wLnBbR/LVzqqS33rzhU 7GLPE/PtrPyx09uJyoFhNyFiCg== X-Google-Smtp-Source: ABdhPJwGjcBOtgc5A5kn4gnV+K+6P/dU1brjwV28ByrdX/QKUneH7OZ+M4oWZtJviQs8khXwQBHmQQ== X-Received: by 2002:a17:902:ee8d:b0:15c:f1c1:c520 with SMTP id a13-20020a170902ee8d00b0015cf1c1c520mr14917939pld.122.1652074394266; Sun, 08 May 2022 22:33:14 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:61c9:1f8:7f1b:d632]) by smtp.gmail.com with ESMTPSA id y13-20020a170902cacd00b0015e9d4a5d27sm6060054pld.23.2022.05.08.22.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:33:13 -0700 (PDT) Date: Mon, 9 May 2022 14:33:10 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: mark.kettenis@xs4all.nl, u-boot@lists.denx.de, Simon Glass Subject: Re: [PATCH] efi_loader: disk: allow blk devices even without UCLASS_PARTITION Message-ID: <20220509053310.GC34398@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , mark.kettenis@xs4all.nl, u-boot@lists.denx.de, Simon Glass References: <20220428044916.52250-1-takahiro.akashi@linaro.org> <706b0e6e-59d1-52f7-3fc9-55285491bf62@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <706b0e6e-59d1-52f7-3fc9-55285491bf62@gmx.de> 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 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? -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(); >