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 02230C433EF for ; Fri, 10 Dec 2021 06:53:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E896183736; Fri, 10 Dec 2021 07:51:53 +0100 (CET) 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="vxyRkd5G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0256F83112; Fri, 10 Dec 2021 07:51:28 +0100 (CET) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 303DC83518 for ; Fri, 10 Dec 2021 07:51:22 +0100 (CET) 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-x62a.google.com with SMTP id o14so5647847plg.5 for ; Thu, 09 Dec 2021 22:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2E8j064XPFTH1anOXyWK37XKESJbFHCLe03Ly8Wy8ZU=; b=vxyRkd5GtUuxzactpNXz2exfk9HgdBcwywuF0reKnM6j2Ah7lRA7IB92ThG7hRbgnV k3piwZ3zY78V55G9PC7Lzq33bDdA46+VXHSdIeEQCS9DoTPvPRnzcT9F9NBjLFXzTjQa H5SeU3cIzz8BXUJ71qVZa6uWU0K3dzMbQ7uhlgmiV2x2K/ufi+vQs6jlkbGpAFxyq8Bk I5HZ6gp2iX+/y2USmr18AFC5Vw1jlYKknVO3JXzPC+sK+y7a3vKQPr0F7evooSptARyn l9T5IcguxkcDFHkfdzpt+aZ5Pgw2qsiDUGvQBhMujl5y/uQSQ3kl9yN2tE2z/KDjPFBu ry/A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2E8j064XPFTH1anOXyWK37XKESJbFHCLe03Ly8Wy8ZU=; b=eeyFdoalHDrXAWcfza+rFOx7KPpl4Jx6DywZu0+1Ts4CKvwd5bsvWgAVCe4s4skMws kCFP6YCFwkJH0LxZCAun6alO0pCYeqh9D0pvjfkgrKIYMwCu2Zelv86hNbLy7alWFGnF DZTSx8Cc7tQP1B4nIXZoz3XyOp4j0mahrQ2izG/6MVMK6WhYeRNqdEqmXTE+qwOJIJDN MDoPBJlRiCARJ6jfVhQBCBYapAhEZ27gWD/TsMKDlAIPm5gUC/yejmtXJ1WHirzGdb7P 5nAx3C14erWRKb8U/qgv7SNSeP9eiZ9f/EYbtECUQ4nDRD/OkjjQRTfKtffH5zX+Hz2i qxjw== X-Gm-Message-State: AOAM530QIdxMBUS/usZusMusjwzjzKXaBOOqEt32EjCj12jZz4Xvb+YS 2bK53bHrzKSK41aJ4vsvXDWmUH9FRgtLbHzL X-Google-Smtp-Source: ABdhPJxnlVbInm9LDXa+V7JmHHhLtPRTlJN4bqRwnyY1hBzkjuyC0dQ7u/P0xwN9cYuU8kg5VY4s/Q== X-Received: by 2002:a17:902:d395:b0:141:a913:1920 with SMTP id e21-20020a170902d39500b00141a9131920mr73683711pld.81.1639119080583; Thu, 09 Dec 2021 22:51:20 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:75dd:4e0e:4542:936e]) by smtp.gmail.com with ESMTPSA id nn4sm1639035pjb.38.2021.12.09.22.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 22:51:19 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC v2 20/20] efi_driver: align with efi_disk-dm integration Date: Fri, 10 Dec 2021 15:49:47 +0900 Message-Id: <20211210064947.73361-21-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211210064947.73361-1-takahiro.akashi@linaro.org> References: <20211210064947.73361-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean With DM-efi_disk integration, we don't need to explicitly call efi_disk_create_partitions(). The only thing to do is to associate an efi_disk object to the corresponding udevice as we skip most of processing in efi_disk_probe() by the previous commit ("efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI) devices"). Signed-off-by: AKASHI Takahiro --- lib/efi_driver/efi_block_device.c | 34 +++++++++---------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index 0937e3595a43..28f672324991 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -35,6 +35,7 @@ #include #include #include +#include /* * EFI attributes of the udevice handled by this driver. @@ -106,25 +107,6 @@ static ulong efi_bl_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, return blkcnt; } -/** - * Create partions for the block device. - * - * @handle: EFI handle of the block device - * @dev: udevice of the block device - * Return: number of partitions created - */ -static int efi_bl_bind_partitions(efi_handle_t handle, struct udevice *dev) -{ - struct blk_desc *desc; - const char *if_typename; - - desc = dev_get_uclass_plat(dev); - if_typename = blk_get_if_type_name(desc->if_type); - - return efi_disk_create_partitions(handle, desc, if_typename, - desc->devnum, dev->name); -} - /** * Create a block device for a handle * @@ -139,7 +121,6 @@ static int efi_bl_bind(efi_handle_t handle, void *interface) char *name; struct efi_object *obj = efi_search_obj(handle); struct efi_block_io *io = interface; - int disks; struct efi_blk_plat *plat; EFI_PRINT("%s: handle %p, interface %p\n", __func__, handle, io); @@ -173,15 +154,20 @@ static int efi_bl_bind(efi_handle_t handle, void *interface) plat->handle = handle; plat->io = interface; + /* + * FIXME: necessary because we won't do almost nothing in + * efi_disk_create() when called from device_probe(). + */ + ret = dev_tag_set_ptr(bdev, DM_TAG_EFI, handle); + if (ret) + /* FIXME: cleanup for bdev */ + return ret; + ret = device_probe(bdev); if (ret) return ret; EFI_PRINT("%s: block device '%s' created\n", __func__, bdev->name); - /* Create handles for the partions of the block device */ - disks = efi_bl_bind_partitions(handle, bdev); - EFI_PRINT("Found %d partitions\n", disks); - return 0; } -- 2.33.0