From patchwork Tue Jun 22 14:38:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 1495738 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vZyHtUaV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8TZ008Yzz9sRN for ; Wed, 23 Jun 2021 00:39:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2232882A01; Tue, 22 Jun 2021 16:39: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=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="vZyHtUaV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0BE5B80F32; Tue, 22 Jun 2021 16:39: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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450: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 51A5480F32 for ; Tue, 22 Jun 2021 16:39:02 +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=ilias.apalodimas@linaro.org Received: by mail-wr1-x434.google.com with SMTP id e22so20409384wrc.1 for ; Tue, 22 Jun 2021 07:39:02 -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=rpupr+k/yt0P3GX+hB+UHAUSqZjF5B/VtiJg7HWUyo8=; b=vZyHtUaVUkcNCW//5H92o22mJ9YGwQrb0wMnU4psVspMO4pdEf7L7ndTsYbLaaqy24 pq6S4dysooTRsO77xcHWK0+nUXnFFcnA/Z19clF4cupjs0cXARl2rYS4LTd9z8Eq7E1s P0/0kYY+fLLhtXHZFLaXOSEwlSvi2uWf03IiYa2i6GyYXPv43FctxGWkPfnnROn+MDnE AkESKsgsoVKbiCxjQt+yhmWgH328RglSQkRuNEa22y168oiUvi1OGcXO0LOkegCDpMzn 8vY0ep2dmk1FqWkrqHbCA/B2IAl4pLnD8lKaRSRaADpt253VtktI362mehuxMAzvcvcc cEcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rpupr+k/yt0P3GX+hB+UHAUSqZjF5B/VtiJg7HWUyo8=; b=GwA49cOZ8eIsi89RZe9bQfkY6MnZ+OGBhiULcQWFzIsDSTXllQ5GYwulHGXV+KGSla WG9c5bfUFI6p7kEujuOCwt9nYrgLtd9MjXLEmjj1SSy/mXWXsaMOGBUrYK1y7N0Woylf lD4maQB2ca8pAXEdiaMI16bQYtEYz+FTODFRFtO/NdcgvFZu30gujcBvAfoE7sWZfd3Q NV6Gjjjd4Ir+4TbI3rH33jCIOTehJ9+ykTs8GzVE6fZQbw7+QOyvsE38hjrXu0v4CIQI eJNfTHg73Bf/gVcuHmPemDE0tloJjp1cyK16vWm7Tmioj25QPeseBWKWw1FTjYYhWyPH S0gw== X-Gm-Message-State: AOAM5339+ByvTa6WOKmIISnFEB3lRPuc44fXtkYBg7WEmw9FsNJOn40/ 2FUnn9baG0mKWXLafrcVF05Vzg== X-Google-Smtp-Source: ABdhPJyP7nMfNlbUgBj2eIFBMQQGzdpxwmX/ucZEgdu3XqtBi3UenROiUGqY+Ez/WIy+gW7geiDemw== X-Received: by 2002:a5d:40c7:: with SMTP id b7mr5236307wrq.224.1624372741799; Tue, 22 Jun 2021 07:39:01 -0700 (PDT) Received: from localhost.localdomain (athedsl-419796.home.otenet.gr. [79.131.191.210]) by smtp.gmail.com with ESMTPSA id y17sm2615009wma.48.2021.06.22.07.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:39:01 -0700 (PDT) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: masami.hiramatsu@linaro.org, takahiro.akashi@linaro.org, Ilias Apalodimas , Michal Simek , Alexander Graf , u-boot@lists.denx.de Subject: [PATCH 3/3 v3] efi_loader: Always install FMPs Date: Tue, 22 Jun 2021 17:38:53 +0300 Message-Id: <20210622143854.15682-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.32.0.rc0 In-Reply-To: <20210622143854.15682-1-ilias.apalodimas@linaro.org> References: <20210622143854.15682-1-ilias.apalodimas@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 We only install FMPs if a CapsuleUpdate is requested. Since we now have an ESRT table which relies on FMPs to build the required information, it makes more sense to unconditionally install them. This will allow userspace applications (e.g fwupd) to make use of the ERST and provide us with files we can use to run CapsuleUpdate on-disk Signed-off-by: Ilias Apalodimas --- Changes since v2: - Changes since v1: - Only install the FMPs if CONFIG_EFI_HAVE_CAPSULE_SUPPORT is selected include/efi_loader.h | 1 + lib/efi_loader/efi_capsule.c | 11 +++-------- lib/efi_loader/efi_setup.c | 6 ++++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 0a9c82a257e1..b81180cfda8b 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -972,4 +972,5 @@ efi_status_t efi_esrt_register(void); * - error code otherwise. */ efi_status_t efi_esrt_populate(void); +efi_status_t efi_load_capsule_drivers(void); #endif /* _EFI_LOADER_H */ diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index cc6ed453ed21..d7136035d8f9 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -919,13 +919,13 @@ static void efi_capsule_scan_done(void) } /** - * arch_efi_load_capsule_drivers - initialize capsule drivers + * efi_load_capsule_drivers - initialize capsule drivers * - * Architecture or board specific initialization routine + * Generic FMP drivers backed by DFU * * Return: status code */ -efi_status_t __weak arch_efi_load_capsule_drivers(void) +efi_status_t __weak efi_load_capsule_drivers(void) { __maybe_unused efi_handle_t handle; efi_status_t ret = EFI_SUCCESS; @@ -976,11 +976,6 @@ efi_status_t efi_launch_capsules(void) index = get_last_capsule(); - /* Load capsule drivers */ - ret = arch_efi_load_capsule_drivers(); - if (ret != EFI_SUCCESS) - return ret; - /* * Find capsules on disk. * All the capsules are collected at the beginning because diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 3c5cf9a4357e..2dc6ba8337a7 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -254,6 +254,12 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; + if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) { + ret = efi_load_capsule_drivers(); + if (ret != EFI_SUCCESS) + goto out; + } + #if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO) ret = efi_gop_register(); if (ret != EFI_SUCCESS)