From patchwork Thu Apr 28 04:49:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 567123 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp5125373map; Wed, 27 Apr 2022 21:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/thUp2EvEgq6Aawn87RJ0k8XbEBfwWIAGpeYNurRKDF0ffKl1kyGgwWdBrN1rur8jWuMO X-Received: by 2002:a17:907:1c95:b0:6f0:f17:145 with SMTP id nb21-20020a1709071c9500b006f00f170145mr6177499ejc.380.1651121382155; Wed, 27 Apr 2022 21:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651121382; cv=none; d=google.com; s=arc-20160816; b=nDaeNEDh4SED+OO7r4rJVrWJfxXSxNuonCv5pRjvT9AU9Nrb6z0q5fwbjzfc8BTjUj 69/VOam6K1rYDnR8Mu3oNSUrU8dazWzMgLY3WvRdyL7f5djZWs+UjwlGuKtzyoM5YUtq RhZRqs2Wfm6UBaFEqoCTlDFlrNxyqX+o7clC3PXEgiaf05oxSySQjCEQktphC96974an lOc1g56MbZWZGApw8lxbXUjDbM7Zpche2+OSk4+DQpXPgTK4zTzJvNepH7jB0PJ+dzoS kxCrx/YNQ6UFKw8wJJvc3ixGM2PmFvE0idMf0KQW9kRFLHKfYVuFFQEKTpEQC0JcholU 4GYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=y35Q9g3FRDQLqNhs20Yz05EObtDaPvPlaqgl3lY1trw=; b=BQ79ApcuuEw3UO+fnukukVZF3eWA766UVJ6Pio21maHRpaFx3nmQN00xoSI3ovqKfL 0YbW7ra1rP9jxjldJncnd9fLgZuJRq1KcbTIVg8tIEBJRrlce5vozb6xAQ3RuVX6hTag cEDN/yx8xjyQAXanFq9RFkDoRlHsd+InjEcstXPvsN2S2BPBXe1rX7fEu00EtehVV/az 1ojZdBXDFrhFsnwkdDaq3HJDUj3vWnykhvla94ZhU9FDBDbb+C8nrYWnEagn22t1fXF/ qNMq7RqGXzjGGDXyPENPLjnTn/FglfXOnIy0ZGQ0l8J6QSfX6LT45go3goDEuomfHILR FfDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YMa6LHXx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ka8-20020a170907990800b006e87fcf4cc5si2881429ejc.734.2022.04.27.21.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 21:49:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YMa6LHXx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02CCA81B5B; Thu, 28 Apr 2022 06:49:39 +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="YMa6LHXx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 037B380F92; Thu, 28 Apr 2022 06:49:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 DD0FD80F92 for ; Thu, 28 Apr 2022 06:49:33 +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-x435.google.com with SMTP id t13so3298922pfg.2 for ; Wed, 27 Apr 2022 21:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y35Q9g3FRDQLqNhs20Yz05EObtDaPvPlaqgl3lY1trw=; b=YMa6LHXxg6rgqLwE/xaIfBiD+5nHWOLrixfCbM01FoOl7Jsy36J9dApDpXgRTyRzV7 +is//c2DmMwXdk1hwx13JL8rN62XVS7Ahh3+oLIbDk1Surgtf4Q4WPnnWIYoUlcFuZNE 05wxbX1MP4VEAVvKrotsp7yL8s/S0tfhdE/aWXQOjgFkpWcsGc2F3GNwM4o+BB1FA4fC fGqA/9dvM3Pq/ZyK5zja3DKwmZG31gL1ajWr1XAvpY3FRDQ7/rAFgG3QLYhPReulquGl R2FKE5oSdAJwVdjR1k8NMqJ+FtWHZaTSDX4B5n7WtJ9pfKVgsnMH1a1fhkjYoi17m0Fy Oxig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y35Q9g3FRDQLqNhs20Yz05EObtDaPvPlaqgl3lY1trw=; b=xlxZUjlq7kCJzkdbCmqiYcgg4StSkJdTv0sue2hTmENarilxqTzittFRC+WWec3O9U 4F01Km13IcfktJg0wryz7eFTe1OHdtwyPL+LNOeJbi6e+84+uFtBwFxy26wLfNSIO8p1 BhiMUYkKBCDhLVRzEG/6rIzUCZBkHVhAvxHlbGh1010AY1FY2t1WUF6z9F2kSjzWFbxn +RDd94jPd6dsZO44GXnOJwIWi1+/h3WlEeygM7LYs6zlbXBcRQcldqiNp7TsZAcJQC/e ZXx1DizUIesulTCoZLGYjYKFiS+8LGaF2rN88BSke6eDo9Pn/AYCRg+/kHJXHaJ6hCaj ls/w== X-Gm-Message-State: AOAM533i0JMdC8kc2hw8rbuuOcU806GzHRHeSZqS+NlnqMTE5sNWEgg3 9kPHkvE6c06YrmxwkelpdX7ltg== X-Received: by 2002:a63:82c1:0:b0:3ab:1add:62ea with SMTP id w184-20020a6382c1000000b003ab1add62eamr18612560pgd.535.1651121372018; Wed, 27 Apr 2022 21:49:32 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:d8b3:f603:ee7d:d13]) by smtp.gmail.com with ESMTPSA id ay5-20020a17090b030500b001d967248885sm8859304pjb.29.2022.04.27.21.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 21:49:31 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de Cc: mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH] efi_loader: disk: allow blk devices even without UCLASS_PARTITION Date: Thu, 28 Apr 2022 13:49:16 +0900 Message-Id: <20220428044916.52250-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 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 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 Reviewed-by: Heinrich Schuchardt Tested-by: Mark Kettenis --- 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); + } 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();