From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4724CC433EF for ; Mon, 11 Oct 2021 03:15:36 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B657A60F38 for ; Mon, 11 Oct 2021 03:15:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B657A60F38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A129D836C5; Mon, 11 Oct 2021 05:15: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="drczhsjZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6C4A836B3; Mon, 11 Oct 2021 05:15:30 +0200 (CEST) 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 B12C0836B3 for ; Mon, 11 Oct 2021 05:15:26 +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 d13-20020a17090ad3cd00b0019e746f7bd4so13712876pjw.0 for ; Sun, 10 Oct 2021 20:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=A3OP3QkE2JUhmse4xgQUN01dxq7WtzOEJDyZnoShSBE=; b=drczhsjZl8KxMuPZz6fQLQcU3E6t2krniV/8MD3jXFOcpaGGvUodibTTwzpkqlw0Vt e9OeYw4UttK2g+5vloJ8Eq1bCuez6d2fUE/F13BIF96Bq2plqkdjVQEVRE6XSHp+BFah qFhXyjvVK7OZtvcNCizA1sE8cuzdK7revawsyig8EUgOcwtne40akpSfs/1XhVnurOta aDeq6UHGl+dmLWKrht+ZyipwIf06Kx493UuHq+MwmFCRI2rmcNDX/jGH4Vl8S7dwwZM6 Z8VTm7f1e6uDdo2afZnS41mqfb1kJGhWx68EB5uVGeTwxetHZkd468ScrNJ6nL7pPh2F X96Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=A3OP3QkE2JUhmse4xgQUN01dxq7WtzOEJDyZnoShSBE=; b=y9a0KGqGGenCP+XfJmAUmgfiTwxWXRXjHwl2r09hUhG+zupyUeYAvSBzNQKzbT+rh0 Fk7G78eStSIQ1ybjHEMnuZCd7jEZWDyY9/ToyFAoXb9blW+37Or0IcMIYYJxI/ZcoK0C ch6PWwiZAyFFbw9SCDz7+o76aK3R1IlsRnSfSFqAWqioDKdeqJ5SF2ldIbBq2yLHZFf2 Fdis46De4eLLt9wdvQNnSD7Cq4/mxwQV4ZwktnJYEn5xisJ5KLPdZBTIchDkuajWHkKc lGFxGjdpvkkL7ezJuKfWNi3O5JKfal9eWdI2oTy7VjhZTlZ/BjMPG7y3N5r+d1nACiBU 3GWQ== X-Gm-Message-State: AOAM5327dltBwuFHhcR0VKFKhnCY7GLjvngvur6NNBxXXfb0Wizv0+WY SzVQPN8gr/lVxqWp8lKOqOfY6w== X-Google-Smtp-Source: ABdhPJxIG1vn7+A6UqGuMLsZTG6NGLqvHRVNe1Mc/UYi8oD69wv1BvBscRaL5bMt7/WZFcvMfeH2RQ== X-Received: by 2002:a17:90b:694:: with SMTP id m20mr15976501pjz.160.1633922124817; Sun, 10 Oct 2021 20:15:24 -0700 (PDT) Received: from laputa (122-100-26-39m5.mineo.jp. [122.100.26.39]) by smtp.gmail.com with ESMTPSA id i123sm5942504pfg.157.2021.10.10.20.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 20:15:24 -0700 (PDT) Date: Mon, 11 Oct 2021 12:15:18 +0900 From: AKASHI Takahiro To: Simon Glass Cc: Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List Subject: Re: [RFC 14/22] dm: blk: call efi's device-probe hook Message-ID: <20211011031518.GG44356@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List References: <20211001050228.55183-1-takahiro.akashi@linaro.org> <20211001050228.55183-28-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hi Simon, On Sun, Oct 10, 2021 at 08:14:23AM -0600, Simon Glass wrote: > Hi Takahiro, > > On Thu, 30 Sept 2021 at 23:04, AKASHI Takahiro > wrote: > > > > 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(+) > > This is where events come in. We need a way to notify things when > devices go through different stages, etc. I favor your idea of event notification to decouple subsystems from the core block layer. > I am thinking of: > > enum dm_event_t { > DMEVT_PROBE, > DMEVT_POST_PROBE, > ... > }; > > struct dm_event { > enum dm_event_t type; > union { > // add data for different event types in here > } data; > } > > int (*dm_handler_t)(void *ctx, struct dm_event *event); > > int dm_register(enum dm_event_t evtype, dm_handler_t func, void *ctx) > > int dm_notify(struct udevice *dev, enum dm_event_t type, void *data); > > Then the code below becomes: > > dm_notify(struct udevice *dev, DMEVT_POST_PROBE, NULL); > > the implementation of which will call the handler. > > If you like I could create an impl of the above as a separate patch > for discussion. Yes, please. I'm willing to rebase my code on top of your patch. -Takahiro Akashi > > > > 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 > > -- > > 2.33.0 > > > > Regards, > Simon