From patchwork Fri Dec 10 06:49:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 522743 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp2171183imb; Thu, 9 Dec 2021 22:53:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJy67cDFum41mauIeeK7mX8PPucJPO4ncyywXu6Ga50MYQBDHs/pCByCAwaiS1dwrqvkMm5b X-Received: by 2002:a50:d88b:: with SMTP id p11mr34990974edj.287.1639119233824; Thu, 09 Dec 2021 22:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639119233; cv=none; d=google.com; s=arc-20160816; b=D8DPd8E6WzOGB/pDbY+/bIWr3PZYoyqc+akZCHeVCPnVXIU1HL4EJOCWwDaCNtkXZh l95DWuVpAM85rraUhKKq+L7WcRswTpnGZNkJavZQFpgdCU/EMbL6TOsxnumJKo249aJd R2YXxJvT5sVdmflnpUHR4K17ZAL8ckWZsG2NXYhw7rFIacp17Q7RVpBl2bsxjrDdJ2ug Xeb4xc4ljrRx732uIhV5UWZ1i0QsLzsv16X0HdPSYHBJKNbXl3gpZkKSjjvua3XQiUr9 39ei7OafWIWypV9dwdHKB/r3d3jgn8m0pTGLZ+I49klQt/9CR7eRrsbSxqnGiLWpjrw6 HW6A== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2E8j064XPFTH1anOXyWK37XKESJbFHCLe03Ly8Wy8ZU=; b=uqfTRUgRNzVYMDyvsFcKY4cfD3joAkzEk8j97GpUPu+y9fiOivlD0wq1Cd9hjH0f61 CECdc6h0H1KiP9cxP8zdfXGAqIZxXXGZ8BgrM6L6E+lUkkXV2MOvA0P/hnjoa9rRaDUE 6jBesnHlpOuPIOlX0++EbkvfQYw0mixI/KFrXTfwD7SUq6xYkBFRiOvfWBgTOSQ3Tlm7 22eso+7j9Ka9o5yOoymw6DqmzJ5n6bMC8rl/x4C91zujazuoZ926h6bp4LtfBsFwJ15x BifTh3UdU93WYtXvnnTj64lID45vUc9UHqkqBp1YuZXrb/LHLjYvR9zAkuxgOdHyvHkU WpsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vxyRkd5G; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id z2si3692102ejm.647.2021.12.09.22.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 22:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vxyRkd5G; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 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) 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-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-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 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 Reviewed-by: Simon Glass --- 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; }