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 8EF6EC433F5 for ; Sun, 10 Oct 2021 14:17:10 +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 09B6C6058D for ; Sun, 10 Oct 2021 14:17:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 09B6C6058D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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 C377D836EC; Sun, 10 Oct 2021 16:16:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aLiKkwHe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2FA09836B4; Sun, 10 Oct 2021 16:14:59 +0200 (CEST) Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) (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 D30F5836A8 for ; Sun, 10 Oct 2021 16:14:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-oi1-x22b.google.com with SMTP id g125so14161577oif.9 for ; Sun, 10 Oct 2021 07:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aoFN66ZaFoVPOEsWDE/RDP8KC8dKp3cWDKdynKrM2is=; b=aLiKkwHekbwOljmQMgOXH29fbGT2Kd634PRcMrGAtnjHoPHaWHQs3Kjrumd6ISRDOO J/bdfjfXthDVxlNRTFDtHy+lD+UG0ke198TXGDfa8hyoqAugBwn+8hnokxz+LZRnZBeB EgXsSv4fPyZiwNRnqL0rEXlAEKBBi9/3Sbxps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aoFN66ZaFoVPOEsWDE/RDP8KC8dKp3cWDKdynKrM2is=; b=g5ms89UmpMr8N0mEYy5Fo7O758K7iNdX2lwvs4cyvpkXrNnfiuF5EPa4xQA2Gtz1yq 6L6fX1JOvG8amrWhJMaSdYEn7Yv0Gn08I/7fU9GcGRcnn+X32gAqRuXpbgsTZP82dpHB 4nmrtP05DGwyw80GJMpbee3PhBDTUFtYVz6/JURwJYOgOfxkK7tX+gkVeA8fd1NodTLI Yq5F9FCd37+g9Us7s9UqoH+6Snw5mi1T56/iJSsPgyJAAf9GrhfZqmbLDGLIoSOa1BIt 2B6MnNYyJBgeIHxEeYJ70p1DBZ5OHt6tuFv4/qHT6DW83ui9wemmkalwWxKb3Tu5Gj8R G52A== X-Gm-Message-State: AOAM532aDz3w6JKfT7+zq15jBvOOJN0iRxRTflKVb9YG7Qtc4rv6GFPM xxUiJqoRr+O8qpy2QJ50keJVGse+3UpFcDy2CAWWSg== X-Google-Smtp-Source: ABdhPJyRbgMXtmfb81J7KgDsLoPg8uh2Z1c3f4WFt5B1N+d9aTguK+ipKARlA+ukcJtmPuggDqom4iW8A63aH2Q0ZeQ= X-Received: by 2002:a05:6808:309e:: with SMTP id bl30mr22762979oib.81.1633875282235; Sun, 10 Oct 2021 07:14:42 -0700 (PDT) MIME-Version: 1.0 References: <20211001050228.55183-1-takahiro.akashi@linaro.org> <20211001050228.55183-40-takahiro.akashi@linaro.org> In-Reply-To: <20211001050228.55183-40-takahiro.akashi@linaro.org> From: Simon Glass Date: Sun, 10 Oct 2021 08:14:30 -0600 Message-ID: Subject: Re: [RFC 20/22] efi_driver: align with efi_disk-dm integration To: AKASHI Takahiro Cc: Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 Takahiro, On Thu, 30 Sept 2021 at 23:05, AKASHI Takahiro wrote: > Can you please add a commit message as I am not sure what this patch is doing. > 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(-) > > 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 In what way? If it is just a test we should be able to update the test to avoid the conflict. > + * 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); > -- > 2.33.0 > Regards, Simon