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 C4190C433EF for ; Thu, 28 Apr 2022 04:49:41 +0000 (UTC) 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) 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-Google-Smtp-Source: ABdhPJz89nddh0D2ooANP3oMDRU1rIyQDnJJMgG5S54ud0vrgpTWRuvfbr/9/QuVKST2hyrCExfAHQ== 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 Content-Transfer-Encoding: 8bit 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 --- 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(); -- 2.33.0