From patchwork Mon Oct 4 03:44:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515129 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061735imy; Sun, 3 Oct 2021 20:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrhADn/ELRR075+0cm6s20Aqek3IKO+i97LbWpjRJZpJyvHWzeIzSKbSmTOGKA3tGpEtNK X-Received: by 2002:a17:907:7212:: with SMTP id dr18mr11531832ejc.298.1633319114238; Sun, 03 Oct 2021 20:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319114; cv=none; d=google.com; s=arc-20160816; b=UnfD7bNdu3xxFIbsPhY4feNLEevhvuBNlA40Phw54hF9OODkloD2XtnzpNQlCQnLul pUTyS4uYyMoQzpPb7N9kBp0zBbADfiiYL0jJ1B/+StVqU5vNODkUyYeqNqUepIlN/6cc cXquvnhDUPPGvRNk4rO2laBq97ZbScy1EVfP2PJU7byrbRjTaHDNvLM+Nh1Jqv3OH8tF qcN2JCJLA0juglXlwDc0kPFNqnV9rpdSh/qNGzLh9UszsuoFMeIVqfpqC+TO7Q/dnFzd LJxkoWw3luhQ5lGIIQMXlHTewYEDiDpUQlixu0vbXCt0Qy9fwjqvrqV9D+1NWxmdLsif Nqpw== 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=AnfPfV+cavYk3G8dtEDjlVGQ1nDZUEBohAoM7azohRM=; b=l61wUt3vQtd0AYedzzmnQav2jWAODb8uma4Q3g5gRivQeSTKNjCU4lCCix7Q2F0Q2T oSKIymb4js1700o/R7y/03Y/fmjv/o0iudWIKb6KeSQ1PAKqbiWfXzF+7KZPp1rf2Hzi +oula5RBykJExxzVq5raYY+6vxJgW2f2pdpCigqyqQ+3PPQLHJ3O5HA121s6fiZQ0Mnz 3TYqk4Sd78yVwq3lnozS94jpiXLkrls+53ttRsgChzGhflGRWPndLp+2yQq4DHbdzTm9 hq0Mjc7gt6svt/8JMrTQUtXS3UucRdJNsF9J0qULqN2YVglbdvUIkXJ+h8pgkwhDce3B +nww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CXyaJuNC; 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 mp36si23347674ejc.478.2021.10.03.20.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:14 -0700 (PDT) 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=CXyaJuNC; 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 0CDFF8352E; Mon, 4 Oct 2021 05:45: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="CXyaJuNC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E0A4E834FD; Mon, 4 Oct 2021 05:45:11 +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-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (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 877408352E for ; Mon, 4 Oct 2021 05:45:07 +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-x42e.google.com with SMTP id k26so13330318pfi.5 for ; Sun, 03 Oct 2021 20:45:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnfPfV+cavYk3G8dtEDjlVGQ1nDZUEBohAoM7azohRM=; b=CXyaJuNCq/W7d/n9sEzubfGvwtyi9us5N2zVm/CCVKvKF8sc8JiibplscukzgOjBX8 5HMgppTwGsYcB1bUuhtSGM7byllhXVbZcxZ4pXBttO8Xsg1IQphmxO9O197op2MKHVua PkdX7cewRn9A3yAX1+z/0+yG9x/Yc/9gKyZQeKc9oBEhwEoymyb5qV8JAg68RUOKvmSm KzWUWppHmqoZUwbUn+uDZi+IteqetHN7f6Ro5AFh52RGkZB3BykDn/92Cg+2WNOo12Z/ SrOvAUED20zQ1mZcHsCMB+Gz+u66PckH+Muijv9drjGjwm0zfvRyeZZ9jYgzHEYMLFI+ Y/Gw== 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=AnfPfV+cavYk3G8dtEDjlVGQ1nDZUEBohAoM7azohRM=; b=R+GusSLZCYY8wwJeMBaF9xTpH/iMIn9wzjYi48AXA5UXOjMfe57Ot7sNsu2T3QxX7d 12R81eMycPBsAcwnwI0BCU6UiSpIxHGfBjQU4FSCdg97LvCU7sDEBaQdI4xGIapKLJCx 46bvRva1tIHDCjLStIdVXhySY8AX5GkYdk20RCrN7o3IUobscGi0vmVdH0BTeou2PZGV UVHKM5Lde2CefzZhO0Mk7CpZCHuxdYtenNkxAmehrRusMixxuPpvDf5MiQAlrc1EgtWk 9bp2guD9ca3NgLRI7GRkhDY9duUTXWJMbB03ipbGnEkrGAuUt4WnF+N6bu5Kd8tSDy9H YvGw== X-Gm-Message-State: AOAM533rzVrSv6aNM9MZsxEWjRx9NdKWqsftvyJjTWZwZ0z6euB+wrxy XKA0T76UnLr9xgi7gjYlDpY8qw== X-Received: by 2002:a05:6a00:2309:b0:444:6be1:c499 with SMTP id h9-20020a056a00230900b004446be1c499mr23561949pfh.62.1633319105867; Sun, 03 Oct 2021 20:45:05 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:05 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 01/22] part: call part_init() in blk_get_device_by_str() only for MMC Date: Mon, 4 Oct 2021 12:44:09 +0900 Message-Id: <20211004034430.41355-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 In blk_get_device_by_str(), the comment says: "Updates the partition table for the specified hw partition." Since hw partition is supported only on MMC, it makes no sense to do so for other devices. Signed-off-by: AKASHI Takahiro --- disk/part.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.33.0 diff --git a/disk/part.c b/disk/part.c index a6a8f7052bd3..b330103a5bc0 100644 --- a/disk/part.c +++ b/disk/part.c @@ -427,7 +427,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, * Always should be done, otherwise hw partition 0 will return stale * data after displaying a non-zero hw partition. */ - part_init(*dev_desc); + if ((*dev_desc)->if_type == IF_TYPE_MMC) + part_init(*dev_desc); #endif cleanup: From patchwork Mon Oct 4 03:44:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515130 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061794imy; Sun, 3 Oct 2021 20:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3q1GH3GrpWIlFJJkV9xWqZP3NL/jnuEBJ1ANyAJpGcyuSc9uuN4UQYteIdnGJiDYj/EIs X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr15666316edb.169.1633319122377; Sun, 03 Oct 2021 20:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319122; cv=none; d=google.com; s=arc-20160816; b=pEgmB878S+MMAvuEe+CCX0HAOzBUs6fGcRgUuPph3IB4sakRhj/N5xO9scVNGH2cT9 oQZ2QPwj0fBNySje8cABuhJS96UHS1WNoSVwStMrNb9hSqCrQBQsJ4GmHWnvCR/mBRDb cPjyF9LDCiuJNC02si2Zk24FD8AeEFmGAvP/nbbolKYvS1IL0tEaCl6q084fZMlrDTGJ VkbyzVaruU55zxiTUdotaPi+bSBpDjWRXJJ+qVxNbLGuu9mVnAtK5TVPwNgeaLN10I0J 7NixHj4Y0fnxKRChvHzbBE2izgkidrVVMbwRNb4xTf3PbslCrLErtWKtmBSPW5JPK5NB 9W3g== 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=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=M+U36texJbu6hHfrYjgegiGGWjIZoEcVkpsJT27bxuRbS+jL74diSV6XGghlh5RsLM VC18f5x36URtr5EmcDvJ9l8plSmejMlBwXXATXuHm/Qm/d6QT8JhEEnsm347R42iyn3v JjqHkqu7VEb2pOVaYtiWAGe6Xl5bwP9N9+XkGZjciAPR0AwXexl56+6LyIDSA5BQ0Tae +TaM1oltWEqkyZ/ilfiYNudU1c6iAEyJwaBU0e0nBT0m8YAFt70N5rtSQiqgCjuzT2jO isE7eQrYWxm7YID5B/2VWhhI3KjGQweMfP0Hf9dBVNlusmp2k6EkhNKZA23SoJKck5lv AiUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MD1Ovu6C; 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 g2si3295481edz.500.2021.10.03.20.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:22 -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=MD1Ovu6C; 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 7383E83550; Mon, 4 Oct 2021 05:45:18 +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="MD1Ovu6C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 488F883532; Mon, 4 Oct 2021 05:45:15 +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-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 6E46E8352B for ; Mon, 4 Oct 2021 05:45:11 +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-x630.google.com with SMTP id w14so858100pll.2 for ; Sun, 03 Oct 2021 20:45:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=MD1Ovu6CmQP6B72WGh9ws7fOReBBUvqaSS5N4RQ4tkXf22/uZwW65w+5iglUZqwJYE VZhKdIUGNuSdVEShu/ZeHyOdfKKJWvoM8lV7ssxNC1i0nu9eYmdeW29ShuCjVi9TJBnV qf935cAKC3VVSZ6zy2viz7FS3SiV/0TDDvwG7EFgv6Hej/5Z1lAVTq2FhES6rdj8eSJK t75cfqwPkM5mIwTdx6xtY2+Ay4AFC6ECtdjDBLOH5QwiRFOnvwcffnQXrD3U9IkMnDUy qUjZFf14zd/GP3dRkD0dkzMHOifIh4fsURllhdv9XDNf0lI4XBDa7441iYa+kv4GCF6m 6/Vw== 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=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=DHPXpld0jYyBHrhHXvMA2/HsyUc2DbphcYZpfIqLhK9XsRpCOrk+7LIWzaaJzGH/fk K+hRn2waOO4k/h25Ta41qSptwkvFGaGGnD+N3Q21VxgCEaRXG7FKtCSpkKxr3m/Lao5u vHccbTfkpFujE0BCbclaIhM+r5szpGLuUrQDhFU1N26xyeXYRGVMKEEmQzsQzFk2kv4r ohoqIPfDgSklXooLEytLCEX/bCzgMkufAnzIjBRUJJXzJBctPbrthGDxW2Akfvkmq6GK hzeKiY16s80v74qG346ycrDTk8Ww6yYglJ7Fz2seFhWxqNq1VbnRK0dtI5G2NNZ7XxMl 0J7Q== X-Gm-Message-State: AOAM533XpG5og6Jplk8kgIolZfqdMiE2MvLBpyOMQedhd97sl1k4QRYp X5qr+xxmKGcc19VBZvuUF2/KdQ== X-Received: by 2002:a17:90b:1649:: with SMTP id il9mr34807018pjb.206.1633319109799; Sun, 03 Oct 2021 20:45:09 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:09 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 02/22] scsi: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:10 +0900 Message-Id: <20211004034430.41355-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time a scsi bus/port is scanned and a new block device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/scsi/scsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.33.0 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d93d24192853..4865b5a86fd5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -595,6 +595,16 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) ata_swap_buf_le16((u16 *)&bdesc->revision, sizeof(bd.revision) / 2); } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + ret = device_unbind(bdev); + + return ret; + } + if (verbose) { printf(" Device %d: ", bdesc->devnum); dev_print(bdesc); From patchwork Mon Oct 4 03:44:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515131 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061849imy; Sun, 3 Oct 2021 20:45:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7EnNF0iXC49wcuftw2YWP1SavPPnfVcSTxjTGoMxhFlMUq/KXMJIp1lXJb4CHYP8ngU0/ X-Received: by 2002:a17:906:2441:: with SMTP id a1mr14605738ejb.414.1633319131792; Sun, 03 Oct 2021 20:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319131; cv=none; d=google.com; s=arc-20160816; b=IMp3EgMvCF0iUjG+BVFBPz1sm0JSAmxhP9viOApWzXWOFiC+HJ0zuNeJPprX3XHZDu gJ51BY5l/ucDa6NmMxGGhetBf2EmKco1Q66PQNYrJl1EB5LsU7EVbr7K2NpBKtaloxkG LZkbAomjlXbM3YjLJc9zh13jbIlg55sW52uOmGPbILc7NcmOGOtBo2003odoxPy1NrR4 EktJ5cbGYXcTTJS6EPmlMW+6iV+KBxm3cafk50ZXvE7sMJG28RowyBcYUv24bDMlphGN Eup5y/ltW+G5qxeLVjxrkObO7g5fbAIaSUOFLvEZbvFzcjolmdG94WjwVt5IJHZG1mWw OujQ== 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=z/s8T5Z2+8B0u0/BcispJFM9kCTqYbxHAZfCLDDXxgk=; b=nClQ4n+VQszijrVViApLSw8GWeLF8dnBOHZ3TW/m4wcCsUYhPb7yYbE/Ah1YXMAmW+ xlJpA8PfIiDNpDYZdisyX0Fp82YTmCBNOaZre4Zsnkqq2U9O38F7u3Q7oomRU3w2Ithd /utVeGHq6ABTADBRt2x5xIsom2TlXPRNw3brgslv+i2Acwe10MCfg+E4qWvTAiuSoExk HE4xYxjnEruaw90VOKz63cg+e1zhDJJ7+dfxp+znhEwWrzHIzXbjp/tcB3jJpot3GgqE Y7Lzb/U9+3B9bJTgAN01j2Q+MzuLxoWiy3k1Gs+6Q1Icyvt1HzyPTsPzBG5TrcmjZHs8 bwyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e4Zl2TxM; 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 kg28si13239360ejc.418.2021.10.03.20.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:31 -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=e4Zl2TxM; 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 018248353B; Mon, 4 Oct 2021 05:45:24 +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="e4Zl2TxM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B320483556; Mon, 4 Oct 2021 05:45:20 +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-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 03F188352D for ; Mon, 4 Oct 2021 05:45:16 +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-pg1-x52a.google.com with SMTP id g184so15265547pgc.6 for ; Sun, 03 Oct 2021 20:45:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=z/s8T5Z2+8B0u0/BcispJFM9kCTqYbxHAZfCLDDXxgk=; b=e4Zl2TxMtRrs+7x8mbUHzYUIH68hnfH7PxW6D9VNZxdqaBDk6NHwdORI6wVFm5nrRM iERSKFNSyO74hjRBKm7syLCvVT/z02MUYIc7yc32sVaCcZxWIyt3XnhGpTUa3UV00n7R p1N+hUH9q7x9VJTJCZgD6O0Cg7w7lx/TEY2u6tTRAHBFqEtbEg2jJ9XIrLSb/ok4LCtX lhTPtAtR00Na3GlPadhYr6hnVTUHCG2+7t8T2cNn67pRd7v9GyrWjoQ7BTgNp3d/Fk0t B0hv5mKSCW4gq8HwABt6EAcK3y+YtHKEyfC8k5W2Fjixf3jUlsfpgf29dVJgkROnS8s0 +jSg== 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=z/s8T5Z2+8B0u0/BcispJFM9kCTqYbxHAZfCLDDXxgk=; b=d28ENIcuZ4bkaE5ooWssz2nfTDc40dgAz48MqrDddZcDc7lEwOx0Tik7IhbZ8S+ZRc uTC0Yd5L3wSl3pNSLVqEZ92H6fUXR8C3Zh0f/tR4tO9UTWUsDF/2xcXsdgs60tVye3Ks kv/JfySZxnadN8OltiF/Inxuhub6lTQ3OYwFSuQ3Yho/0AbJwzfoSgw/kxmAfVQLOLpU AmcoX7LnTD13kMEo+3Ap5WNP1PvCsaFLnnpD8MJlB7mT88L2nU7rUpBlblU15QmdWwCM JRP7vX6MCxbiN+8sX3UXYtJW9qwB7evFwKDUCkhSVU+SQGI8+M8eG5gzDGFhcJc3wsmL w28w== X-Gm-Message-State: AOAM532x0ompjOJ4cxsDFJxUTSqc3g4sDkyPxdp1XImpMjyfvdKrstb0 qTcGnWO4cvQowTfU6nGUvksB6A== X-Received: by 2002:a63:e446:: with SMTP id i6mr9223502pgk.288.1633319114372; Sun, 03 Oct 2021 20:45:14 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:13 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 03/22] usb: storage: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:11 +0900 Message-Id: <20211004034430.41355-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time a usb bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- common/usb_storage.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.33.0 diff --git a/common/usb_storage.c b/common/usb_storage.c index 946c6b2b323a..5f294f17491f 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -239,6 +239,12 @@ static int usb_stor_probe_device(struct usb_device *udev) if (ret) return ret; } + + ret = device_probe(dev); + if (ret) { + device_unbind(dev); + return ret; + } } #else /* We don't have space to even probe if we hit the maximum */ From patchwork Mon Oct 4 03:44:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515132 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061900imy; Sun, 3 Oct 2021 20:45:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDazIkSOC/m7ip/+yfDxhmrfjHqxe/DTxxGuOjPFvmaszsfV1PCVsm4aHOFQLgCx7yqFtl X-Received: by 2002:a05:6402:450:: with SMTP id p16mr15408100edw.162.1633319142529; Sun, 03 Oct 2021 20:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319142; cv=none; d=google.com; s=arc-20160816; b=eMOnoR1i5+oTEm8GyLRSs9GliKmBt+l1+hHJr4Y0u8tjT+1RMNOPN6l7wVBcqfI8gS VGUwfdcFAvDHg+7whYiIRaW0HhLcjsUjaQ9bvkGJ3kg8vABfDs9vYXl+wVlyj5K6eImI KWwQpUFydyLw9xDhj++NsP12jU0u/O7Gbv2gnVURI+YLKJ5n5O/rp99ixq6CfMh5gUjG eM1WRqq++pWS68GohUK4oRl4UhZJ+N7lK7zuIxWmScR7zCYqbutnkHPbWzJ0TTHkClA5 UKxkfGsgcKCKWe0rFBf3bM0aStz1ts7u+XjpH+RNayF6plxdvoLWchK9+SY9kHmh7jd7 QfrQ== 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=7OKUttBQihWNcWyMidD1s3fR2TfffMDvW/RIGoolU3A=; b=Nd4Tp/FidhKvPL6K3uzKnGhLancxXx9Kqwe4DhkvuhZWIVQLgCRP4DQGLvug8JiXpT tu18KNvapUSCh4OY+nJUmkSxHHxvOqPFKmaqRX95DA31OYwLmwR8A0B2ol4LvXv5vwa8 PPbDhdooC0DHTk4Zh9BaoDAHfS5Gn5kAtridRXVm8sf6RYhxF9koJSmKXpsLYeIYWb1r WshCzLSmSAaxDH5I08Gain2pPN9HpiWBBeQGrBNZZtxnvl8LOQnAkOQzHFT/yKju12pO UDgBgmNJ2Ktl9jSEs4i31zcKRVIVcT61nNbjOzaXTh8z2fPXYbE8RLlnDnjdxUC6ERP5 SX/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yhx2jSJK; 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 rh9si19359378ejb.521.2021.10.03.20.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45: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=Yhx2jSJK; 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 5F4428355C; Mon, 4 Oct 2021 05:45:29 +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="Yhx2jSJK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86BE583560; Mon, 4 Oct 2021 05:45:25 +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-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (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 109D283530 for ; Mon, 4 Oct 2021 05:45:20 +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-pg1-x52c.google.com with SMTP id r2so15237585pgl.10 for ; Sun, 03 Oct 2021 20:45:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7OKUttBQihWNcWyMidD1s3fR2TfffMDvW/RIGoolU3A=; b=Yhx2jSJKmbpYi2oS+viwoKgQrnp1ooYfwa9xn8p5P7egTmV/oEY08qatmdjcIoxxCE yZGWrmdbNcP5ou2fAw/I0orLNWm6RJf2+URexuP82W67lGFlqRtYCfR6P4aeI98Er5Sz PmbwwPthLirH3EtcWSggCgHNEurF/kItjAJ2XL/P+Zo/bNBy35njD2Mx1UHE8gkNmPFC r8A2HXN9dvtIGlBK3FXg5BM7wYRlpK7DLlT8shte0UXsX+jGq95LH0rPMf4DtEN6hbKK rqHVtq/ksjXGjfmvVGPtFjYLKf3Og6sI9/ZhboUqqUsnlTRArJ1ethwjrWAireODvCDp +AUA== 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=7OKUttBQihWNcWyMidD1s3fR2TfffMDvW/RIGoolU3A=; b=BjjXLeqXPFYWA1Ejj4tLDZc5F+kCtTfENtOF683ay8pca0cdsi8YX5u6Skik0xzD4b aa1jEZp/GVBe+e3DeXgUPAGEEmx4j+swkPFA8bbtokKULqlk+gF2uxfvW4lC8GoVpnr5 Cjp089EuYvcnLLEfbcuLSsTBjfz07KyKWqsknAvSRwsjEJlZugDITJLjfHC0ICBKAJAC gt9FkHTMIIiZsERolNuCsIWc3kraeoRB0Mvo8X6pNZ9DCmde3WQM81YZreICCHY5ovrd 36sw0JaCNUlCb035VJ3QRaFDpA80DiwDHxac28lvQE0NZs3xagW2mzkMWRtimz2zMhtG 7gcA== X-Gm-Message-State: AOAM530JxIB/Ib1O6K9nu8vq4k4VuZdqA5yC55SsZ+uIs89EZVYlCoNZ LgCHc5rHFIsHICPtdPGL0hNSeQ== X-Received: by 2002:a63:e24b:: with SMTP id y11mr8885346pgj.452.1633319118461; Sun, 03 Oct 2021 20:45:18 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:17 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 04/22] mmc: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:12 +0900 Message-Id: <20211004034430.41355-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time a mmc bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/mmc/mmc-uclass.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.33.0 diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 3ee92d03ca23..07b5c1736439 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -418,6 +418,13 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) bdesc->part_type = cfg->part_type; mmc->dev = dev; mmc->user_speed_mode = MMC_MODES_END; + + ret = device_probe(dev); + if (ret) { + device_unbind(dev); + return ret; + } + return 0; } From patchwork Mon Oct 4 03:44:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515133 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061958imy; Sun, 3 Oct 2021 20:45:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo3L/i1J6DYNbhtU8nfar4diDSehI47qxkGnmkhTCZ/kgS+rALvDszJeALqZF/5qlh5pDF X-Received: by 2002:a50:e04e:: with SMTP id g14mr16021720edl.168.1633319153084; Sun, 03 Oct 2021 20:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319153; cv=none; d=google.com; s=arc-20160816; b=HkC65vDlZP5Sr7L0i6Vwmg2RUe6ZxTwKUUZD6I3oLYkuWg+Kfhdjl3OndINUiANTN/ WZdjsSus52Iw2Ed5dRmD4nB0Q0tvQLDaGkxJNEDkNrBR0xOjQ71oZoas0KuH9cFROs9Z 5Vn/qlyka1BbEXawOz3ILoFvyyLYLoX63lxicNarXuqomiFN8FRiILXug02BJYbrmhj4 mclqE8dj2uemOshn1UI8tFduAYnsNLS1FpIv3mPvNw/nCvXS85G2/jZr616PWCLo4GD/ ypjM+vZsvYr4cTnpJvN3zbRFztX5/V0P1FZAy2m/1mqQt4iOxKKb6q6WFaCuVYn6E9KH B5Ig== 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=O9pL0Hmq9ZA289/TrCWhV3wB8eKqhp6uxXQgYO+xSj0=; b=INtt+fdMi8fu6iSrbqXqRyTJ13qKdWpz9pJVxw5vcnImd86HIw98lhGYW8NKTAdS8i bqDetn44qoAQKrfeY0GLZIWdkeBoDHH8ACEK/Yp+TRrMxzue4naf9TA6kU1lIuPstjNO 8enjrQk6nvKFuszETIQ4Fo9akbDxxwgSwAYKZIVVp7hGHTakNmX3wdVdpw/fqA0N0xnL Dy04f8dVRee5hBX2M0gE8Msv8T8vsqLn+4CyWoPP10rLJ0fFoWtAUmIAzU433b+FCB/4 Ds5uk9jWIeUX3EpTSV6wS89OLuE8Z0Tj0NXhmj4gnaFer17Wi11466FmvNLwmymx4uve S0Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="N/JHdGTJ"; 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 d15si15254314edj.560.2021.10.03.20.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:53 -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="N/JHdGTJ"; 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 A0B0D8355E; Mon, 4 Oct 2021 05:45: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=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="N/JHdGTJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BBA9683539; Mon, 4 Oct 2021 05:45:28 +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-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 8A3808355B for ; Mon, 4 Oct 2021 05:45:24 +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-x432.google.com with SMTP id m26so74714pff.3 for ; Sun, 03 Oct 2021 20:45:24 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=O9pL0Hmq9ZA289/TrCWhV3wB8eKqhp6uxXQgYO+xSj0=; b=N/JHdGTJEMYUcFzW/YLVPfzYu5BB+Ckzf8I61fgs2gFKEZTLm/fAN0fcbaCg8nEJ1r 8st5pnYLVsdpaArldbiBGhYA7k6f0rdxOFlmJcdK13tnRXiOaKQnwPCHLJLtf3RP8IXX CkdvIfBQQa5Vb7jMzmzFwsJQwuOrGysUIKz0fzGj2bgLhymYjcsPbrTWTAaJfFBxYLr7 tlGyVpwbbNx7wlTxGDLQj9g2GcJyoQALfhB2dF/wxUauVNQxKpEK4UmALBB6XSvfJeLs iJ3XHINPVKPI6ffBQL82cCGTQeveDZNpT30KLzWPti64Nzsba/+9PA1DFjh033U8ntV3 LxSw== 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=O9pL0Hmq9ZA289/TrCWhV3wB8eKqhp6uxXQgYO+xSj0=; b=1+9pW0Q4qRpZtHiKNgZu62wiiwtZSwEkh5DSqtrjlYA7Vplsg6MBJb9uKGXWiTUO57 vUBdM7xFy4VA2YtZ0WwINTv32lmZlJAj4grJFzEfzA4RyN46b+O9sK+F2gNLpRP54b8W m91pm3n4c841PBixfsoMTsLYQrT6PkALabkz0+wEB2PJtFuWh7HUQGjHiMLCOKvbpEuu n8sVZYBs5bg3KR0KmpP9aJFt1uq29Djfgt+kBT8kw+O+a0+d4S1Gxj1eJU5VimgRA+Je UBnUBEVndKhdKv4AZgpcPkNs60uAnkAxt/Zv/xRWjUz793pcxTnwPOyuA5wLS2XXL8t7 Ptlg== X-Gm-Message-State: AOAM533dqVGPgjIpl1vFO8mLwNnzyRm4K9Uu/lJ/dAh6lbU+I9+vWQgA //L5v+KU//X47qq+/Sr04BJ6uA== X-Received: by 2002:a63:4d20:: with SMTP id a32mr9012153pgb.247.1633319122906; Sun, 03 Oct 2021 20:45:22 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:22 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 05/22] nvme: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:13 +0900 Message-Id: <20211004034430.41355-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time a nvme bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/nvme/nvme.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.33.0 diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index f6465ea7f482..975bbc6dc3b7 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -909,6 +909,12 @@ static int nvme_probe(struct udevice *udev) -1, 512, 0, &ns_udev); if (ret) goto free_id; + + ret = device_probe(ns_udev); + if (ret) { + device_unbind(ns_udev); + goto free_id; + } } free(id); From patchwork Mon Oct 4 03:44:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515134 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062039imy; Sun, 3 Oct 2021 20:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytZe+QKN6T6hd17PsdVN2D49+4QrsBuu7YyxL5oxe3lc1jkeM24WalKaTattcHIuU+wTCh X-Received: by 2002:a17:906:1405:: with SMTP id p5mr14581852ejc.197.1633319165616; Sun, 03 Oct 2021 20:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319165; cv=none; d=google.com; s=arc-20160816; b=LVCpkbKGRQ1vSAgH97ckmbjJlF2g2k8IPrAkofiJlEcUdhdKZVK/kLMACbBDZ1Ie3Y eqSCcd+ig6g3+gPquomxDHGn1uTIjxkaFVuE+HqxApBXvaQMhESDhmZtSSUEGXbXNta4 pgnzlhfS+z8GfHacS0E0An8bLf8SEJFhoqLYz72TNLgAkee2vfZ12vjl6XIpoRKRvyvz rWyaJj7ivZgicTjGS0VQutMbjxTd+UsrVnzVMdYUqxPcFSY1H5tdSaVx6cuJFlWOIldF 4tG/bfNEtj7+ac50rVredzMQ8MoSbKPSnHaxsNwW1+HHVeQjbK6ULxTO7cZwSFdh/Eq6 Ltkg== 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=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=hTQZP0zGzDOXpv9MmGmnYy+69vLzI1CpzsuDhJQ4rIeovleYBdGncPCZuOldJsTFKD ymdjB//+HiHx8zMn9Kr3JzLbClJeqYMoSG+wZupNjM7OwPYQc8rd3920GT/zgbLLaYmG ZRH2pFx7oJjOm5/65JR1Mg5JR150hBPhdWBWKxvHwuTdllpeTDGzrj70hYz4/R2erolm C3hrILDod2Yy+chCAKKQ1crtoSDdSj/ne5AWlMAOXZIzy+8BuhpewnkjOC7lMkHdYziy eRlaf2QF7B0glOAhyagGePS7EQPR+izI1R4NZTsolDPyJs9K948eR7JqwYH65ZJf+Pjw XIYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hoV6GEw9; 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 v7si15948473ejv.617.2021.10.03.20.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:05 -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=hoV6GEw9; 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 1B2388356B; Mon, 4 Oct 2021 05:45:40 +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="hoV6GEw9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51A6383539; Mon, 4 Oct 2021 05:45:35 +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-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 0C16383548 for ; Mon, 4 Oct 2021 05:45:29 +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-pj1-x102d.google.com with SMTP id np13so574364pjb.4 for ; Sun, 03 Oct 2021 20:45:28 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=hoV6GEw9g64DFbUQpXkjti4vlIImoNQnbaKZMFsy7gkVR+/4X753dBh4wktrmcdCUU STY+i/oAWXteVtSwoigIVTZXKicGU/63XEhTOKFBBvcPaLzc5c+hY56kYKYpeloC9ct0 pV6nsBZTaLihqqkMbBUSTjHObqGMH67vtqWdrqluWuT73bkmVfoWgCV1hcqtw5DwA4BY nsFF2QRuOpUA986nqb9UDeKY8jaGXI7PfJ6GHvpou/YkOVtcsF0Zx0ugNGTOnXtvb0T4 KZYorJ66maXRBDB0r7t/igj9Z4XwfJJ9FA3fg6DK7knRYb9mLI7J3tJXSLeGP1hbKaxx FWSA== 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=EL336uyh2Wq+du+/ndTOu1d16trooYDoY1Ve8/nVEUo=; b=UNGeMx1Xfn+s7vFBtdOu7AuUQQViWu+5VzzKs1Nq6UtO3k9+Ht7Elmgy7zOBOcGPz4 1vPAzsqZklYqETDve7pJAEUqyKrlsLBBfgquGgb8iMJL1tXKWsBIuOCzsnFqzk/KDIgk 7k8JGCRLxrGWyipMJvl0EkVilcPmWN9XqWceX6pa/lMqAWAt2YuzHmI0uYecOckGOtSa I4y0wsj/rv51tUV0mrNy4CHcIDFJ6Py6AJuiAtKO7vlErfcByI5sfPn7koGybW/Qlt6x M9yjY4xI9gaWLmKyBo4krB4d4gLYJJ5hjsqsrvm5fhWJeIRKwKScD9dWZZY/xeEyuUgw KYFA== X-Gm-Message-State: AOAM532DArB/0if5mU2+VgIQKN2tm7aYW5zsCkbpD2XrTUEgMV6VbogV Vqdr2I/GHA7n2EW4PURkB/lADw== X-Received: by 2002:a17:902:d2c6:b0:13e:9bc9:1ae3 with SMTP id n6-20020a170902d2c600b0013e9bc91ae3mr9520610plc.87.1633319127374; Sun, 03 Oct 2021 20:45:27 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:26 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 06/22] sata: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:14 +0900 Message-Id: <20211004034430.41355-7-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time a sata bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/ata/dwc_ahsata.c | 10 ++++++++++ drivers/ata/fsl_sata.c | 11 +++++++++++ drivers/ata/sata_mv.c | 9 +++++++++ drivers/ata/sata_sil.c | 12 ++++++++++++ 4 files changed, 42 insertions(+) -- 2.33.0 diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index 6d42548087b3..6a51c70d1170 100644 --- a/drivers/ata/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c @@ -1026,6 +1026,16 @@ int dwc_ahsata_scan(struct udevice *dev) return ret; } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + device_unbind(bdev); + + return ret; + } + return 0; } diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c index e44db0a37458..346e9298b4c5 100644 --- a/drivers/ata/fsl_sata.c +++ b/drivers/ata/fsl_sata.c @@ -982,6 +982,17 @@ static int fsl_ata_probe(struct udevice *dev) failed_number++; continue; } + + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + ret = fsl_unbind_device(blk); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == nr_ports) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 003222d47be6..09b735779ebf 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -1099,6 +1099,15 @@ static int sata_mv_probe(struct udevice *dev) continue; } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + device_unbind(bdev); + continue; + } + /* If we got here, the current SATA port was probed * successfully, so set the probe status to successful. */ diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index dda712f42cb2..295f7ca72303 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c @@ -864,6 +864,18 @@ static int sil_pci_probe(struct udevice *dev) failed_number++; continue; } + + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + ret = sil_unbind_device(blk); + device_unbind(bdev); + if (ret) + return ret; + + failed_number++; + continue; + } } if (failed_number == sata_info.maxport) From patchwork Mon Oct 4 03:44:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515135 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062108imy; Sun, 3 Oct 2021 20:46:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuk90gExwjOEoWjhm2beYBmgI8Urz7BVuAJcvEjkuG7rtTVhcqOzpKKBe/+bwziN1aItaL X-Received: by 2002:a17:906:3fd7:: with SMTP id k23mr14507581ejj.176.1633319178446; Sun, 03 Oct 2021 20:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319178; cv=none; d=google.com; s=arc-20160816; b=Cpxc4lY/zl12EmHDOYr8sDnvks/xnPv1tc8mRkF+wItgxc3WgMcdXoMQYUXbAiXYIP gw/m79lIrWWIfi0d30+0E2uFSN8Etmm+/lPaphTCm2JunIG3rwvcigB7W5Q+Jsk0I13H n/yapVLl0yu8OKXEk+4pkRbG+CXglDn2GKM+O9Lv3pG+uJfIkWji7Lj4jG7650MlkQoY jiGEwKZMKIMkWHZoUK+nTBtn/oAJO3AtFBKprQ7PXV9FlHxqogWB+zdshaSdUORIFJpy NxLvPUOm+2wxljeyM3usvcCNo4I7lZoeQLR1StW0nd4IwX9HBJkw+69VFQLCHsl2xqgc WvcQ== 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=DUqHk6GqAD3KhgmdEMlQyPoaCBbyBnak6/KyeiOBA7Q=; b=UE/jyUCiSpAGBNK5JgVt/PHMjUKl53qqj9KMtvnTs2SHRVWRPyDYy+Hclxi5qmSta6 g3hDAcJ0iYYiMSXpmN39sTYE0b22WlA/XrpdkW0/tqAJE4LOmQ4nJ4ss9F5Y667O42UJ QzrFAbPAWoYlfzODwwf0601/oHv/U8JAdSxkARi5M8Boioj3iK/PTVupWbbrlKmTNKAq q/jWsliBHMHGQJ8M/7ERDBLbcVFUPHUSrywSy6ixH3cVJgqqNjy1vIfhKP7QbmRW5+bp EDvoIKzOeEcKhyhl9ZsyQd/b6oENE0B5Rsp902GbeUnv2qaxsKGV/gfJkUyF218S36f5 JqlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KyA3uNxY; 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 v18si17917723ejh.182.2021.10.03.20.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:18 -0700 (PDT) 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=KyA3uNxY; 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 CA14883560; Mon, 4 Oct 2021 05:45:49 +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="KyA3uNxY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D17883569; Mon, 4 Oct 2021 05:45:41 +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-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (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 896158355B for ; Mon, 4 Oct 2021 05:45:35 +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-pg1-x52f.google.com with SMTP id a73so12323140pge.0 for ; Sun, 03 Oct 2021 20:45:35 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=DUqHk6GqAD3KhgmdEMlQyPoaCBbyBnak6/KyeiOBA7Q=; b=KyA3uNxYJ870QIdghviXd4sCHTLPYXSVjQUK0I1eCrtOMRJJ3r384QOgeHLCCaMIm6 d8WUcTdMOeYztdg//BPXHBIWii8PMksxllftLUZwFEEOtnXqnuhosdE4F/+a+Pe/Nr56 zDaFhNWD5OV0RHa9729D3Yx6I3p9BD1BVxkUHHBQh4x2mIlf5CKakS3ZT2U51VW0EJGf aD922Ut+RM9QJ5ENEHQ6ujtb/nAZo1Dc5sL/swlayySo+cRkrEk4GvsCWm+yN0MAEwZR NqCbhPP5YTD1VsNJUSacEUWL4U80WLyrRHlCLPXta5geY3EvGxqh27dmi5A6MYl1Csmi udDQ== 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=DUqHk6GqAD3KhgmdEMlQyPoaCBbyBnak6/KyeiOBA7Q=; b=EShTy11O32iUGswOVaLHT7Ee+7JaB4ioSuNIQ6DApVtQ3bFY1y4qum3vF3NPcpUiha jpRu4+py5Fum2RFnUHxUCaNtQiLX4MNctq9tLrviD8YB8HF8mrcfo1IUxbaNoiDCKkuL aG4RFgcXUZmkq8/ybOCqiNL84vZu29TmSRsaCytsPTnx9ok5wHMjrK1cZg2gP1IGUKhU Ym23FxluyQPhqwH1ggrz3MfiQ7QYkzdXD87LsUzgXkybBoHBEgAvycEoiwr954ZLuViJ IPQhaYnX+RTuioarnWzKiTnGHL8OsGfVNQPcrbAbnSc7FhjdnVOWiMkBjHKrteAcHvUb 7X2w== X-Gm-Message-State: AOAM532y4+L1KXz7YHxrBnCQJDkiq/UFJUSr+CguGotvRCLQhjRG+xf2 qVpI2c/U/hoGlwDkEWTxVySYyA== X-Received: by 2002:a63:740e:: with SMTP id p14mr8751457pgc.329.1633319133890; Sun, 03 Oct 2021 20:45:33 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:33 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 07/22] block: ide: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:15 +0900 Message-Id: <20211004034430.41355-8-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Every time an ide bus/port is scanned and a new device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/block/ide.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.33.0 diff --git a/drivers/block/ide.c b/drivers/block/ide.c index c99076c6f45d..31aaed09ab70 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1151,6 +1151,12 @@ static int ide_probe(struct udevice *udev) blksz, size, &blk_dev); if (ret) return ret; + + ret = device_probe(blk_dev); + if (ret) { + device_unbind(blk_dev); + return ret; + } } } From patchwork Mon Oct 4 03:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515136 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062194imy; Sun, 3 Oct 2021 20:46:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQzRpzfeYfdDUQqil7KR7vpMj4tHm4YAw5l0MG95CKrYiSrHrqml6J/HzJzg3U0zThu7hN X-Received: by 2002:a17:906:713:: with SMTP id y19mr14702619ejb.506.1633319197317; Sun, 03 Oct 2021 20:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319197; cv=none; d=google.com; s=arc-20160816; b=PpgUDufCUUWPTPzLijS/EjDKHDfMyeV8t0oiH8R6KBkHQOiYMBfxKcHOP71d7rOvat aiga4WuQnQDiapQ4g2TszRdyFaecy+seT8wt0M/GHkDklVH6cggAD3HCaGPxh6XbaM3l 1eQli5BeP+z8JYDXXnLNU6OciHRYS5w1c2/Bcsc3LuLoTFGPjtoaTtsSIVOaLHi652Pz drGf22ZYoHq3hEfZSYYP7PD6BNv1Db3nDLOhmNUFj7Q+Z4hfRGYA5e7kBAiNYGhcRyoI Jw9Q+M7naoMokKJ0q6pleTEqvB4N6r5+35FHILPHsS4AdmwbS5wo7WP2g7QZ6GH15qL0 ZXiw== 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=xNd/2bFfKjwaY5xV+8Y8nucr8xmVq9A0zVABHGaXLyA=; b=NSHdhC2NKOvM7AHD9jnT2pcn7/7ZrD/X9O+MOK2kw/NNBvdAZJp8M1Z7+15XLThDSv EpNMWgfzxFNDfsPcSw5CczfhAXYxZiXUo8slX6IZOM/n0y/Rbjbs3D7eWKkU2WsW6Hy/ 2FsBB2qg7KP+JQz44sjmW7oSzGerGApHjgC9K6ro3W/0O3UoxLtFmxuL3Ui6t6sELWkv hhvbr4mPn25XvQ4+6YG9YvaqdFxdWH40Jah9eroVo+YXyJk+nxNhmOSahmRfY+PlmihI Wcb3h5K34ag8U1I9UvQ8S6k5X7NvGDGuWfBgGVXKpBrsA10MjCo8u5L10jI8XIH4j9CF gCzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PkFO9oip; 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 d10si17101331edn.269.2021.10.03.20.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:37 -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=PkFO9oip; 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 C021383586; Mon, 4 Oct 2021 05:46:05 +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="PkFO9oip"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F33B483577; Mon, 4 Oct 2021 05:45:51 +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-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 C23C58356D for ; Mon, 4 Oct 2021 05:45:40 +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-pj1-x102a.google.com with SMTP id np13so574571pjb.4 for ; Sun, 03 Oct 2021 20:45:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=xNd/2bFfKjwaY5xV+8Y8nucr8xmVq9A0zVABHGaXLyA=; b=PkFO9oip2AwhRyMTl5KsAZL2BvIPVGvDZnKd5V7JyFwcX74WgNqOFUYpw3Xy7oZhRW Wy/WTdQNmi7P3+JbKXoNr0+vipEhXk8JdalsNvRsWrZtDLMd34rh9CyHHCCaWCU6u7DD HZOHKys3+xP5NQbvg5NS9qAOrtetnpeBZuJbRUPBxMJYsb9J4UkUmlV+seFHwC6mD9dK tZD95PmmPjURQCE0WbM60pRQvEXndU98C9TOv1AREUjFDKNjqaf+jjuzgIwqxwhMS1Ly 8/gsSOpqBf1zkbO9GISNQPgrpwnVd4Kn0TXXsO7Be1GeABCu3xAP45uLgckUr4MozwIB dhsg== 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=xNd/2bFfKjwaY5xV+8Y8nucr8xmVq9A0zVABHGaXLyA=; b=TdfrKv82eKCL9sQV/tjJNoGigqMKU5+Iv1grYK2Q2h5Gm9+gsC5LoRlYfMuyemIhqE aiEKRY5T0SV9mbAJk4Ucq23kueMorE1xLg5S8fKa3rU7K81W3i1Q2FFbCUQde52XBLoa OuxBcqqu20o0d1w4uUyCGGJhP9tg6f/mkmnb/l/lcLyrcZpjo9zsxHNjpda3kOqMlFnO 0HJ1TXLwvXmnpc5qGzasCi0B7lZYI+qdQyvfH/BfwQY6nW1Hatk7EaludsJqhdilOERb qoI1gJa3/2aOg0B1xnE2QcV+4U4kJZT3kU7EenvpmdCcPIp5zMyeqJFAOkkEV/kyiKa0 j1sg== X-Gm-Message-State: AOAM531uKTCak7LoZ3kd6jOVc0EmrupX8OxIPP5nwELGGTOWklhpWQD3 0gJAgjgIDZs5f+XHDosHalc9zw== X-Received: by 2002:a17:90b:14cd:: with SMTP id jz13mr15759605pjb.192.1633319139073; Sun, 03 Oct 2021 20:45:39 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:38 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 08/22] dm: blk: add UCLASS_PARTITION Date: Mon, 4 Oct 2021 12:44:16 +0900 Message-Id: <20211004034430.41355-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 UCLASS_PARTITION device will be created as a child node of UCLASS_BLK device. Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 111 +++++++++++++++++++++++++++++++++++++ include/blk.h | 9 +++ include/dm/uclass-id.h | 1 + 3 files changed, 121 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 83682dcc181a..dd7f3c0fe31e 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -695,6 +696,44 @@ int blk_unbind_all(int if_type) return 0; } +int blk_create_partitions(struct udevice *parent) +{ + int part, count; + struct blk_desc *desc = dev_get_uclass_plat(parent); + struct disk_partition info; + struct disk_part *part_data; + char devname[32]; + struct udevice *dev; + int ret; + + if (!CONFIG_IS_ENABLED(PARTITIONS) || + !CONFIG_IS_ENABLED(HAVE_BLOCK_DEVICE)) + return 0; + + /* Add devices for each partition */ + for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { + if (part_get_info(desc, part, &info)) + continue; + snprintf(devname, sizeof(devname), "%s:%d", parent->name, + part); + + ret = device_bind_driver(parent, "blk_partition", + strdup(devname), &dev); + if (ret) + return ret; + + part_data = dev_get_uclass_plat(dev); + part_data->partnum = part; + part_data->gpt_part_info = info; + count++; + + device_probe(dev); + } + debug("%s: %d partitions found in %s\n", __func__, count, parent->name); + + return 0; +} + static int blk_post_probe(struct udevice *dev) { if (IS_ENABLED(CONFIG_PARTITIONS) && @@ -713,3 +752,75 @@ UCLASS_DRIVER(blk) = { .post_probe = blk_post_probe, .per_device_plat_auto = sizeof(struct blk_desc), }; + +static ulong blk_part_read(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, void *buffer) +{ + struct udevice *parent; + struct disk_part *part; + const struct blk_ops *ops; + + parent = dev_get_parent(dev); + ops = blk_get_ops(parent); + if (!ops->read) + return -ENOSYS; + + part = dev_get_uclass_plat(dev); + start += part->gpt_part_info.start; + + return ops->read(parent, start, blkcnt, buffer); +} + +static ulong blk_part_write(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, const void *buffer) +{ + struct udevice *parent; + struct disk_part *part; + const struct blk_ops *ops; + + parent = dev_get_parent(dev); + ops = blk_get_ops(parent); + if (!ops->write) + return -ENOSYS; + + part = dev_get_uclass_plat(dev); + start += part->gpt_part_info.start; + + return ops->write(parent, start, blkcnt, buffer); +} + +static ulong blk_part_erase(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt) +{ + struct udevice *parent; + struct disk_part *part; + const struct blk_ops *ops; + + parent = dev_get_parent(dev); + ops = blk_get_ops(parent); + if (!ops->erase) + return -ENOSYS; + + part = dev_get_uclass_plat(dev); + start += part->gpt_part_info.start; + + return ops->erase(parent, start, blkcnt); +} + +static const struct blk_ops blk_part_ops = { + .read = blk_part_read, + .write = blk_part_write, + .erase = blk_part_erase, +}; + +U_BOOT_DRIVER(blk_partition) = { + .name = "blk_partition", + .id = UCLASS_PARTITION, + .ops = &blk_part_ops, +}; + +UCLASS_DRIVER(partition) = { + .id = UCLASS_PARTITION, + .per_device_plat_auto = sizeof(struct disk_part), + .name = "partition", +}; diff --git a/include/blk.h b/include/blk.h index 19bab081c2cd..3d883eb1db64 100644 --- a/include/blk.h +++ b/include/blk.h @@ -366,6 +366,15 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, const char *name, int if_type, int devnum, int blksz, lbaint_t lba, struct udevice **devp); +/** + * blk_create_partitions - Create block devices for disk partitions + * + * Create UCLASS_PARTITION udevices for each of disk partitions in @parent + * + * @parent: Whole disk device + */ +int blk_create_partitions(struct udevice *parent); + /** * blk_unbind_all() - Unbind all device of the given interface type * diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index e7edd409f307..30892d01ce13 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -80,6 +80,7 @@ enum uclass_id { UCLASS_P2SB, /* (x86) Primary-to-Sideband Bus */ UCLASS_PANEL, /* Display panel, such as an LCD */ UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */ + UCLASS_PARTITION, /* Logical disk partition device */ UCLASS_PCH, /* x86 platform controller hub */ UCLASS_PCI, /* PCI bus */ UCLASS_PCI_EP, /* PCI endpoint device */ From patchwork Mon Oct 4 03:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515137 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062254imy; Sun, 3 Oct 2021 20:46:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynRQzaQ0pbb16CRF1wG4LrSQt+Huk5lEiZHSL83qvpBGei9X9aoHbVfShOA2e5LZ7NvSLC X-Received: by 2002:a17:907:7284:: with SMTP id dt4mr14202680ejc.433.1633319209225; Sun, 03 Oct 2021 20:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319209; cv=none; d=google.com; s=arc-20160816; b=fSHXp0DOJc1mGrKsVdalA6udbxl7xynVLhzXhAPUZ/RsCkXuuOqAB0jtl+sSL35uzc A6YAvWN0U3FWetfff9eWyPDylQ8MDSl7Mv2GZjNZa0xNk7z28jCqG2EIQakSFGhCAiGg Uho1KAFld9QDotGIBCPMIPokl/L4q7tQw3iR1AjJWUE10XkNfZSPppjkjdXuRIkMg3LI mcHoymXGwIqaQmSGm8aNlHZh1wP9/RAJYDsMZy3fsdGYq/VVKyvjo20BKDUPK5qD+hQS KlTr67DJ30VciLpU73WDN5PRb1dWCv57ZRm0IZm08vnbjHzamVXUfsomgaXUw6nTRtmh JxOw== 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=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=FmoB+nWf0Q+cbruH2tpnj2Vy3vjhtC6bSzIKf3ZGLORtWNugfmkj3a3y4pgka/BJBr Zxb9msyTeJy2HQMVPOPD/7IpW0Uc4hJPR/L411fuPRYk1eFS3YNVhiJR3RAXGeWe2nK8 +URBUzpBxRtdxbf3wVAO0zSeYrHXFhAHBWPFf3VvMxNbMAW3lUTJEfiVzWx8IiHnR6SQ 9JU4sF8WD+Lvmagr7pQ/eY9ry7lJ0q2a3zB2GmSxD3/geUyK19936W0djzcr/cXtH1Fq /RcRJOEHUSo1Nq9ZEfJkl5QF+VeueHhswEb5PIfqc3yGJf8RrINqOQ5xofhbUm1w+yHt FvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WS55yFiX; 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 j23si19358823eje.21.2021.10.03.20.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:49 -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=WS55yFiX; 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 77B5F8340A; Mon, 4 Oct 2021 05:46:10 +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="WS55yFiX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 96FE383550; Mon, 4 Oct 2021 05:45:53 +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-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 EF3DD8352E for ; Mon, 4 Oct 2021 05:45:45 +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-pj1-x1031.google.com with SMTP id ls18so460943pjb.3 for ; Sun, 03 Oct 2021 20:45:45 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=WS55yFiXit529Za7qZNrD22CikMBIgv2i/UMgFgl0xMYTc00nXjYIMbwQoA/8Nxg7o BlSFbxp5FVPIrvgzuKf5brWqGJeaSfrsmhY5QrMGhojMJXFIQbGl3MesCqma620OG6HI vyTDxa2sDTNpDDdpo/2hYJLeV3FSCLiAGLGAI2AFrLs5QL7qfFAUMZTjq7MMg19zNZ/j mzNM407pxHOSQFIB9OaO+5Rg/Oym2q9oRZ3AtTdXPDk6iD47dn7orN3wV9Qb1gmj7YER b1FOajqfWmFDBttO1ENnT9yn0wZhx/st9UAb+GT/fW3deOpaVtqQ5fhWrDaZn4uFyLcE H7Yg== 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=bmMB/nA9xkBo6ahFeLmZvwsTNZp33CmIqHJrk8Hn7OE=; b=CUb0GTHo6uAf21ziirrjVFCuGFYEW8wECWDWirA/DzXkznDqQBFNWNdWHYF1T8Zty7 6bKVs1bqIyQXB5CGRpoGd5LJsE2hgRRiaWrb2PdCkT6Rr9G4epI9jEIeHa4sKEiq6QlJ 9CB7tzUSDSp4iI6JzggmKMIwU7O0YVpXTvtLzWjgb1Ti7xP2sPpm9JH3Qu2s/IV9NSnV VYmteRRJHUsS7bYLXFFUdOpBUdB25VxrmrTF1HESn/54JVPZIKQMnHe15qX4wS1RYGut KmZtes+TooFPzkvRDwPp0/q91fjRukBVC9L7T26x31+x3R9RdWGalsRuXR5y2lmPBKYa gqKA== X-Gm-Message-State: AOAM531GZgb5ablp+OBXG5DW/JatGkiZMLgUy/jSRxc3E/PRTJzBHXgz iplcY1dfg8J7mnGjFmusBQ3wFw== X-Received: by 2002:a17:902:dacf:b0:13e:ab53:87dc with SMTP id q15-20020a170902dacf00b0013eab5387dcmr7471871plx.78.1633319144287; Sun, 03 Oct 2021 20:45:44 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:43 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 09/22] dm: blk: add a device-probe hook for scanning disk partitions Date: Mon, 4 Oct 2021 12:44:17 +0900 Message-Id: <20211004034430.41355-10-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Now that all the block device drivers have enable a probe hook, we will call blk_create_partitions() to enumerate all the partitions and create associated udevices when a block device is detected. Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index dd7f3c0fe31e..6ba11a8fa7f7 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -741,11 +741,25 @@ static int blk_post_probe(struct udevice *dev) struct blk_desc *desc = dev_get_uclass_plat(dev); part_init(desc); + + if (desc->part_type != PART_TYPE_UNKNOWN && + blk_create_partitions(dev)) + debug("*** creating partitions failed\n"); } return 0; } +static int blk_part_post_probe(struct udevice *dev) +{ + /* + * TODO: + * If we call blk_creat_partitions() here, it would allow for + * "partitions in a partition". + */ + return 0; +} + UCLASS_DRIVER(blk) = { .id = UCLASS_BLK, .name = "blk", @@ -821,6 +835,7 @@ U_BOOT_DRIVER(blk_partition) = { UCLASS_DRIVER(partition) = { .id = UCLASS_PARTITION, + .post_probe = blk_part_post_probe, .per_device_plat_auto = sizeof(struct disk_part), .name = "partition", }; From patchwork Mon Oct 4 03:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515138 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062317imy; Sun, 3 Oct 2021 20:46:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlXxcgqNvwwfY5VSF+2Nkvp11BHFo2XI2bW2+MpeiW+ZIW7tpBtHS4EQnRO900fNGi8J7k X-Received: by 2002:a17:906:51d3:: with SMTP id v19mr14563088ejk.148.1633319219590; Sun, 03 Oct 2021 20:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319219; cv=none; d=google.com; s=arc-20160816; b=FSF0zXKULmHYGV48BHWCLd7uy7MciXMrMoHWYGu8+1XoYVifwQKPEJrmj8wsV0G+VS +rYXAe8jgKhLyAoM0+LFeYl/EKnirvfw9XLpk/XGLajkw1ZrdNyOeGGtb4+ge0l+hUrW 7wMmSptuBuZRSRSy15Rl5WTAJsTI7cq3vLReYwYJ12GEswAbdX7EpR+P9ZNu4tXMoWR3 Pq/01HwOmk9GHMVhCYG87ZwiGw7/10lY3BJBL+erQgrXGUxXTg5y+VIol8TEdgK8nZV1 6VfrPBV87IRYdSbGYzZXhgX3dPU130WizJ97R/ecE6h0mQk39QfzOJcIQ8KBkDuvi4Nu 1CMQ== 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=UhrBaUxpdF9KOEH0VMrJEPB6fFwCE5yYYSjjBkt4tmM=; b=aVhfryM9K8J95YbRsqZoSJ44igitEyGpgTnwLdGI9ZHbpk6lZSqMjpBkE6ixKN9fui ryzgXuJd9fUCT7AENiWrRu5H4TfKGfNg4gITCMtzj37mA7azNYCGjMGCDPZ5LSPk+vMa H5mOjOwfXhtOADDmGCEc6hnYmJPgFIdb9L3JTVwo+h9TW4J+Mjl1NxcWcZbRWdSZQ++A 0ITZtSlWy/o1XYB+maN3eDoywUPH43SPOKhgio0ccPzy0fKyEGK86w35VX9Coc5/QS1n cR1BkeZyEJNXxepRp1xXg4b3P/EdSyNc8w+mDFQ2AZC7R+Y+1yAIFIGV9GVGppKmongA BbwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INJ7wfXw; 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 y15si17447906edj.517.2021.10.03.20.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:59 -0700 (PDT) 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=INJ7wfXw; 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 8CA768357D; Mon, 4 Oct 2021 05:46:15 +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="INJ7wfXw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B0C1F83568; Mon, 4 Oct 2021 05:46:00 +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-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (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 BB4DC83569 for ; Mon, 4 Oct 2021 05:45:50 +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-pg1-x52c.google.com with SMTP id h3so4612618pgb.7 for ; Sun, 03 Oct 2021 20:45:50 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=UhrBaUxpdF9KOEH0VMrJEPB6fFwCE5yYYSjjBkt4tmM=; b=INJ7wfXwTnSPPfay7CV4vJhh4MksEtvnXZPjTqF50NbrvZGp3ELaLyNCosfXmBkGQu QWg12HlRiYY/JVBM34tdShFUS9MGhLiDy++30Jaf3f8ucfKxKOHKtz45TOCjxNwLaWiv oDEd5RUcNYOs2+WN5bynxUoWjKyXN4ZR38w8RqDZ6aXevu3xQ271eqVFgU+sgZUPiSeP ui/y235XaBlGN2n3XrNbmiEAC0UNlFfpo7z2t4tUdaEGsRYdy4JPAv2utAzfCHc1j82J lfcKlzGir9hUUtQG8hgt5J2aB7ETJIkXFHOFd128JRlv9Z62afTzUQRc48ULbE31N+NE Hfbw== 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=UhrBaUxpdF9KOEH0VMrJEPB6fFwCE5yYYSjjBkt4tmM=; b=ZnfK0/0gtCt7CWwbT5gngNGifpYXZ2hbveOZ3mJW0dKH3ad3SEOEQmVmzASZxVkDKW qJ8PMqJw8BJuR6YMqG+/wLMCYN8iStd4e7FzD7O4fXyWV2p2U7Ng67EyW7yxObINjQX5 1FPjsWStg7DRix/MontYh16efU54vA8/0TEHvQs57Opyhj/1+MN/KjRUrD0DRr9RB70l /gB4pK2aSUHfrYPUP+3dCy7qnWpL7vZPpBZoRFiO+ZMVI1FtnF0R86+Qb5K3pQijEqtj C8YE/eR5f3xel9Q5d7owAFoONkSZV/cgUvixXvladKIJkWOpINJCfsLZ0EKKxs7VoIEZ OlOQ== X-Gm-Message-State: AOAM532LBR89x6K5cPwKDQnpqQHF5Xm6gdSX/Pf1xEqq94QdYgle3GLz NDUM4kpH6NfMts5QxLW1Pvt9iw== X-Received: by 2002:aa7:9985:0:b0:44b:de92:f72f with SMTP id k5-20020aa79985000000b0044bde92f72fmr22848484pfh.51.1633319149037; Sun, 03 Oct 2021 20:45:49 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:48 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 10/22] dm: blk: add read/write interfaces with udevice Date: Mon, 4 Oct 2021 12:44:18 +0900 Message-Id: <20211004034430.41355-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 In include/blk.h, Simon suggested: -- 2.33.0 ===> /* * These functions should take struct udevice instead of struct blk_desc, * but this is convenient for migration to driver model. Add a 'd' prefix * to the function operations, so that blk_read(), etc. can be reserved for * functions with the correct arguments. */ unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, void *buffer); unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, const void *buffer); unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt); <=== So new interfaces are provided with this patch. They are expected to be used everywhere in U-Boot at the end. The exceptions are block device drivers, partition drivers and efi_disk which should know details of blk_desc structure. Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 91 ++++++++++++++++++++++++++++++++++++++ include/blk.h | 6 +++ 2 files changed, 97 insertions(+) diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 6ba11a8fa7f7..8fbec8779e1e 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -482,6 +482,97 @@ unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, return ops->erase(dev, start, blkcnt); } +static struct blk_desc *dev_get_blk(struct udevice *dev) +{ + struct blk_desc *block_dev; + + switch (device_get_uclass_id(dev)) { + case UCLASS_BLK: + block_dev = dev_get_uclass_plat(dev); + break; + case UCLASS_PARTITION: + block_dev = dev_get_uclass_plat(dev_get_parent(dev)); + break; + default: + block_dev = NULL; + break; + } + + return block_dev; +} + +unsigned long blk_read(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, void *buffer) +{ + struct blk_desc *block_dev; + const struct blk_ops *ops; + struct disk_part *part; + lbaint_t start_in_disk; + ulong blks_read; + + block_dev = dev_get_blk(dev); + if (!block_dev) + return -ENOSYS; + + ops = blk_get_ops(dev); + if (!ops->read) + return -ENOSYS; + + start_in_disk = start; + if (device_get_uclass_id(dev) == UCLASS_PARTITION) { + part = dev_get_uclass_plat(dev); + start_in_disk += part->gpt_part_info.start; + } + + if (blkcache_read(block_dev->if_type, block_dev->devnum, + start_in_disk, blkcnt, block_dev->blksz, buffer)) + return blkcnt; + blks_read = ops->read(dev, start, blkcnt, buffer); + if (blks_read == blkcnt) + blkcache_fill(block_dev->if_type, block_dev->devnum, + start_in_disk, blkcnt, block_dev->blksz, buffer); + + return blks_read; +} + +unsigned long blk_write(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, const void *buffer) +{ + struct blk_desc *block_dev; + const struct blk_ops *ops; + + block_dev = dev_get_blk(dev); + if (!block_dev) + return -ENOSYS; + + ops = blk_get_ops(dev); + if (!ops->write) + return -ENOSYS; + + blkcache_invalidate(block_dev->if_type, block_dev->devnum); + + return ops->write(dev, start, blkcnt, buffer); +} + +unsigned long blk_erase(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt) +{ + struct blk_desc *block_dev; + const struct blk_ops *ops; + + block_dev = dev_get_blk(dev); + if (!block_dev) + return -ENOSYS; + + ops = blk_get_ops(dev); + if (!ops->erase) + return -ENOSYS; + + blkcache_invalidate(block_dev->if_type, block_dev->devnum); + + return ops->erase(dev, start, blkcnt); +} + int blk_get_from_parent(struct udevice *parent, struct udevice **devp) { struct udevice *dev; diff --git a/include/blk.h b/include/blk.h index 3d883eb1db64..f5fdd6633a09 100644 --- a/include/blk.h +++ b/include/blk.h @@ -284,6 +284,12 @@ unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt); +unsigned long blk_read(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, void *buffer); +unsigned long blk_write(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, const void *buffer); +unsigned long blk_erase(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt); /** * blk_find_device() - Find a block device * From patchwork Mon Oct 4 03:44:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515139 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062372imy; Sun, 3 Oct 2021 20:47:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDyTau4njiF6Abn2OoWp69LnPDCDeKFCHtm+xO3brIq4t1xHFM2x6h5Lfp2GHJEGjHy4ln X-Received: by 2002:a17:906:9b1:: with SMTP id q17mr14250403eje.546.1633319231725; Sun, 03 Oct 2021 20:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319231; cv=none; d=google.com; s=arc-20160816; b=SRK4BArVQ8NkHuKSNo/ddV4Rw2Xnc8bJ7kPovJc5xWZZuymNXIHsNagJNLWY49/FET fwpMOZZeA3q3Gn05IRZdng4t7Fj9A2zy+fnbRwExQncYGwyv8ILb2yKwZuikl4IiOthn n4HxKbBkmwLwNWzRr+NpBlMYGKqw70uiEF3m/EodVMOgaE1YYpdWyHZk6aNEABU6MPyX kf8+9hpKS2vXwZAuWu0bcO8HEF18qv9ekTRpCS8q0kxXKDLcfhzOOqCa3iG4IP2tLWiW uhBkVDnSktHI8C2pDspKvc7bi6CWHchRpRqS5MB7OqpGQK//zgmGWQCjE1++lgCaG2xH I45A== 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=Cm01FoLLgy+Q/VyQX8ktwQ6qmMS34T5N1nWu2qPHuT8=; b=aZcXOZGg4tjVg4UHX01quAK6+3OSKYKcqgxcnA5c8VXQ4a9uFk9wu1uuvEae/snQaL GrPXCrmMtM54XNDPcnTj/NcNVibp6ei4MQwXWnQro9QAPM886QM/yPwBzl0r+E0JWm2x DjvIoS1oAbxIAjD25WzumCvkUyU+SWtDC9XhOhD11D3SsnG3iABPE3gKNJ0ENZtuYCOU twxlxR3FM5xKrS6yQ8pNY31R8lcZx8lAJnkkVgQ36drWZTDhMB1WNN0kwiaVh5jwkb4O 76IN1G2sQoTRCJJT7FAEyksVxZTdhI9jCp2dEFHXAf5WjxuhmcI4Af8pUemfR+ji7Gw4 9btQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZrtP02yt; 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 n13si15426335edo.447.2021.10.03.20.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:47:11 -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=ZrtP02yt; 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 80C328353B; Mon, 4 Oct 2021 05:46:20 +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="ZrtP02yt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 978718358E; Mon, 4 Oct 2021 05:46:09 +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-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 3A0998356F for ; Mon, 4 Oct 2021 05:45:55 +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-x62a.google.com with SMTP id x4so10179161pln.5 for ; Sun, 03 Oct 2021 20:45:55 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cm01FoLLgy+Q/VyQX8ktwQ6qmMS34T5N1nWu2qPHuT8=; b=ZrtP02ytzwr9L1dvHZu4qn3KIG7IFoJLUtlixPRCNTeai3hofr9JpROu1fHAlSGlA4 3rQZjG+z5fy0yoNCJ0MHz3Or0jGKRYkPkzwiEK/8sSSrwm9R8nbzkjan6+1YdBu8mgcN 7ziXjCa8DRlZCcH27CbHqoNv/DekUzS585slBXzlVQ7+x2yqNGu/jjrQN+4IZZdZM54m Zku+NI4QN0XCBfbekyIDEY6qHFY8weMLP9phQ8b6S6yY65itX9Xsqb5QjsZC8gVRsmWJ H/8Zf0oCMo+3L/M/d7QVAIixcIHD5jPHQ7Pp/OQLZ3qI/0+4aKTysE29zorOoRKOFAPb cLVA== 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=Cm01FoLLgy+Q/VyQX8ktwQ6qmMS34T5N1nWu2qPHuT8=; b=O8yLl9Wk8TBktmimOBkjmqBXcbqJwXXZbGRtjPcuwztENPj+BW9QBG+9cuR6KcDvt/ c8QM5BxlcDF6S7Em8k0/zYUZPsARq5Mb5la3ElsjicUY8CzaXwovhspVEyKXB2O5a020 m7yP59C/rB1M9dH3Zvb/xlOd4R5QUtNSt5vsrbz/ZeqY65ZRo47RV/XTBrDxTbV+ZbDg 1HmfH/wWG6W9FzW5T7/DFvGkDPgCjl0uEVIVpiYyZlXXwNiPpwnnROPNjPDZKhod7UWX AWVwy4gZAH3d3kgdGctSVTj167DP9kqrOD+MThosoifrG1zhh52cKpkDLxBqprJ/Vmtz Kq1Q== X-Gm-Message-State: AOAM531AgCgScP3Y2Qhed2sRs/LxpyobgqL5jt7mXTC7N4yqhpesI2rr rIEkggo95k/lcqHYUBoradBs5A== X-Received: by 2002:a17:902:9b88:b0:13e:55b1:2939 with SMTP id y8-20020a1709029b8800b0013e55b12939mr20907817plp.80.1633319153495; Sun, 03 Oct 2021 20:45:53 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:53 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 11/22] efi_loader: disk: use udevice instead of blk_desc Date: Mon, 4 Oct 2021 12:44:19 +0900 Message-Id: <20211004034430.41355-12-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 In most of all usages, we can avoid using blk_desc which is expected to be data private to the device not be accessed outside device drivers. Signed-off-by: AKASHI Takahiro --- lib/efi_loader/efi_disk.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) -- 2.33.0 diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 988907ecb910..dfa6f898d586 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -45,7 +45,7 @@ struct efi_disk_obj { unsigned int part; struct efi_simple_file_system_protocol *volume; lbaint_t offset; - struct blk_desc *desc; + struct udevice *dev; /* TODO: move it to efi_object */ }; /** @@ -80,14 +80,12 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, void *buffer, enum efi_disk_direction direction) { struct efi_disk_obj *diskobj; - struct blk_desc *desc; int blksz; int blocks; unsigned long n; diskobj = container_of(this, struct efi_disk_obj, ops); - desc = (struct blk_desc *) diskobj->desc; - blksz = desc->blksz; + blksz = diskobj->media.block_size; blocks = buffer_size / blksz; lba += diskobj->offset; @@ -99,9 +97,9 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this, return EFI_BAD_BUFFER_SIZE; if (direction == EFI_DISK_READ) - n = blk_dread(desc, lba, blocks, buffer); + n = blk_read(diskobj->dev, lba, blocks, buffer); else - n = blk_dwrite(desc, lba, blocks, buffer); + n = blk_write(diskobj->dev, lba, blocks, buffer); /* We don't do interrupts, so check for timers cooperatively */ efi_timer_check(); @@ -443,7 +441,6 @@ static efi_status_t efi_disk_add_dev( diskobj->ops = block_io_disk_template; diskobj->ifname = if_typename; diskobj->dev_index = dev_index; - diskobj->desc = desc; /* Fill in EFI IO Media info (for read/write callbacks) */ diskobj->media.removable_media = desc->removable; @@ -647,20 +644,22 @@ bool efi_disk_is_system_part(efi_handle_t handle) { struct efi_handler *handler; struct efi_disk_obj *diskobj; - struct disk_partition info; + struct udevice *dev; + struct disk_part *part; efi_status_t ret; - int r; /* check if this is a block device */ ret = efi_search_protocol(handle, &efi_block_io_guid, &handler); if (ret != EFI_SUCCESS) return false; + /* find a partition udevice */ diskobj = container_of(handle, struct efi_disk_obj, header); - - r = part_get_info(diskobj->desc, diskobj->part, &info); - if (r) + dev = diskobj->dev; + if (!dev || dev->driver->id != UCLASS_PARTITION) return false; - return !!(info.bootable & PART_EFI_SYSTEM_PARTITION); + part = dev_get_uclass_plat(dev); + + return !!(part->gpt_part_info.bootable & PART_EFI_SYSTEM_PARTITION); } From patchwork Mon Oct 4 03:44:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515140 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062436imy; Sun, 3 Oct 2021 20:47:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJKZ4KeiDk1jxuPtlX9KCy2nAwFmDUmTUDfY/Z3DB3l+jj4VWnVfxx6VbOpVyY7pwRHXKt X-Received: by 2002:a17:906:6c84:: with SMTP id s4mr15100026ejr.121.1633319244239; Sun, 03 Oct 2021 20:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319244; cv=none; d=google.com; s=arc-20160816; b=cJQoNdOi2Et6u4Uidv1vAxSblj7cXrxWOhC3Rwy2FOu6bAfxGcIqkmf2d2gnpAr7OC 6nBi3qQoI3DsglSXQEvOhH6gQiz64fk55ctoSKtnM6kadb4fUZ72qKvaFzWA6uGIHiRj G/H0Tvo9/zLckd+MRFiYQzjsNkBkWc5PgXiptPfrQ57O/pOY26alXSvJ0V6MVFnt+iDx tpV/3QHnrKSxGiKPuIta9TVbyXAM7nlqxy6i79etWBtchVmU0lNvnaLKf7iOYOhyjI4P cVjfdqM1vRF8pVgg0EdFfvYVARCg3s/kuBv4a6L4axaF5lLUpfKZnGzIbFO5mtF+gGHN foqQ== 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=4mn44Pr4crHZayV4dJN9FRKvZepqTA8aJ3PwtV1W9t8=; b=09zzPUY9cLjo5QYknTZsS+xxCuy75tmCm6QwQx2+vJRD1FqPYOGoGyo7gXbIJJr63g nQLQl6vZI9vFBerXTbceR0zfts8I85bLvVInHhPYnjK5MtW+7izyEnpdjjQjdoU+QtEl BJ8RLqtF856t5+JXvrm7m4MXU/NG7GOc/e32u/nT6xs7oJUnjKzvJhqYl07cps/X+dij AIHnl0L50BONzC1jZbzhelo0bBzzt8EMrDAzclLOB/O1iE9b3pzdT/l4+885MniCJawL 9pWgI6Ok6kBKFW/ivrDMzU2htKwcQ9QlmlSuTBguMpuPJV+wcdOkN57V8V3J7X1JdmCN KDIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCbhqxQJ; 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 jr11si3200569ejb.269.2021.10.03.20.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:47:24 -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=kCbhqxQJ; 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 108F28358E; Mon, 4 Oct 2021 05:46:25 +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="kCbhqxQJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BF938353B; Mon, 4 Oct 2021 05:46:13 +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-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 9A73583581 for ; Mon, 4 Oct 2021 05:45:59 +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-pj1-x1029.google.com with SMTP id pf6-20020a17090b1d8600b0019fa884ab85so2551100pjb.5 for ; Sun, 03 Oct 2021 20:45:59 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4mn44Pr4crHZayV4dJN9FRKvZepqTA8aJ3PwtV1W9t8=; b=kCbhqxQJu1aNKk52Sn1cP6YNPCSdjbo1lunOHPc6Bht7H2nkX2Lvtb/XtHLRD1fZMk XqSxVlqqduliMV5GGcMT6/A2XTpgm+y4MtMYPlKzUkZQ5f+c8NKi5S5xycDa919s94wb 48tg5/gL2xtBJ9iytm9RW7X4K+3lhw8/52YBp+PIotmFvR31x5YpNoulqDnt5zowfpLw q4cXHuhpU1m5g2DcZLgijFSqKZhwEEutxuTglfbFWpFSHPimxwhQsceXyQOTua+L3Bwf srUvuIur5NYtbpx4IgxKfxYKrM8KEb3b3ZHs51CHcE0B/f8y/nyuRuYE2gm/h89UkU9M Yunw== 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=4mn44Pr4crHZayV4dJN9FRKvZepqTA8aJ3PwtV1W9t8=; b=0+8t8z9ezfEi+bBkEAw2QaEzZS+r62xSWHEt3vrjAzwNu85LGAR6T/kX3oElmRkXf3 pQJQnE8ACuaCO1n9vQLoQ+VrND2ViruiUmzw3NH3bD/Yrzg/AC47tuCk+7lXT2g3mdHE fC/oNC16VetZSWbxCd2DjXk3ZQshjMMUGHBRz9UlPkYHF6LGcZvxGNSHxYi35xf8I4lE sffSYlVRYXttqUtr2LIaoR9Y7iWdo6kD2ljCY8SGY7mQZ2PvOehffSQK9mGzt/OMUh4M Uq75VFu3uIrLciIW972DLdCiC7dUbEELAQ2MTRTx+w6HRHmrg84o934LSQzZFsYUnZ7O iGkw== X-Gm-Message-State: AOAM532divNopJ+vLrUxmgRO4mdnK/dIMp6TUH7pBy0kEK52bY1YjaPs eYhXTmVcXShKRCZnxX9PcBfJrg== X-Received: by 2002:a17:90b:4a82:: with SMTP id lp2mr34886993pjb.57.1633319158013; Sun, 03 Oct 2021 20:45:58 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:57 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 12/22] dm: add a hidden link to efi object Date: Mon, 4 Oct 2021 12:44:20 +0900 Message-Id: <20211004034430.41355-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 This member field in udevice will be used to dereference from udevice to efi_object (or efi_handle). Signed-off-by: AKASHI Takahiro --- include/dm/device.h | 4 ++++ 1 file changed, 4 insertions(+) -- 2.33.0 diff --git a/include/dm/device.h b/include/dm/device.h index 0a9718a5b81a..33b09a836f06 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -190,6 +190,10 @@ struct udevice { #if CONFIG_IS_ENABLED(DM_DMA) ulong dma_offset; #endif +#if CONFIG_IS_ENABLED(EFI_LOADER) + /* link to efi_object */ + void *efi_obj; +#endif }; /** From patchwork Mon Oct 4 03:44:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515141 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062471imy; Sun, 3 Oct 2021 20:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDRB4+bycbwJP9rOmxo7jOZ3B4vdv0Nn0EurcgzKTMGfR4RT8F11+Bhs1aFADZvxV63JGc X-Received: by 2002:a05:6402:35cb:: with SMTP id z11mr6086454edc.252.1633319255575; Sun, 03 Oct 2021 20:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319255; cv=none; d=google.com; s=arc-20160816; b=zGeL85xbv9vh1igfeoH60ttZ802ZTT8WkupLJ+N6Onzsxg9jzNa7pXolpLtwfH2rgs HUGVvfDkbKPKN4wnWaOaff4p9G4DjsRFDjoaKuN/mqqqPN9lG5bTSkXHP1TZlDQbNuIC XiWypDV72DVRaV4IabpPFhSoHFgfrq6j+hFm+0W0ptGTGf95hObSG0C9hQ2viGk/3jFW we/SYRWm8GIsZ6F3M4Fsj8g+JWfnDwYQhQiYnglugfDAtpZ4WIbyLNP2uiRDLtZ64WeE XdgaUrnUuabAwuoHbqNfs7Lq3o6zCMEWLAv0pAbQ8LL0X2CbWGCsqtfsY1GPfaKe2JZU XJqQ== 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=Hiq0GPfOIkgEsC+7jlW39Y8NMVcrrhfZ+hZNCMT5yrc=; b=NBcjsNBd6sAO7YdoHzIA0MQWh10hyfjBhj47B2md3mXSvZvBdy7ex9icMrABE/hV7f AIDTv/oJFM6KoSpyz/lk+zUZMrz57wh60VlrcR86x+Udsjl7cysPNVe5aqWAGORXfSsO vs8+b5CsjR0L2JvAFDWBV/xsfPpdoTfO5JZFVG8HzaHxtlJYNkYFzBe3jIP6f8cI2jX6 y+/i6S7Lu4TMUhrOCVmKRVBiszPYS45xbiSVKXoQlS75x6o7gkpwh13dg7LXujrOAadF Oi5Sznkvqu7dib/WBvmHFLzWb1drESSjCwisCTYlpEbbJu0BPxvFBfuX76ePyHaTa/Vu 6Wvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QD/wvH5B"; 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 i1si15664148ejo.756.2021.10.03.20.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:47:35 -0700 (PDT) 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="QD/wvH5B"; 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 DE48E83581; Mon, 4 Oct 2021 05:46:29 +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="QD/wvH5B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE20D83577; Mon, 4 Oct 2021 05:46:16 +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-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (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 BE9308352E for ; Mon, 4 Oct 2021 05:46:03 +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-pg1-x52d.google.com with SMTP id 133so15274771pgb.1 for ; Sun, 03 Oct 2021 20:46:03 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hiq0GPfOIkgEsC+7jlW39Y8NMVcrrhfZ+hZNCMT5yrc=; b=QD/wvH5BfGqS+Y0F0+ArxNHAIFQu3SIoDN5ay8AZAp809s/f75pUPGXe6SRyR/FwZf jxx8euNbkF2WFv30Be0G4n41pxXPHXOcHFK58p4VIsst5c7ALqb6vzNrAtvfVYVeTGke YqcXxf8fq67CwwjZBgCWxxGCLok0+TGI6/2OQln2ywEXKtR5hGXtNhZ+PLhSmNUVlRPZ GkEREnMSuPnH43jsuo70mGlr7eidIz7vBF3IeuG7IdN6F8vCgHQpK1v6iMYZEXcQ2JXf IklVqorFLpd0odemsKvudsGry+sm1rMgnk+hiKeOSehS2ZErcEVx4LrNvio/7u+gwBiL +moA== 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=Hiq0GPfOIkgEsC+7jlW39Y8NMVcrrhfZ+hZNCMT5yrc=; b=xkEtrQSZobcaL+z7jyVSPmAEZVyaZXEsUhRyOHUoc9SHFHmbR/qHhbKbDr+MM/hIcv /sTRv8hO+HA+JrwtoFE0s69iK/DPXLSI5YtZ5767EGGDDcaUMbhOgyPAGRcuYyWSPzJy qZaZ8bLd4/ZsYb1QSNY3+BBcH/GCC6Ecwk2QH2y4l5Pt2PFS/8P2eS+1i0/QOdh0Q9Hg M/RQMKAVI23x97RmWMUu+gk38pEQk0CaMxl9oRUym+kzfwd9Y+JiW5ggQ1NObnDdhfl4 nkTzzQXBY5lvttWpdOuEftuPkzI1CMnmxtBsuFcExs4hLZpOPR0azJ6TZzzEEZve6Xyo Mn8Q== X-Gm-Message-State: AOAM53015k0piIdkO86w/BtbXt+QbV8hWUJMdBFltGkrt5U4X/+MGOZO SpyNSD6jmqOUdTo7hd9q3KxB5g== X-Received: by 2002:a63:7d05:: with SMTP id y5mr9046142pgc.80.1633319162010; Sun, 03 Oct 2021 20:46:02 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:01 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 13/22] efi_loader: remove !CONFIG_BLK code from efi_disk Date: Mon, 4 Oct 2021 12:44:21 +0900 Message-Id: <20211004034430.41355-14-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 The change in this patch will probably have been covered by other guy's patch. Signed-off-by: AKASHI Takahiro --- lib/efi_loader/efi_disk.c | 49 --------------------------------------- 1 file changed, 49 deletions(-) -- 2.33.0 diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index dfa6f898d586..cd5528046251 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -552,7 +552,6 @@ efi_status_t efi_disk_register(void) struct efi_disk_obj *disk; int disks = 0; efi_status_t ret; -#ifdef CONFIG_BLK struct udevice *dev; for (uclass_first_device_check(UCLASS_BLK, &dev); dev; @@ -580,54 +579,6 @@ efi_status_t efi_disk_register(void) &disk->header, desc, if_typename, desc->devnum, dev->name); } -#else - int i, if_type; - - /* Search for all available disk devices */ - for (if_type = 0; if_type < IF_TYPE_COUNT; if_type++) { - const struct blk_driver *cur_drvr; - const char *if_typename; - - cur_drvr = blk_driver_lookup_type(if_type); - if (!cur_drvr) - continue; - - if_typename = cur_drvr->if_typename; - log_info("Scanning disks on %s...\n", if_typename); - for (i = 0; i < 4; i++) { - struct blk_desc *desc; - char devname[32] = { 0 }; /* dp->str is u16[32] long */ - - desc = blk_get_devnum_by_type(if_type, i); - if (!desc) - continue; - if (desc->type == DEV_TYPE_UNKNOWN) - continue; - - snprintf(devname, sizeof(devname), "%s%d", - if_typename, i); - - /* Add block device for the full device */ - ret = efi_disk_add_dev(NULL, NULL, if_typename, desc, - i, NULL, 0, &disk); - if (ret == EFI_NOT_READY) { - log_notice("Disk %s not ready\n", devname); - continue; - } - if (ret) { - log_err("ERROR: failure to add disk device %s, r = %lu\n", - devname, ret & ~EFI_ERROR_MASK); - return ret; - } - disks++; - - /* Partitions show up as block devices in EFI */ - disks += efi_disk_create_partitions - (&disk->header, desc, - if_typename, i, devname); - } - } -#endif log_info("Found %d disks\n", disks); return EFI_SUCCESS; From patchwork Mon Oct 4 03:44:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515143 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062586imy; Sun, 3 Oct 2021 20:47:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZP8W4ZSkyQkwmniiU8xUsFCjUNh0HW6F8U5W/pRb/vbFV2HTttyqgGQJGSmRRmoqeWzsg X-Received: by 2002:a17:907:97d2:: with SMTP id js18mr14107803ejc.191.1633319276736; Sun, 03 Oct 2021 20:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319276; cv=none; d=google.com; s=arc-20160816; b=oAJoyJgnU1baS3scyfic6WPVANGzcY4Ualwr1lmmYa8PipZDDRME0VwaxUZK4jcjtF 5iuZwDuET5gAy/Q5+VruU7pX8aVP+/YMdd3aTkLpwtQHo48MjQbTRpe9IyRQ/i7bQTfU MWHLffmHJDgIWx0Abclza+dZkrPL3Unj72xX2OfRiGSB2LQR6auCowOZiGcoAceoWzqs V1ZZpOzceQPhjq8grxVjmyGnFqzA4bMbwXKoEpWLnfwg4c1whGLdPc9vb4sbPLvBP92E a55IE+qObFiS/mx6TdrEfFivFoKDAfN8g1Ky6eaU0FhSv7GxAAanwdPhqHnQuQ4OpCDO 4lVQ== 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=ljBbc9yy6BIAE/d1lliVlMaJO1EJHQ1AhZFnjPHH/kI=; b=M2tx2CCTUrZyImXtcFPVICOzBNPjhb5FZkrTgj+Tnxdn5g5wxz0uoVHtW4FpRdDs0E l6d9p+CR6ztf/BFDZ4V5DYlUc64A9f1mmXm+hlyRiI8gZCL0EQhAUIS2o48UaHyILlnH jbEKwkJW0JsybSizwVklicU8+42kcBraijSHFVFgugzmdbIVQhvt/XvDGKehO5dpiptZ i8E9RMIK7EkQ/B4TcUpmKl8K5K5MOBxaatxorPNSp00Gg2tcSnuNBCaiexWMeoa3142E zYInMJzRXxecwIklMmYO9pk97vos8fPTsp5tgooD6xtQtXC+II2uZodynuMhe4NsZKi4 pEKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iB6scrkn; 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 q6si8812740edd.80.2021.10.03.20.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:47:56 -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=iB6scrkn; 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 1B10E8359B; Mon, 4 Oct 2021 05:46:41 +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="iB6scrkn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6E94A83575; Mon, 4 Oct 2021 05:46:20 +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-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 8457283571 for ; Mon, 4 Oct 2021 05:46:09 +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-pj1-x1031.google.com with SMTP id kk10so1290306pjb.1 for ; Sun, 03 Oct 2021 20:46:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljBbc9yy6BIAE/d1lliVlMaJO1EJHQ1AhZFnjPHH/kI=; b=iB6scrknsb+R2JZfGfqwAlIethPWIJb8f4tWhW64WmZf5AvJ92uweDEJgUxn6qMMmE pktxXvYoTfwtQ4IlTtkylsqoBt9bJdGcD5lgD5SGz4RxkDuDVL+hZrVmRh3RS2Mg2NLG YEsPq7RNtE5WTYhDHTrQNPTari2CKkHdRwTxXFryw1nDM9EdDGtXsGEwN9lIx6rMFjLl 0Zeb0edh8W3RH1CtwPoUjcfNwtWtL9cRwKpu2Q1hy8u8JqWYZdmgyHPEUNOmditORKA2 qdu/A1HIfhCGdHmuRrBDUHzxtE382DT2gQrWnAdbOnWwbrvQzfBeuJ8GvNYoqKO1M690 +rhw== 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=ljBbc9yy6BIAE/d1lliVlMaJO1EJHQ1AhZFnjPHH/kI=; b=WCZ3xu9S/fqdiRKhHUMxJf7g0Xnj8qmaACN83HLpZKq+UlxD7WURNL369PTr4vimGo LiEbZFxxjGGi9rEfhlvKoovqV6oNVj2HJjXio/bwNu3MRWnS522LS5dfBTVEZyhf4KLY lZ2mev/nN5XZ/w1CBlPyeC2nqtRomb9UF/v9p8iTTvaQVdt5vQg62rXUlZLrGsUOrYoh XsyygAxoEYXmmuvTqwcTfYBygnU0XZwMQJXnHjFBpRLZkE13gBxhaRUJH0ZagRUnnhNn 0y/43x5R24WyT5aIPdWWhBberXXFQFkPtmZJN3N6wsYrLA6mccbgm0ZHM25YRYee9bR7 uGkQ== X-Gm-Message-State: AOAM5306y//83ezOkoyqt8hA43t2zuc8Vog7zfebNb9ldBbnNqf3RVCx gMUCCLZ8H4FC/0prfAZ2QcPeOw== X-Received: by 2002:a17:90a:e7c8:: with SMTP id kb8mr1287188pjb.95.1633319167847; Sun, 03 Oct 2021 20:46:07 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:07 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 14/22] efi_loader: disk: a helper function to create efi_disk objects from udevice Date: Mon, 4 Oct 2021 12:44:22 +0900 Message-Id: <20211004034430.41355-15-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Add efi_disk_create() function. Any UEFI handle created by efi_disk_create() can be treated as a efi_disk object, the udevice is either a UCLASS_BLK (a whole raw disk) or UCLASS_PARTITION (a disk partition). So this function is expected to be called every time such an udevice is detected and activated through a device model's "probe" interface. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 + lib/efi_loader/efi_disk.c | 92 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) -- 2.33.0 diff --git a/include/efi_loader.h b/include/efi_loader.h index c440962fe522..751fde7fb153 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -517,6 +517,8 @@ efi_status_t EFIAPI efi_convert_pointer(efi_uintn_t debug_disposition, void efi_carve_out_dt_rsv(void *fdt); /* Called by bootefi to make console interface available */ efi_status_t efi_console_register(void); +/* Called when a block devices has been probed */ +int efi_disk_create(struct udevice *dev); /* Called by bootefi to make all disk storage accessible as EFI objects */ efi_status_t efi_disk_register(void); /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index cd5528046251..3fae40e034fb 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -484,6 +485,7 @@ error: return ret; } +#ifndef CONFIG_BLK /** * efi_disk_create_partitions() - create handles and protocols for partitions * @@ -531,6 +533,96 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, return disks; } +#endif /* CONFIG_BLK */ + +/* + * Create a handle for a whole raw disk + * + * @dev uclass device + * @return 0 on success, -1 otherwise + */ +static int efi_disk_create_raw(struct udevice *dev) +{ + struct efi_disk_obj *disk; + struct blk_desc *desc; + const char *if_typename; + int diskid; + efi_status_t ret; + + desc = dev_get_uclass_plat(dev); + if_typename = blk_get_if_type_name(desc->if_type); + diskid = desc->devnum; + + ret = efi_disk_add_dev(NULL, NULL, if_typename, desc, + diskid, NULL, 0, &disk); + if (ret != EFI_SUCCESS) { + log_err("Adding disk %s%d failed\n", if_typename, diskid); + return -1; + } + disk->dev = dev; + dev->efi_obj = &disk->header; + + return 0; +} + +/* + * Create a handle for a disk partition + * + * @dev uclass device + * @return 0 on success, -1 otherwise + */ +static int efi_disk_create_part(struct udevice *dev) +{ + efi_handle_t parent; + struct blk_desc *desc; + const char *if_typename; + struct disk_part *part_data; + struct disk_partition *info; + unsigned int part; + int diskid; + struct efi_device_path *dp = NULL; + struct efi_disk_obj *disk; + efi_status_t ret; + + parent = dev->parent->efi_obj; + desc = dev_get_uclass_plat(dev->parent); + if_typename = blk_get_if_type_name(desc->if_type); + diskid = desc->devnum; + + part_data = dev_get_uclass_plat(dev); + part = part_data->partnum; + info = &part_data->gpt_part_info; + + /* TODO: should not use desc? */ + dp = efi_dp_from_part(desc, 0); + + ret = efi_disk_add_dev(parent, dp, if_typename, desc, diskid, + info, part, &disk); + if (ret != EFI_SUCCESS) { + log_err("Adding partition %s%d:%x failed\n", + if_typename, diskid, part); + return -1; + } + disk->dev = dev; + dev->efi_obj = &disk->header; + + return 0; +} + +int efi_disk_create(struct udevice *dev) +{ + enum uclass_id id; + + id = device_get_uclass_id(dev); + + if (id == UCLASS_BLK) + return efi_disk_create_raw(dev); + + if (id == UCLASS_PARTITION) + return efi_disk_create_part(dev); + + return -1; +} /** * efi_disk_register() - register block devices From patchwork Mon Oct 4 03:44:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515142 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062524imy; Sun, 3 Oct 2021 20:47:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrrh3/xVsdgeA/9fDyJNloN5XppJjg2RCQPCdgEWd93Po8VMSum4X/mY9oUn6C2ydSd1Ug X-Received: by 2002:a17:906:1fc1:: with SMTP id e1mr14465411ejt.515.1633319266215; Sun, 03 Oct 2021 20:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319266; cv=none; d=google.com; s=arc-20160816; b=c7qDMWs7xVh09ePACogPHwE1FxkR5nQyubu+uBm4dtVqL71GiJGAbw/P0T62whA8H1 YFwxGDP7RdrVx+8HDntlpak5SOFH5LTe+/cQWyRorM+XBbUMb84X1nEEjL9YBB/kEhi/ rY4H10CMSXKdzwEwMzAK4UDDx31sDjYlQFhY1tQW5lWXKSBrBjdwPx5LQX1kALu/zga2 SERcnQ3uvAZ1IN4br1h50teB6hAgwkgzW9lBXXGEcJ6Ue6+uv/RUk4sRoloCO0cDmGBx kc3QFUR2+pLpKDaYfwtg8gx6eGm7HMlwxao/xZWco//WMzkZrFz4i8+D1Lw1RqZ2KHSQ NsiA== 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=coOvnAk/rbk+/ncR0sxWujqYftnu93HGs2aH4UoEgn4=; b=lzSAAq1WQPzkPE5tUnxKE7TyHp8OrA96D3L5Nbek9B0yiJZ6mRwXKo4MUZDxIf8UVi +23pVigPymyYUxhRDH49ZoUNNK10UVtB/X+0Wxz9JfkqRl/mqp5eBL3j5npYf7XyEPDC E9Sz67mICBN6nefh4weMObiyKqOKbEyk1E72HZ96/rDrous2paUJP407ltRXHOR00sD6 kK/jyiIyfOLLQ/PW+HCwQ/MU4taTkWI6HocLQF8lNfikms/Tp/saQI9ItT3Bn10kC7SZ hrcMd3F9JD7KBWxV6fjtw1Xz/mQSyesiEiUOrVkd/a27vezkDTrUwlJCeFphoCHSCKUv y1wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zbyL7GOr; 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 au8si12867036ejc.494.2021.10.03.20.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:47:46 -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=zbyL7GOr; 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 21A5F83597; Mon, 4 Oct 2021 05:46:35 +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="zbyL7GOr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4726D83571; Mon, 4 Oct 2021 05:46:22 +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-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 0369283550 for ; Mon, 4 Oct 2021 05:46:14 +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-pj1-x102d.google.com with SMTP id rj12-20020a17090b3e8c00b0019f88e44d85so4641648pjb.4 for ; Sun, 03 Oct 2021 20:46:13 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=coOvnAk/rbk+/ncR0sxWujqYftnu93HGs2aH4UoEgn4=; b=zbyL7GOrP+inGQRuKbuy+yat7Hdqf5MABFZkuRZTaKGUW0alrq/NT6ywxMQEysHZxc W0Yy7Qmd925MOxHXvDGSA207q/4QFLZ4MdkytjT0Z5d5MSrK9HdraGqrt/+Cwyq3qhnw pFAEHksG8TP9X/Q0lVCbvmvXI9wINTz7zEKLyYIb1tmXGNCMSvuAs2NozhBcVPQMKqoS 2eS+X+Anfj592xXplluxnQvJ/4u/w3+dhep7i3QbajNt84fdSLKDvf80fGWBa3WEF5YR rqN3ydgYARDIqzEguaHswTfqi1k4S3ZvSinTTJ1QX3mEmkfskg4KsipcCq217MBP1T2x oTFA== 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=coOvnAk/rbk+/ncR0sxWujqYftnu93HGs2aH4UoEgn4=; b=h6IEHBbD68+PZBk78S3Pr5G2FDQMOYWOk+Bd9sO16MQuDMlost73h3t3nCXWnCieBu 3dtVf6JWwCV5SVPP4rvVRDeMghxqpP51obOb0+pnkifv8p9MQG5sd/gaADcqii/ytOBL 5rW3leCj4+Lmk0iH+BuLdtufPeUoSobzMoPaTB0FtSMacVc2LGsPlCuTMATXPQyPGPcI USdshdK3/a9kTp/3ZgLrWk2jZao9yRVq1g0g3GBuqaCpdJyuTeJ/LTSlCZOMv4Qz0D0V dk1qEGxpWMkEodkfQJD+7Gifl83xkyu66I+ryubOzf7NVTJYN4rFPye6epFfubQa258n 8wFg== X-Gm-Message-State: AOAM533tHS56KS9Rugv9XgpziPMvi1u4F+L6Zo1mYnf76vsfTEDxbULc THvrwuefIxcJhVFFqJm4bNo67w== X-Received: by 2002:a17:90b:14cd:: with SMTP id jz13mr15761663pjb.192.1633319172391; Sun, 03 Oct 2021 20:46:12 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:11 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 15/22] dm: blk: call efi's device-probe hook Date: Mon, 4 Oct 2021 12:44:23 +0900 Message-Id: <20211004034430.41355-16-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Adding this callback function, efi_disk_create() in block devices's post_probe hook will allows for automatically creating efi_disk objects per block device. This will end up not only eliminating efi_disk_register() called in UEFI initialization, but also enabling detections of new block devices even after the initialization. Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 8fbec8779e1e..ce45cf0a8768 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -827,6 +828,11 @@ int blk_create_partitions(struct udevice *parent) static int blk_post_probe(struct udevice *dev) { + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_create(dev)) + debug("*** efi_post_probe_device failed\n"); + } + if (IS_ENABLED(CONFIG_PARTITIONS) && IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) { struct blk_desc *desc = dev_get_uclass_plat(dev); @@ -843,6 +849,10 @@ static int blk_post_probe(struct udevice *dev) static int blk_part_post_probe(struct udevice *dev) { + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_create(dev)) + debug("*** efi_post_probe_device failed\n"); + } /* * TODO: * If we call blk_creat_partitions() here, it would allow for From patchwork Mon Oct 4 03:44:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515144 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062632imy; Sun, 3 Oct 2021 20:48:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJLtkf6TbwLDp+BbYO6q/jxllHrg8O8C2n0XWs82Y0EutQw1p5Zp7B3l6RTVNftfthpt2k X-Received: by 2002:a17:906:66d5:: with SMTP id k21mr13993726ejp.487.1633319286565; Sun, 03 Oct 2021 20:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319286; cv=none; d=google.com; s=arc-20160816; b=ibtOda6Z9LJjnOav7ApS3VqZJCF8CVw1KfIzgaq17a+wzOwRB4BAdgytR7Yeo5abVs 3jv3XVMJ2sQdsjl7gNOnKZALU6w1hjHlOQW2NgFn4e9pQYig4C8QkmO90Dh4oWJxljTZ rTHuwEsXl+XVhAl76NX6/yk0QP0vcawjG9rNdcYzfG2k5RH/+bG9AguBi8r0gb8q9BFn AO86UYBPVg3zxAGR7eMG9QqdvsE6tPXCL6y8bY0MC5GEgmF3NkE7NvZc2JTnNszumL0D 1s6bnWVpMXCc7Tih59lJ3oONG/d5e8B3tMM9QJ2QosQi7rDzFuMMlniOcpwF9ivv/nzz flhA== 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=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=G/QiYlZyFcJO8D2Hp6TGCtKi3cHz3fzZEIjGPqKhpdRSPBleH0ZkN/0ZOf7XUa6i6n lixLHAh5P0eQ1GcRosKTgOh/dJsiQjNWv7hwKGgYZHyLh4I+swA6MUIwXYS6oMRh9h+Z KHuDdthb9lXSYLUCIX+vq+QvzRriKif24uQQwhOK2hNo5BzIPLGwb2EZ0R2moHq7LcjE RymaxQpF+Uu1h/HAznndcy8TY9S5osKqaPevaZzNoHoeUIPXmlXiU4UGcjxQqiF/+qb5 5n+goTEikp4H9uz+4wELTg/VB0GmBW4UHkkF7ay/UJWBW5op1pKHgph8r3zskiPAHmNc j9nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSOz2901; 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 g14si15109763ejj.426.2021.10.03.20.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:06 -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=hSOz2901; 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 0FB9483571; Mon, 4 Oct 2021 05:46:46 +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="hSOz2901"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E8E48358D; Mon, 4 Oct 2021 05:46:26 +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-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (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 C073C83562 for ; Mon, 4 Oct 2021 05:46:17 +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-pg1-x52e.google.com with SMTP id 133so15275231pgb.1 for ; Sun, 03 Oct 2021 20:46:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=hSOz2901nUL91GhPLoTunlCOY/AEyYprqrpTO6hCAXlHUNpeabdl5aZS03Vu71qSla GAnMUcusZxvpVh4opIJYRJ2liakf4iydZejvIiS4YAq/TqFGEklvRl98EdKWg5Zgdtb0 ZQzJjOvTQq8z392EU7iZRTC9mlQyP9BDoetN26Y0+Hc/MOA87/0IWiuLjdf5GtelhY5j MkzoUh1Sa6kqedDAYMRQk3t9pdZ/3m+TQK6oDqj4NvKoVdZObiFpf73RnrB85ZGN2ZCW WLjAobTbJdpdyJTq9i/ZATfs5i/6jzE6NM92+wRZ+TskeMH2zkm6UB4AWN3Fk6r+S2Eq Vesg== 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=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=A55dWk06qTGB3II+jTHz3rx1hGASlwLH5crGhkLVP8UodD9R3NOijIgDZ+Pt4HOh/N VFbSM3AZe/e/+n/vnXG1mBfAP2dbd82qw+iRBRGUZgmwaq3zvBTXJy73w6MnHn8Z10ES TV0Bo7NlszoHZ2v1k/5TQXkslayWFrh3Di/CYRbOVUzr/15Vj9Z9KO+Ww8qWTsFZq9pF w8OoLUlq9VadnUHBQ3RJ6X/eoHtu0sDMVtN8Mqyyk91+rLwc4zbuaG591XzZvpzL7baI VcTGVSOrnJGyP68A2V9lz0120q7IJ58JAjwhONbQY4j0wjMtXkWc03jH6qLU4XxmGhNI vUPw== X-Gm-Message-State: AOAM530WuZ9S6IPZ5UfL1PGLppaNxxI2Z47hKUpFo9ogRs5E9eiNsd37 p9ESAM8MN9k3K1Jn3nn3DKiKP9h4j+4l6g== X-Received: by 2002:a65:6643:: with SMTP id z3mr9008717pgv.16.1633319176087; Sun, 03 Oct 2021 20:46:16 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:15 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 16/22] efi_loader: cleanup after efi_disk-dm integration Date: Mon, 4 Oct 2021 12:44:24 +0900 Message-Id: <20211004034430.41355-17-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 efi_disk_register() will be no longer needed now that all efi_disks are set to be created with device model thanks to efi_disk-dm integration. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 - lib/efi_loader/efi_disk.c | 102 ------------------------------------- lib/efi_loader/efi_setup.c | 5 -- 3 files changed, 109 deletions(-) -- 2.33.0 diff --git a/include/efi_loader.h b/include/efi_loader.h index 751fde7fb153..cfbe1fe659ef 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -519,8 +519,6 @@ void efi_carve_out_dt_rsv(void *fdt); efi_status_t efi_console_register(void); /* Called when a block devices has been probed */ int efi_disk_create(struct udevice *dev); -/* Called by bootefi to make all disk storage accessible as EFI objects */ -efi_status_t efi_disk_register(void); /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */ efi_status_t efi_rng_register(void); /* Called by efi_init_obj_list() to install EFI_TCG2_PROTOCOL */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 3fae40e034fb..74ef923d1d67 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -485,56 +485,6 @@ error: return ret; } -#ifndef CONFIG_BLK -/** - * efi_disk_create_partitions() - create handles and protocols for partitions - * - * Create handles and protocols for the partitions of a block device. - * - * @parent: handle of the parent disk - * @desc: block device - * @if_typename: interface type - * @diskid: device number - * @pdevname: device name - * Return: number of partitions created - */ -int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, - const char *if_typename, int diskid, - const char *pdevname) -{ - int disks = 0; - char devname[32] = { 0 }; /* dp->str is u16[32] long */ - int part; - struct efi_device_path *dp = NULL; - efi_status_t ret; - struct efi_handler *handler; - - /* Get the device path of the parent */ - ret = efi_search_protocol(parent, &efi_guid_device_path, &handler); - if (ret == EFI_SUCCESS) - dp = handler->protocol_interface; - - /* Add devices for each partition */ - for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { - struct disk_partition info; - - if (part_get_info(desc, part, &info)) - continue; - snprintf(devname, sizeof(devname), "%s:%x", pdevname, - part); - ret = efi_disk_add_dev(parent, dp, if_typename, desc, diskid, - &info, part, NULL); - if (ret != EFI_SUCCESS) { - log_err("Adding partition %s failed\n", pdevname); - continue; - } - disks++; - } - - return disks; -} -#endif /* CONFIG_BLK */ - /* * Create a handle for a whole raw disk * @@ -624,58 +574,6 @@ int efi_disk_create(struct udevice *dev) return -1; } -/** - * efi_disk_register() - register block devices - * - * U-Boot doesn't have a list of all online disk devices. So when running our - * EFI payload, we scan through all of the potentially available ones and - * store them in our object pool. - * - * This function is called in efi_init_obj_list(). - * - * TODO(sjg@chromium.org): Actually with CONFIG_BLK, U-Boot does have this. - * Consider converting the code to look up devices as needed. The EFI device - * could be a child of the UCLASS_BLK block device, perhaps. - * - * Return: status code - */ -efi_status_t efi_disk_register(void) -{ - struct efi_disk_obj *disk; - int disks = 0; - efi_status_t ret; - struct udevice *dev; - - for (uclass_first_device_check(UCLASS_BLK, &dev); dev; - uclass_next_device_check(&dev)) { - struct blk_desc *desc = dev_get_uclass_plat(dev); - const char *if_typename = blk_get_if_type_name(desc->if_type); - - /* Add block device for the full device */ - log_info("Scanning disk %s...\n", dev->name); - ret = efi_disk_add_dev(NULL, NULL, if_typename, - desc, desc->devnum, NULL, 0, &disk); - if (ret == EFI_NOT_READY) { - log_notice("Disk %s not ready\n", dev->name); - continue; - } - if (ret) { - log_err("ERROR: failure to add disk device %s, r = %lu\n", - dev->name, ret & ~EFI_ERROR_MASK); - return ret; - } - disks++; - - /* Partitions show up as block devices in EFI */ - disks += efi_disk_create_partitions( - &disk->header, desc, if_typename, - desc->devnum, dev->name); - } - log_info("Found %d disks\n", disks); - - return EFI_SUCCESS; -} - /** * efi_disk_is_system_part() - check if handle refers to an EFI system partition * diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index a2338d74afac..618526eaa7c6 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -230,11 +230,6 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; -#ifdef CONFIG_PARTITIONS - ret = efi_disk_register(); - if (ret != EFI_SUCCESS) - goto out; -#endif if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) { ret = efi_rng_register(); if (ret != EFI_SUCCESS) From patchwork Mon Oct 4 03:44:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515145 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062678imy; Sun, 3 Oct 2021 20:48:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw66urcaHLJw0k19MZOTUsNTQ4oy/zGCclHtchrY/g99vfRIG8h93I9tTBn0lCZHs5NDZ/M X-Received: by 2002:a50:8e59:: with SMTP id 25mr4678659edx.160.1633319296072; Sun, 03 Oct 2021 20:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319296; cv=none; d=google.com; s=arc-20160816; b=cpYCAOuaVZHxU9byfiQEtU/F6YuWKZUF3KTr9hFr8NYLWHW4j5sBVtybTQbqlPO61/ kCYk1h5Fk3n2gPKOxnV9m8vmpm+ik+CsS5VwQNNWtRcE7Nop2Zr+Oe/avCz45Jx5iQbl JhAL5RNCaXgn+7KRVf4nGSFLWfmO05skvBSKxMi0Wa+pp64bF8CJKpKtpBrtP1hXYer0 nADpgzzwoyFYcwB6tFkn+txgCgYP0vHco9olThO7JAMWBRTdj/XaJ+FbCYQIEo+sckpC J6sCbG8vg2s3M6pafNZjJ3B3qyFes2MuRWEvYgac/P1i1A4uI025hy+6O9SyA4u58RWi tNbQ== 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=L0tO99RHHL4KQN7RYjqTxDr3uBNsF0Bss6lY1EesGwM=; b=W8T0YfFOXim/hXcP2ClCOcPbWwVnFzmPkjMLZDQuwQy0yWq34+x+s84gofQ5wZfl/u vtWUaLIm+DPCZmobZo7xMMthK/4tHtO+x4vYyWGQyadyCSPf8k0ca5NZGBGXYBvcTQSv DnagWg4os+CgvwIV5kI1JP4FKJc+T7lhim1E2pljfNj1jrkcaw2psWSk5grFsg6QnrT9 +br0JgCK4TviQCD25ZsNJ8LAFab6I3JQVU1p2nmf3zCd04XF9kW9dSMNlRIbIglzXo74 FEYcMRxDZYvgXMYKTXNzbDvk4Hqk4EToAjjXGFlgZv+m1JwARGS+qNTnG/mT97PwrRDt uSEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LdIej5Xb; 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 q9si15856155ejn.647.2021.10.03.20.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:16 -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=LdIej5Xb; 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 636C3835AD; Mon, 4 Oct 2021 05:46:53 +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="LdIej5Xb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 37F1483563; Mon, 4 Oct 2021 05:46:28 +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-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (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 A48C78358C for ; Mon, 4 Oct 2021 05:46:22 +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-x434.google.com with SMTP id s16so13364805pfk.0 for ; Sun, 03 Oct 2021 20:46:22 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=L0tO99RHHL4KQN7RYjqTxDr3uBNsF0Bss6lY1EesGwM=; b=LdIej5XbcrSMzGwpQ6oegmEU1KS+SPKB4eDqjlR4AEeTE9WK6+YPTD66//H5HjLX41 QwjyQNXx3H3wz8ZEYnyqQ2F1p5NCzh8YWg3zY2rLWZqSk9GuVEqJokozvdJX1rCIfWxV ls4FKqE4P5bVZMcCY8Ske7p0JBKLwkmhWeUPWhO5u16ktngzjWzDq8Zdmkw0YWOU5GuG MFsXjJOprbo85iYuOIc+XEqJJz2hkwLX6H3HlKfNssXBviiiixn4auLYcyNyijDnbXZ3 Pp81NL6InD8VjhRJ3aY3V1z0b8JmcdpmzLjOU4wBw7G42uHyvmY4l2oV48JUtzXd2I9O oCCw== 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=L0tO99RHHL4KQN7RYjqTxDr3uBNsF0Bss6lY1EesGwM=; b=jAtn26Mvr28b/01rkQJrIh2bzAYQH0keuPbOdekVI7VitI9mH8mYciX7ilJ9y8+98V HOy7sY6Ppwq3T/jScsB/YX9vPr7jL1Spe1sVFkUtw2z+CZXnVFyW5dIsn0pj/2a2ZT09 pNIfRHus5ahuFofMosoB9AM2ZzfUOIGOoECzG/CbAgrgUVJQXaJuI6BVfxPraIdk1Lkx TLFwpUF7+TZlNzM88IQej2SkPvw19Ovrjfi+4d4WKZ6susw7z0tMeH8rQZ51r0jXGBlL p+F5K8xjecCryzKLW7qFf8fdS9z1KTi4+lJTGCuYk4aOw2DMXNo4B8WN2n35hOrHg8pG DtwQ== X-Gm-Message-State: AOAM532MvUXWYVtRFOqJUdOSjWRrVlAangH28qCd9infTKw9MefzzmHs 10Q6r9LxXcwqiU8yC/IfRQ54jw== X-Received: by 2002:a62:6383:0:b0:447:7fc:3eee with SMTP id x125-20020a626383000000b0044707fc3eeemr23914250pfb.86.1633319181012; Sun, 03 Oct 2021 20:46:21 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:20 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 17/22] efi_loader: add efi_remove_handle() Date: Mon, 4 Oct 2021 12:44:25 +0900 Message-Id: <20211004034430.41355-18-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 This function is a counterpart of efi_add_handle() and will be used in order to remove an efi_disk object in a later patch. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_boottime.c | 8 ++++++++ 2 files changed, 10 insertions(+) -- 2.33.0 diff --git a/include/efi_loader.h b/include/efi_loader.h index cfbe1fe659ef..50f4119dcdfb 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -579,6 +579,8 @@ void efi_save_gd(void); void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); /* Add a new object to the object list. */ void efi_add_handle(efi_handle_t obj); +/* Remove a object from the object list. */ +void efi_remove_handle(efi_handle_t obj); /* Create handle */ efi_status_t efi_create_handle(efi_handle_t *handle); /* Delete handle */ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f0283b539e46..b2503b74233b 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -503,6 +503,14 @@ void efi_add_handle(efi_handle_t handle) list_add_tail(&handle->link, &efi_obj_list); } +void efi_remove_handle(efi_handle_t handle) +{ + if (!handle) + return; + + list_del(&handle->link); +} + /** * efi_create_handle() - create handle * @handle: new handle From patchwork Mon Oct 4 03:44:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515146 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062732imy; Sun, 3 Oct 2021 20:48:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhTJtdEf0QqyGyrXLe4QNAV3q3kjcRe1peb6FbOiyCGWVWIHWODPmssuHmQxgewGwQJ6sW X-Received: by 2002:aa7:cb03:: with SMTP id s3mr13264025edt.334.1633319305537; Sun, 03 Oct 2021 20:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319305; cv=none; d=google.com; s=arc-20160816; b=nGZJHRX60ADgZR89B2lC5SA2Csbsa85SESTgtx9wqpMLEqQhNtCAuQRqaIW5HYQq8n tOtB+ruGVExl0IpaXVgQL86Wz4rYoJmVOjn1a8UYxlgkohIwbSQH2YomZEDjKVAy+rBD iUhL/bwLv3HTrLl0Qq0Hu42dojFbRbs/cNZmFdbLnUICM2QsTh4crVQ9dyU6rWNcvhyW 2NSrHrLkf/iwq2OxhvPYbip3HtsHj4I5M7bBmau+HDZeF2j0Dp/w/sBBgADB5p2XC9Nu bBqoVNMgd1c+FONtWYCCOYZMTc90A7kLbmxMFO/gmhYfV0SW1PFRPotTX9203Nc5pMJS yEqA== 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=LenLxMm4jJHe2glN2La5lemFNR7mrKrC7NL+E7b7ypg=; b=r4WMHXVR9bdfZhzpFrTZ3+fQvyDk44Wck5P7ISb1GB0HEP/l+TnQvZz2BVpvo2e9eV lTGLgRy4zWK3k2zj3OqqS+e7LNUGk8KGe+43p8WPJXf6Owg11BObJty1GnDCpgjph6sS qgorCCx7Gk95c5O81o9PVtV6of3QnIcrJE6+l/end7cmhqr91YJEBVwS+eW5/wGmTtBW YLAggoe8Y1rlDuCmkjzL3jDzi0MDnQjKLBogTJu2z0wERM/9L00CKRKODteZKj0KDVEb WBNTHKDKRjhHyLa77PAqWZO2FjjlgmotGzfER61mh4lTXxkHDeIDjbsC4KB2wn9lx8Zc dRPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gIcin2uz; 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 l9si8532703ejz.88.2021.10.03.20.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:25 -0700 (PDT) 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=gIcin2uz; 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 74814835B8; Mon, 4 Oct 2021 05:46:59 +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="gIcin2uz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A61E83562; Mon, 4 Oct 2021 05:46: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-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (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 8333883571 for ; Mon, 4 Oct 2021 05:46:28 +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-pg1-x536.google.com with SMTP id 66so14840239pgc.9 for ; Sun, 03 Oct 2021 20:46:28 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=LenLxMm4jJHe2glN2La5lemFNR7mrKrC7NL+E7b7ypg=; b=gIcin2uzSoVjZBQDp8cNh9GnIht43SN3L+7Vdh9AYRB5K635xijk1H2fosP3UbpoDU aRWvpRZZHO0ZslHXsOHJOIFj3SK1uu96fajCwI5GclIEa76QGXxk2HqWlwG2+qNqPeHi W+MNYsFXYm6WqqmuxdtOJlcmZJ6n/3gd9ol9P0uxmdlsBuoKeAtY8aGIzKn95AYcFp3r 9r6O7Je+By9N35HcJoB2W4KAgmfFf+a7pQRzy1HwPnfobr740UIYEbzSxH1Ela5wwK7i g1BKQ5a2YJLnWoJXYCo5UEgF99d6Q7auzw1X5+bJJTFVo8VxJcoscx/yIRsV1qIpqSYg oySQ== 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=LenLxMm4jJHe2glN2La5lemFNR7mrKrC7NL+E7b7ypg=; b=V6TtW0aeLMZAT2w79bxWUlKI1G86jsnLhsDgGSw887r/51Hy1bOsAz21QlDm1cXV26 HPRROKNCZzcPcQlhDGTrN68/SHo68mpvMiDLBiAWq2WaYLe0AlBo5EVbhf1oE7JQirlS mtpZPZNh63UPzPkr35CkEVvBYquxPmRB7k3eWBwHaUaR3sFFJQd2oQHDMzSci1sJAFUJ qJEmKbfDIv4Nen0WYcIUiewjEMx9Ubm1h27QatjahBGX6h1oS+X0bORPpYBSDn/IkGvI PUXGJ+vw+gAr8wNnugXHutJqJAbJxBPGwhkFsP6ZPjv6ihlfYwGc5m51U3DlrJcEauIN gxcA== X-Gm-Message-State: AOAM531VD97sfdVA/0jnJkNynyV/qybnDKpV67kDR710BWB33VlXnXar Rpd7pk12PSSkstpbEDF9DJdPLw== X-Received: by 2002:a05:6a00:9c:b0:448:603f:720b with SMTP id c28-20020a056a00009c00b00448603f720bmr23014636pfj.66.1633319186696; Sun, 03 Oct 2021 20:46:26 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:26 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 18/22] efi_loader: efi_disk: a helper function to delete efi_disk objects Date: Mon, 4 Oct 2021 12:44:26 +0900 Message-Id: <20211004034430.41355-19-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 This function is expected to be called, in particular from dm's pre_remove hook, when associated block devices no longer exist. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_disk.c | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) -- 2.33.0 diff --git a/include/efi_loader.h b/include/efi_loader.h index 50f4119dcdfb..7079549bea70 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -519,6 +519,8 @@ void efi_carve_out_dt_rsv(void *fdt); efi_status_t efi_console_register(void); /* Called when a block devices has been probed */ int efi_disk_create(struct udevice *dev); +/* Called when a block devices is to be removed */ +int efi_disk_delete(struct udevice *dev); /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */ efi_status_t efi_rng_register(void); /* Called by efi_init_obj_list() to install EFI_TCG2_PROTOCOL */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 74ef923d1d67..dfd06dd31e4a 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -574,6 +574,60 @@ int efi_disk_create(struct udevice *dev) return -1; } +static int efi_disk_delete_raw(struct udevice *dev) +{ + efi_handle_t handle = dev->efi_obj; + struct blk_desc *desc; + struct efi_disk_obj *diskobj; + + desc = dev_get_uclass_plat(dev); + if (desc->if_type != IF_TYPE_EFI) { + diskobj = container_of(handle, struct efi_disk_obj, header); + efi_free_pool(diskobj->dp); + } + + /* + * TODO: Can we use efi_delete_handle() here? + */ + efi_remove_all_protocols(handle); + + efi_remove_handle(handle); + free(diskobj); + + return 0; +} + +static int efi_disk_delete_part(struct udevice *dev) +{ + efi_handle_t handle = dev->efi_obj; + struct efi_disk_obj *diskobj; + + diskobj = container_of(handle, struct efi_disk_obj, header); + + efi_free_pool(diskobj->dp); + + efi_remove_all_protocols(handle); + + efi_remove_handle(handle); + free(diskobj); + + return 0; +} + +int efi_disk_delete(struct udevice *dev) +{ + enum uclass_id id; + + id = device_get_uclass_id(dev); + + if (id == UCLASS_BLK) + return efi_disk_delete_raw(dev); + else if (id == UCLASS_PARTITION) + return efi_disk_delete_part(dev); + else + return -1; +} + /** * efi_disk_is_system_part() - check if handle refers to an EFI system partition * From patchwork Mon Oct 4 03:44:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515147 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062777imy; Sun, 3 Oct 2021 20:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWtxbL3bryNRZTyEwyDupsCta4aFr4xvs8f46g0G6Tt9vgjoC2TX/gdNiU0bRafW7e4qxJ X-Received: by 2002:a50:ec08:: with SMTP id g8mr12090188edr.303.1633319315278; Sun, 03 Oct 2021 20:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319315; cv=none; d=google.com; s=arc-20160816; b=VuxdHNvsOtKFEJPSgkWeaVqOhhKTc8h8CgfWxvoDX0D4Q8eYdeOzDly4qxQ6Epd2IB H8tl7nML9xhlrs3CEGy8X/LdQzjEu4we38Mr3o7lTnNHiFD7TcNJUf09DOEFzJUtOq57 B3E8wvkOjOWK870Jq4CdI+tIsvXDIkVM+HxStbWkIVQD7qoDvPHZ1GFTjs827Z/YRHPV j5/Ce4tpUdl8llmBYS8U2cMZRogw370ausi/aYHfD6av5fnQVuNgUZO7m+mswLIY5iLU NfcqhDZyk4RMKQCcAn3xVDP3C4PMaN6MI2CPx0BFlWUQ8HRDmjxaq1KMMDykLqC3VRxh WKSA== 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=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=ghWpIk6MdZlSj923VDfPC8gQIaTq4apfRJLH2J/nXzDfE6sAEXvCuf0ABrZ48Eg98X KDm41pjxFyc9Tw4E55VkDJJ805CS3BTIo8W1z1GCtaSRpwtgyKYKScLXtH7zW6HMNACp wVNt6MqUJQwnBmrni3V4CTDkQzp26cbpFFqkAWsscFcifnOKqvAHDxP7742Y+m0IlAMZ EJzZCczWvc7VbAclSMaAHLXkRjo4LQcG6m3titpoMaA6XRm+7r77cFBTCkWP6AdOay3c 1ih1ntze/3tydCHILLRdQVAG5NX1q/iTSFjWaATQqiYzU9e573sGZ/JniuUyrGK1THft arnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VPwtCuEk; 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 s11si18721502edh.626.2021.10.03.20.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:35 -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=VPwtCuEk; 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 AC6C4835A6; Mon, 4 Oct 2021 05:47:05 +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="VPwtCuEk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A0B7C8358A; Mon, 4 Oct 2021 05:46:42 +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-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 A826F83573 for ; Mon, 4 Oct 2021 05:46: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-pl1-x630.google.com with SMTP id x4so10179778pln.5 for ; Sun, 03 Oct 2021 20:46: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=VPwtCuEkvZA4HwsNu7LkNH74Pcx82TJ9pIXGO7xmrTMoGJh/jMf7Ml36C5MoqcQ1j5 Mny+zlwHNIoCbtkiKVp0S1Xl1b1DnQMSssD3LXJ2ElthmDPrY8TfoTU9qb2ssyAhXvdf v9UyOMGcbxQ+ZGrhJ2vfgg/3OnS4nwYAGdU+3JpG0HFjGGMwsRvtfOL54wP4rdZZkfEN ao3O7wRqerodXzQZ4m5oEdr/fOeJCDn8IwAFqj19vxGa1biLhNRryWgOtSSxnSyeWWnE fHUg8BPegwzoyJVfKhVK6BT5Z9+E7by69IhXQvfcvG32MOvCqfCABPe1ruyIVmJ+jSXw ICEw== 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=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=JSiXok6/5IramPaFtradPaSJwvF8+dmhNWqCylxvn8m1/n55K+YcdqjNO4mfkklmf/ ijd0kTakmqYhQC502XxtbGsQkPcMnQGGahss055MK5bJgKwnecs/VfiG92DolGky9Neb dZkzKcC4aEkbBZpVBmr2Ix6iqxh1DV6ZSM5Y9vAPq0IYLwc+CtbkQIyOEmsfAR1sG8ew zr1epvd2/wiu+GNWm3nBVN91YRfEbd2toecYWAR0q8rfHRt4evyrLklfc3i8w3VpRNN1 6w+QX+Awq4pqIwlx/acUQrJpi7pbuTrF066fikS/S5NYvPCJz9Ok/nF5hX900Y/zMS9L pBrQ== X-Gm-Message-State: AOAM533P7t4OMR+e1ZZ8UTtbSAIlBGLgf3QGh4JZueI4DlCsgldtaEYw Rh3tWeKQrctCqyF2UbcDMU55WlFNsJKZJQ== X-Received: by 2002:a17:902:b909:b0:13a:2d8e:12bc with SMTP id bf9-20020a170902b90900b0013a2d8e12bcmr21168368plb.6.1633319192047; Sun, 03 Oct 2021 20:46:32 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:31 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 19/22] dm: blk: call efi's device-removal hook Date: Mon, 4 Oct 2021 12:44:27 +0900 Message-Id: <20211004034430.41355-20-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Adding the callback function, efi_disk_delete(), in block devices's pre_remove hook will allows for automatically deleting efi_disk objects per block device. This will eliminate any improper efi_disk objects which hold a link to non-existing udevice structures when associated block devices are physically un-plugged or udevices are once removed (and re-created) by executing commands like "scsi rescan." Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index ce45cf0a8768..b8ad267c6c61 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -847,6 +847,16 @@ static int blk_post_probe(struct udevice *dev) return 0; } +static int blk_pre_remove(struct udevice *dev) +{ + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_delete(dev)) + debug("*** efi_pre_remove_device failed\n"); + } + + return 0; +} + static int blk_part_post_probe(struct udevice *dev) { if (CONFIG_IS_ENABLED(EFI_LOADER)) { @@ -861,10 +871,21 @@ static int blk_part_post_probe(struct udevice *dev) return 0; } +static int blk_part_pre_remove(struct udevice *dev) +{ + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_delete(dev)) + debug("*** efi_pre_remove_device failed\n"); + } + + return 0; +} + UCLASS_DRIVER(blk) = { .id = UCLASS_BLK, .name = "blk", .post_probe = blk_post_probe, + .pre_remove = blk_pre_remove, .per_device_plat_auto = sizeof(struct blk_desc), }; @@ -937,6 +958,7 @@ U_BOOT_DRIVER(blk_partition) = { UCLASS_DRIVER(partition) = { .id = UCLASS_PARTITION, .post_probe = blk_part_post_probe, + .pre_remove = blk_part_pre_remove, .per_device_plat_auto = sizeof(struct disk_part), .name = "partition", }; From patchwork Mon Oct 4 03:44:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515148 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062827imy; Sun, 3 Oct 2021 20:48:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ+wvZZl9gAsS4+YeUURCWU+UwbquYV9KIdvoaxo/OWXlAV1ACLvMgxU4EoS5kG3jSuHNI X-Received: by 2002:aa7:cd90:: with SMTP id x16mr16444749edv.148.1633319324972; Sun, 03 Oct 2021 20:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319324; cv=none; d=google.com; s=arc-20160816; b=qGh3eMPIbQ45aicpxXpAu940S5erAQPgvzUUAuEXAG0zPSrDH4295oU61jIq1npLdS ZpFoyLGGU4I+jfaJUH0l80PjR/BtvbJKaL7h0BxslXICPYDOB3rM7xe30ZDNr373t2T2 VG8TacZBj4jmkvZkx1s8I++xuS7iG6vgibbMgWd5uBBrRda92sMXNRH6DLWk86MAzkb3 +Pn5OClUhQscC7W0I/385207u4HaM8aDCaHbIYNb5aGFIdLGqFtOcuwy0ji35lkySASO N/BUQFuPGQPAYqILrnQsiCp5cMQmU6QAM7xjQ6XHyIN3uIK4CedCtBAyowIatHZw9bRw CIWQ== 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=YrQ0zQfK6xopCyFsakNibpnVNyGMpKui4X/QiOxRkwE=; b=IMLou01UVX32J00wisgTmtBYHStTf0SPA0gx7glrqUOWv5UyoAiKtT80e7jjt5XSYy aEAhrNcs6wjSbo4Mwd/ZM5NiSdOWY8RpBGjsncPCT08MhsVbMD6HNvqIxRyuCZ89QrSk 6Xl6I2Pt+wmGAALFi8E2s4raI51jc+CD2/ZiZG9DKPkCAdNBAt27tqTy3E4S3BPbd3Iy OApyDe5fvAENJXsNOCUCO/fzyDWoQ22oym9ksebb8cMrtnTumDDxPjCJ63wk14g9485u p6dyaKc7N0Nr5zqhNN0tTJFtBdOGtdLRr3wbzSjF2GKjum41CHZUmlnPlgSQQ9vjymKh zeOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="P/VMh4Jv"; 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 dm15si11397755edb.88.2021.10.03.20.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:44 -0700 (PDT) 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="P/VMh4Jv"; 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 C53DF835AB; Mon, 4 Oct 2021 05:47:10 +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="P/VMh4Jv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A2557835A8; Mon, 4 Oct 2021 05:46:45 +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-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 F0A818356D for ; Mon, 4 Oct 2021 05:46:38 +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-pj1-x102e.google.com with SMTP id pi19-20020a17090b1e5300b0019fdd3557d3so465152pjb.5 for ; Sun, 03 Oct 2021 20:46:38 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=YrQ0zQfK6xopCyFsakNibpnVNyGMpKui4X/QiOxRkwE=; b=P/VMh4JvSBSxpQVoFezL4uknosMthGGEiyvgTDwBwizaR7f6SamzbrP3I0+6Wa8OPO MIcJ0xbyK0gq9cn9kwkFtQv2gRv5DJ2rSLtAkm8ns/UzaI1eRXXpvh1tvhWfSucz//gY KoSAf2ep2WmQpraINSC18LtDgNZ38D2aCmEDUKLXVF2LXMPp2dwjEePVJbolPGSobVRS xwjgRbUiQiOe8qFaMjNzbybBB5TKej1xYUADcwkeJwyWf162MyDYtSdA/aKd87haGlkH DRY8w/7soyEGUBEoY2b8gDY4sQhQV79W+OT1fvCnoL1YQqkGGZ25DMlWtkut4BGeXrZ+ J7Zw== 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=YrQ0zQfK6xopCyFsakNibpnVNyGMpKui4X/QiOxRkwE=; b=DUhV0UxS2bh8yQ/ZqD50KNAj76YW+bCkZJBWFYh0fdCUgqpGWDOGreAGb/3c8RxPIG iGBD3zPrqwVQW/f+SL4oIq9eEUIKJfdHbUN2MF1rc2sGvNRDtWIkocJc8YOxLzc2IpPZ H7N23QdLtQHbS5lgqdFQEIPTDpbiNon3fG2b4sxICBImSZD0Y/m50otou2tJLfiuJ+pO 72RghlhAR9tHmGvrEBI+HLR+VIQ/5ubnRhR+8sauEvRnzziI9d0ReXqvHP9igEL8fIav GbRCmuLzPs32oMLbaZrk9dhSt3/BvNfZGBwA+Jp9WcjzrEanzA73p/PmfALERnG3ie8T uZKw== X-Gm-Message-State: AOAM531JApQSigRnIBr1Azuclh6qftU92xFcwjT2cyhq6T853WdLa5Ux qL2ppzSbJ2y0Qk85Ghq4a02i5A== X-Received: by 2002:a17:90b:4b85:: with SMTP id lr5mr12483345pjb.66.1633319197336; Sun, 03 Oct 2021 20:46:37 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:36 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 20/22] efi_driver: align with efi_disk-dm integration Date: Mon, 4 Oct 2021 12:44:28 +0900 Message-Id: <20211004034430.41355-21-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Signed-off-by: AKASHI Takahiro --- lib/efi_driver/efi_block_device.c | 6 ++++++ lib/efi_loader/efi_device_path.c | 29 +++++++++++++++++++++++++++++ lib/efi_loader/efi_disk.c | 12 +++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) -- 2.33.0 diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index 0937e3595a43..b6afa939e1d1 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -173,6 +173,12 @@ 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(). + */ + bdev->efi_obj = handle; + ret = device_probe(bdev); if (ret) return ret; diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index cbdb466da41c..36c77bce9a05 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -628,6 +628,35 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) return &dp->vendor_data[1]; } #endif +#ifdef CONFIG_EFI_LOADER + /* + * FIXME: conflicting with CONFIG_SANDBOX + * This case is necessary to support efi_disk's created by + * efi_driver (and efi_driver_binding_protocol). + * TODO: + * The best way to work around here is to create efi_root as + * udevice and put all efi_driver objects under it. + */ + case UCLASS_ROOT: { + struct efi_device_path_vendor *dp; + struct blk_desc *desc = dev_get_uclass_plat(dev); + /* FIXME: guid_vendor used in selftest_block_device */ + static efi_guid_t guid_vendor = + EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, + 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xb7, 0xb8); + + + dp_fill(buf, dev->parent); + dp = buf; + ++dp; + dp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; + dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; + dp->dp.length = sizeof(*dp) + 1; + memcpy(&dp->guid, &guid_vendor, sizeof(efi_guid_t)); + dp->vendor_data[0] = desc->devnum; + return &dp->vendor_data[1]; + } +#endif #ifdef CONFIG_VIRTIO_BLK case UCLASS_VIRTIO: { struct efi_device_path_vendor *dp; diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index dfd06dd31e4a..e7cf1567929b 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -562,11 +562,21 @@ static int efi_disk_create_part(struct udevice *dev) int efi_disk_create(struct udevice *dev) { enum uclass_id id; + struct blk_desc *desc; id = device_get_uclass_id(dev); - if (id == UCLASS_BLK) + if (id == UCLASS_BLK) { + /* + * avoid creating duplicated objects now that efi_driver + * has already created an efi_disk at this moment. + */ + desc = dev_get_uclass_plat(dev); + if (desc->if_type == IF_TYPE_EFI) + return 0; + return efi_disk_create_raw(dev); + } if (id == UCLASS_PARTITION) return efi_disk_create_part(dev); From patchwork Mon Oct 4 03:44:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515149 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062883imy; Sun, 3 Oct 2021 20:48:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6txPfqlvInYufEyJEeqjLxfo1rNqMJGFsLa6vWuc0sGTyDxLtjIm7kD3DlB5uzkdeQcyC X-Received: by 2002:a17:906:1b08:: with SMTP id o8mr14792468ejg.21.1633319334585; Sun, 03 Oct 2021 20:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319334; cv=none; d=google.com; s=arc-20160816; b=NiUlCwZL8p9PiQepls80Cs1yTP8D/EIYwM7OzaLmoq5iylXgVb/Ys8zG2dD9D6ODIg 8EKXYCtCY1AtF1YKVzZGYdZuf3h9xUAaSiGL0YJYyMUoo2n8wb6wwmMbdQyZWUQ7IQoH Qb+xncM7tf4TrnCxRyXXzQL4yUKpGa7p2MOrTjI+Nt+t/2ggkryloETBK+vTQbxzScuC +R143atDfCtYikQKiD7p6SXxIPtqbIAgBzGdWcoiLsErggncNcK5wv5MAN7jI3fEThVA 9DQFsHo996xX7ezk+KQgIRVfaQgPT2uXj8JPTRfks/9kjRV0Gd9c/dBjDAwFlv06gq2w yATQ== 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=6MEGdxi745RsEp0C1/1GgabgXJFBoip4chk54RcwxKw=; b=lWwF/pI6FtR07SRbxNrkOQmDoXxOk5eUpcfJyVHnViOk+HWYfQaN2j5hoj6K+ygqd1 P1UHUUiwZQIMSgRwbkibj33R3WdwLy58581Ur7dBnNEczzTXIhu/bkJWRDKUuZIV1pw5 MFl8mhB0aniCa0EKN4NoOaS+aZtAv6O2tLPKkwoIo8VHGRdq4uvCLKNlDvZ5yGTF4Kqs adkddmyGwY9h9VC+RQqTXiqKjxEhvdcU4tKei3pcn7+EGXd8B0augArZC4EXszqWIFBv G38tJpfDobYiZbxMGapJzdpGFOAovzzp7NzR7/9I6AI8Qw868YUA/sn1pOKoQ4p9WiZ2 de5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4oF55Gk; 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 r17si4735616ejc.105.2021.10.03.20.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:54 -0700 (PDT) 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=S4oF55Gk; 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 D2AA283589; Mon, 4 Oct 2021 05:47:12 +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="S4oF55Gk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75FA18359E; Mon, 4 Oct 2021 05:46:53 +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-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 44574835A7 for ; Mon, 4 Oct 2021 05:46:45 +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-pj1-x102e.google.com with SMTP id np13so575868pjb.4 for ; Sun, 03 Oct 2021 20:46:45 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=6MEGdxi745RsEp0C1/1GgabgXJFBoip4chk54RcwxKw=; b=S4oF55GkH4drZm8eFlZy7yh6YIyMj7EEmZnJn9cuyMSafQa16bK3QbY1x+BwVRyhLO Oo2YvHPPoJVnE6bxkWI5mGjzliopaWZWCsUcH9AuxsNtp11otUBXF/lPdbzs6niG0Hu6 R+lAwyDooBY2S7+Hkipm4h8IrZfI1ksdph58ZW/XGPLmBOtOOfdfbcpGrgW/iwpSsKds 88cynWlUeECyj4xRXq8rKGXylMCiwTH6ZSEUnC0sFOOIT5nYYkM04sgTcCRA4vNyFVt0 XxK64cj6tKbAlYNgIaZsDl+zHAVf5Vo8MljS1kkxgCwaB6DWVN5v04jHkCeXb+HlvYt3 W7Vw== 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=6MEGdxi745RsEp0C1/1GgabgXJFBoip4chk54RcwxKw=; b=Rv7ffsc4OheZ6obfkX8UZpOyH75vMXkscsOTkhtS3+bW5BLvZi/VP26atIB21lmlgr 3+aSm14NO6C2aIIIxobX9S2mHJiH60FRdp/X2EgsVvY4Z/IM8F2chnq+56S/I3iKOeCH a4ozwwjBr4in2bbF8T/ksfzXAuaJfAWbbLHP5NZi49sA3KmN4uwNg+sjOG9jJntCtZUE vq4ZZwPSSlP/teMV/JJEUUqYtj92QSyzHgTEVunaCe4xqEeyuubo2s4r/h7xPnxba9Bo i8KA6tM4L1RfLdhrhlIqPfkLUtKhp3sZ/j1uOuOGYanFA/NPrJOOLXlS2qxXwiPI+3fV MLLg== X-Gm-Message-State: AOAM5325PkhbH7VQGzoSrt4YbckRc+qVKY50g8zl2X+8OZvl/7MDLJEj G3MKEyAaha61P6FKqk8MVMKD4w== X-Received: by 2002:a17:90b:3ec3:: with SMTP id rm3mr26516009pjb.93.1633319203506; Sun, 03 Oct 2021 20:46:43 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:43 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 21/22] efi_driver: cleanup after efi_disk-dm integration Date: Mon, 4 Oct 2021 12:44:29 +0900 Message-Id: <20211004034430.41355-22-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 efi_driver-specific binding will be no longer needed now that efi_disk- dm integration takes care of efi_driver case as well. Signed-off-by: AKASHI Takahiro --- lib/efi_driver/efi_block_device.c | 24 ------------------------ 1 file changed, 24 deletions(-) -- 2.33.0 diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index b6afa939e1d1..1f39c93f7754 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -106,25 +106,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 +120,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); @@ -184,10 +164,6 @@ static int efi_bl_bind(efi_handle_t handle, void *interface) 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; } From patchwork Mon Oct 4 03:44:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515150 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062963imy; Sun, 3 Oct 2021 20:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdL4p76iN0CjWNj+rItIjLaJvLi/iLyVNnBagsj/b2AuU9JPVeuUwNxuG9X1qLRoWxRGzJ X-Received: by 2002:a17:907:a411:: with SMTP id sg17mr14744561ejc.412.1633319344471; Sun, 03 Oct 2021 20:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319344; cv=none; d=google.com; s=arc-20160816; b=tlBqA8sosem9g3bboeCtyqMl/bfObaUqjVtnKj8vTc8HdXV7r+JM+2Izgxtsaidpqu lyT7mHdNlwxTGEK80MJo9R2+5FcCH8OiEqSAPoHFTminefifsGQHG8Q4MtxNFU7xGk2q uPFL9jRFRUSXUxapf3305HXOCTIFxt5XyBG/8FczXCuW5WrUdUEnp6bwasVs+sZFmy6N l9gO4tMmVNNQcfp54LgUNHEpcEbh0YZ3ZlFqSpzRGm/wp41TVUV6sN4k3EnVLNl0WWXa JNnM+ts9sRBQqsskoQZZFioifqXhk6Ia+kmOSVLCBwvjDUgP59ndaUVtXKpAwiqgFCv+ TqKg== 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=+HwM0pXE5H//wzI2I7f49WFGakpJIBZDqVibn5c+sFg=; b=HFt3yVcFQeD9B+0Qx1dJduAjC3BvsLABoWiO+jm8xSlDS4JpJQjkZhSb9H/HWVZGQP pF6TwUig6QtbBygTaQdDXVixrXC4FYd76t5v20D2R2NDSG+nXRkRFUAiY6Kgry8qDuRg OlJQoN67Atf6Pg82ojzQ5soSe4QYU7zucqjS6HtDtP4ZOHIeB6xSDnPHKGmUrCWInDIy czI0j9k45Z8glmLJTu6odcZSp59gliIpH0a/wmbdwhWzQAP7RceudVTWxZuFr0+uL3qe /+Fe0kB+fGyUc66ZqjeEVmC+VUCY15062RkSa/w0QPPNqnhlcyFYs5Rv3Jq5y7AXC8U9 gEew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YnfEU8E0; 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 d17si3187696ejt.635.2021.10.03.20.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:49:04 -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=YnfEU8E0; 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 DD71C835C5; Mon, 4 Oct 2021 05:47:15 +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="YnfEU8E0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CDF328357E; Mon, 4 Oct 2021 05:46:59 +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-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 DE4C68359F for ; Mon, 4 Oct 2021 05:46:48 +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-x431.google.com with SMTP id q23so13324486pfs.9 for ; Sun, 03 Oct 2021 20:46:48 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=+HwM0pXE5H//wzI2I7f49WFGakpJIBZDqVibn5c+sFg=; b=YnfEU8E0e01Rr2wQL1L9uDkqqbTMkKkDkzRwEBDBnAs6ARnDJmIuBGPEY5kZJ2bhk8 dwogFIMmwFsc/wUEWAuH/byQLJPw4KcLJZfkplfYR92izda1c6oZWr8hECpAP853g0zK D+Fbit6wEeTMel5DhkUX/OgL2HTONh74RgslgDghM0dpF5aaYrjd31xtZ9/wmjMnymWU sA+W8A0dKG7hLeN/3T5uDlAW398Kan7MAFwC4LpgQm/kve5FVpb/ygYOH7iPuQ9H2YkL ZDjw3kr4TH20NOkOu+u0EX8ubMiAs7niV9oIihVaEq3btTO7iQo3dFRS5ipvtKLXRBxa NChQ== 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=+HwM0pXE5H//wzI2I7f49WFGakpJIBZDqVibn5c+sFg=; b=gRXgZxXru68AO5MaWiCHinRBFWaNOg9L2QRzZgo1LMy8PgeUygqPZ+TJ5vgSt6sOrI /Sq6Yr1X7eNU+L+Hu+ZLtpDLfAHqLIG2tK6A7e1r/oAjZVXrSyLAlp1IQuyvD3pFXmGS uVejvEGwZk5mJ5/zdS4jY2yr/6Z/P7z5q5oTbiHDafIMkH+FoH3N4cWYOVSPGGHZAT14 Do2cFN1A1LORDJa1bUZkwOgn1rBKjCEkXrKp+ZhdgWFBGCNj9Ab5EQFPTxw6SeEAzYK4 g3Dn8nkcppFhht1O9qG8Kh2X0zZxVFEee/0t5yiPIF9R4xT0PTepN8uRtbOdzoA7cJYs joRw== X-Gm-Message-State: AOAM5334fKpYM9kvaCI1EKMgiHe4ybY4yTWF3fI0TqLAWaOKj+4i8Kbw bTBfiG2KDWwB8lGAbiNJxtayeQ== X-Received: by 2002:a62:1ac4:0:b0:44c:4c4e:1d3c with SMTP id a187-20020a621ac4000000b0044c4c4e1d3cmr7946306pfa.8.1633319207222; Sun, 03 Oct 2021 20:46:47 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:46 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 22/22] efi_selftest: block device: adjust dp for a test disk Date: Mon, 4 Oct 2021 12:44:30 +0900 Message-Id: <20211004034430.41355-23-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Due to efi_disk-dm integration, the resultant device path for a test disk got slightly changed, with efi_root contained as the first component. Signed-off-by: AKASHI Takahiro --- lib/efi_selftest/efi_selftest_block_device.c | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) -- 2.33.0 diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c index 15f03751ac87..cac76249e6b4 100644 --- a/lib/efi_selftest/efi_selftest_block_device.c +++ b/lib/efi_selftest/efi_selftest_block_device.c @@ -30,6 +30,9 @@ static const efi_guid_t guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID; static const efi_guid_t guid_simple_file_system_protocol = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; static const efi_guid_t guid_file_system_info = EFI_FILE_SYSTEM_INFO_GUID; +static efi_guid_t guid_uboot = + EFI_GUID(0xe61d73b9, 0xa384, 0x4acc, \ + 0xae, 0xab, 0x82, 0xe8, 0x28, 0xf3, 0x62, 0x8b); static efi_guid_t guid_vendor = EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xb7, 0xb8); @@ -206,25 +209,44 @@ static int setup(const efi_handle_t handle, ret = boottime->allocate_pool(EFI_LOADER_DATA, sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path_vendor) + + sizeof(u8) + sizeof(struct efi_device_path), (void **)&dp); if (ret != EFI_SUCCESS) { efi_st_error("Out of memory\n"); return EFI_ST_FAILURE; } + /* first part */ vendor_node.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; vendor_node.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; vendor_node.dp.length = sizeof(struct efi_device_path_vendor); - boottime->copy_mem(&vendor_node.guid, &guid_vendor, + boottime->copy_mem(&vendor_node.guid, &guid_uboot, sizeof(efi_guid_t)); boottime->copy_mem(dp, &vendor_node, sizeof(struct efi_device_path_vendor)); + + /* second part */ + vendor_node.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; + vendor_node.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; + vendor_node.dp.length = sizeof(struct efi_device_path_vendor) + 1; + + boottime->copy_mem(&vendor_node.guid, &guid_vendor, + sizeof(efi_guid_t)); + boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor), + &vendor_node, + sizeof(struct efi_device_path_vendor)); + /* vendor_data[0] */ + *((char *)dp + sizeof(struct efi_device_path_vendor) * 2) = 0; + end_node.type = DEVICE_PATH_TYPE_END; end_node.sub_type = DEVICE_PATH_SUB_TYPE_END; end_node.length = sizeof(struct efi_device_path); - boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor), + boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path_vendor) + + sizeof(u8), &end_node, sizeof(struct efi_device_path)); ret = boottime->install_protocol_interface(&disk_handle, &guid_device_path,