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 784A9C433F5 for ; Thu, 19 May 2022 05:11:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C81F783ABF; Thu, 19 May 2022 07:11:13 +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="XZz1kpAS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7D0C83C01; Thu, 19 May 2022 07:11:11 +0200 (CEST) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (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 ED8968210C for ; Thu, 19 May 2022 07:11: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-pl1-x635.google.com with SMTP id n8so3807501plh.1 for ; Wed, 18 May 2022 22:11: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=PCluKCrJYL3xsKUuAT0PZaMETvI3uK103H3sb5tqfjM=; b=XZz1kpAStmex8ngkIkqsdYI0+HAIesE4Ngfp97YIR4lhHvDXbK8xWJ8nsqL9j7hzVP Ppv8ON+ZSAXzhhj/mn94JjtynuK8F4ANX5uKAC/AcErXydJIz65AvYsuCZ6IScDH9+Wf 0698wKE1/WPFI8UE2dL+gEpvVwR+bE/YWYobOa7ANjBmFMycIjV47dl6RQsa3UZ1/4y4 01bNwGA+U2KQ06LsjnGQHuornqX9WBxbOySOYeTDsFG11k6iIENN9c/ZAATVwBra1D4B PQCbXQAZqlhdagKJ/pqYC0UAXkjZC0v1hZfxKAaZCXe6N/k+3DnA7zbQgAvKd8iD+Xiq 2syw== 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=PCluKCrJYL3xsKUuAT0PZaMETvI3uK103H3sb5tqfjM=; b=XLpyfYapFfd8qzHhc0ygzjTHbZU5h9jzqwef/yDHKr+NLzWocI79ccXOGFsT8m+Akn 7nvFlvYsiXabG6ObcV+KRmYnlJ74tNUQU9NKezi6Ct3BitAN00KkIJ/ke1rMiquV3U2Z EsgLmLA2rpW8lMzcQrVmwrzxn3+lZcBxLD4+o+c6r+Nv5RpxT6f+1TQtrsln9Z1yuplC VTY1Xx8PVvIl+RJj3UcIWs3H5Lt/oNegH+dU+2dt7geWi5TnAbk2l1XqI5goDFDo1zEO /j3V5kVYjVAf+897zyaIvyZXguDCVUs3xiTY4Y2T7oGR30Zn6e+7LzLcEXsvs2dn9iKU zpKQ== X-Gm-Message-State: AOAM531c+FOq8q7brhNWY4V8t94uuxr/3+SSrVTrJF8KYyFMbwkSAZR1 OgVASG0lGThO9M3PDn8v0kHFow== X-Google-Smtp-Source: ABdhPJz2r93PSaaGc3q2GGOY0hwDVpimfp2XYlaXwJb5BSnVJoiNehu79vHH+XR8ZeNq3pZeS3oG2Q== X-Received: by 2002:a17:90a:a096:b0:1df:58d7:5b20 with SMTP id r22-20020a17090aa09600b001df58d75b20mr3212499pjp.212.1652937067044; Wed, 18 May 2022 22:11:07 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:395d:8f58:fd1d:448b]) by smtp.gmail.com with ESMTPSA id n9-20020a17090a928900b001d92e2e5694sm4602537pjo.1.2022.05.18.22.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 22:11:06 -0700 (PDT) Date: Thu, 19 May 2022 14:11: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: <20220519051102.GB48050@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509053310.GC34398@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 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? -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(); > >