From patchwork Fri Jun 18 10:51:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 463039 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp1348594jae; Fri, 18 Jun 2021 03:51:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyXJQ937q0Tc5rgj73TKSO5vzXj7nDc8/41XVsqUuRdDZqsOQewWPATZ6wgx9CGpJ2avY6 X-Received: by 2002:a17:906:dc43:: with SMTP id yz3mr10519506ejb.323.1624013499117; Fri, 18 Jun 2021 03:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624013499; cv=none; d=google.com; s=arc-20160816; b=Zm0vx/E996p/npo0NVzYwd6ABiGPdekYoTgMRDO3iYX/IVAGrJ+Wl7D+kTYXh1+hGk uyWeFSfiUyTk4UESSwPB1hXT47rZxADL1MVUzrXRMFt8+Zpb4sQaQYU/jan5c+ZuXjd7 XoETmDbmiL9KCRqioUYEQXr6NaBtejM9mGZK37P0ibMmEqLNUpEbXMTKSiHWCRV0gOuN ZRIGkxOiJX5v4EAQnEsjy15HaeOVauHLNULEPfz2gICSHL5c57NKlacMRxspik5n4WYX rJS5SmpcfaAXOSLJZfPJzs3YCgRwlmEGQyyaUUmgcPant3JC+sWKe3+gH+ueQZEIrPuc gRFw== 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=63aMAa1ea3EuSM9LYnngVap96hEqcUchFZJhoaGbXGI=; b=YGFRB5dlyTXzkIIipKD5kuMUmp0gcY171+Yr9AiT9sqU0LsoLJDcB3+Xo73vkS5YVT YqXFkJndSiSq/3a+wxa/KhVgx4KO7P927sTG8kZEsGYMsbhpgDm0DngvSu8LX8kcsr/Q H3BE2wsyZbIkIFVw6W+qEh5tISK9IMwS0tfHf5ku6t0Ke77xlp4Oxlc9RQdQ1D23DlSI JwR47NXKFhMS/iB+EsWLUoAUDrLURAPGLe8z5+izJWAE2M1/CIR8fh1KpJCuosegTpPG xYJ1jNvIaRpAjF5FsR9UwjXYrMzHFk/LTmIOZmERoc1kkA4s+uV8PIRIt7dxjmsYbBkV a+Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NU0pvCgx; 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 cz9si5085341edb.398.2021.06.18.03.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 03:51:39 -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=NU0pvCgx; 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 9CBE382B55; Fri, 18 Jun 2021 12:51: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="NU0pvCgx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 62AA082B89; Fri, 18 Jun 2021 12:51:24 +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-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 2EB4182B33 for ; Fri, 18 Jun 2021 12:51:21 +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-x42b.google.com with SMTP id n7so10289370wri.3 for ; Fri, 18 Jun 2021 03:51:21 -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=63aMAa1ea3EuSM9LYnngVap96hEqcUchFZJhoaGbXGI=; b=NU0pvCgxD1PWWhj+v5w4Ksf0KFsPUxITEhuD7B8Aja3JxmF/WyjT2hOll/CzrFenJx ZqM+olhQEwnBROtd+6kEtg2ziu5PXLXYkWZzBRZmhW8GUKrTxA4F78D3BRHppCwhXCik 7IKnM5ab+28ZTvXOJzVXqubdhYl9mTgYY1grgNzS7rM4bFuEuAKcyQA9Fv7BVTnCaoAs dAIu4x2d5AnLeQNZkHMoQKD6bhLnWwKdGLTHlC7sFmf4VFT59fL4Ujgzyi5WFlNB6d54 joLtT+qtJU/ITRbDkgW+cMS0vC4kpowNbbxiv3dhOe448CO1nCUEUyTWVoPisOMBO4xn oACg== 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=63aMAa1ea3EuSM9LYnngVap96hEqcUchFZJhoaGbXGI=; b=WtOE+8PbLJENRRnybslbQXncnyEq3L/LJMvwzgasm+wldGz9i2zjj8JhMBBwGg8tvz jHFb/Rl2di1Km4pTDUTee5MFWtfT+dhR0DpbsKdnMcOTw31u/ltk5yj0w8BM64m2k4st /X6DataS7gTxJObEsGFHFxrn+ihN65B1KV/1WR//2jqXqTRuNHeVXUBRFODMjvkD2+qs 1Ei/YVxTtZNCDZfiah/s4gnwIAGhROYPnlo9kte58P/ctbq6atRGgUV5RyPKBu31vBrF cYrdgE548PL2Ab8pShK55jPXMN6CdLwY7SviSoH90ZfudJfk3cJ+U72OKgPfvzyVdgDQ IChA== X-Gm-Message-State: AOAM533jp50e7VhMw41BW3MifF6PsKuCZjlJomAi4gtNXfKvaDOnzywi QfyMwcfCsWoeXQkXhKdw9mGplw== X-Received: by 2002:a5d:6a82:: with SMTP id s2mr12154855wru.247.1624013480813; Fri, 18 Jun 2021 03:51:20 -0700 (PDT) Received: from localhost.localdomain (athedsl-269684.home.otenet.gr. [85.73.101.18]) by smtp.gmail.com with ESMTPSA id o18sm11377758wmq.23.2021.06.18.03.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 03:51:20 -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 2/3 v2] efi_loader: Force a sinlge FMP instance per hardware store Date: Fri, 18 Jun 2021 13:51:13 +0300 Message-Id: <20210618105115.257938-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.32.0.rc0 In-Reply-To: <20210618105115.257938-1-ilias.apalodimas@linaro.org> References: <20210618105115.257938-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 Chapter 23 of the EFI spec (rev 2.9) says: "A specific updatable hardware firmware store must be represented by exactly one FMP instance". This is not the case for us, since both of our FMP protocols can be installed at the same time because they are controlled by a single 'dfu_alt_info' env variable. So make the config options depend on each other and allow the user to install one of them at any given time. If we fix the meta-data provided by the 'dfu_alt_info' in the future, to hint about the capsule type (fit or raw) we can revise this and enable both FMPs to be installed, as long as they target different firmware hardware stores Note that we are not using a Kconfig 'choice' on purpose, since we want to allow both of those to be installed and tested in sandbox Signed-off-by: Ilias Apalodimas --- configs/xilinx_zynqmp_virt_defconfig | 1 - lib/efi_loader/Kconfig | 45 ++++++++++++++-------------- lib/efi_loader/efi_capsule.c | 12 +++----- 3 files changed, 26 insertions(+), 32 deletions(-) -- 2.32.0.rc0 diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index e939b04ef6a5..0c2d1a70a5a1 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -188,5 +188,4 @@ CONFIG_EFI_SET_TIME=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_ON_DISK_EARLY=y -CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 6242caceb7f9..684adfb62379 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -161,6 +161,28 @@ config EFI_CAPSULE_FIRMWARE_MANAGEMENT Select this option if you want to enable capsule-based firmware update using Firmware Management Protocol. +config EFI_CAPSULE_FIRMWARE_FIT + bool "FMP driver for FIT images" + depends on FIT + depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT + select UPDATE_FIT + select DFU + select EFI_CAPSULE_FIRMWARE + help + Select this option if you want to enable firmware management protocol + driver for FIT image + +config EFI_CAPSULE_FIRMWARE_RAW + bool "FMP driver for raw images" + depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT + depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT) + select DFU_WRITE_ALT + select DFU + select EFI_CAPSULE_FIRMWARE + help + Select this option if you want to enable firmware management protocol + driver for raw image + config EFI_CAPSULE_AUTHENTICATE bool "Update Capsule authentication" depends on EFI_CAPSULE_FIRMWARE @@ -181,29 +203,6 @@ config EFI_CAPSULE_AUTHENTICATE Select this option if you want to enable capsule authentication -config EFI_CAPSULE_FIRMWARE_FIT - bool "FMP driver for FIT image" - depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT - depends on FIT - select UPDATE_FIT - select DFU - select EFI_CAPSULE_FIRMWARE - default n - help - Select this option if you want to enable firmware management protocol - driver for FIT image - -config EFI_CAPSULE_FIRMWARE_RAW - bool "FMP driver for raw image" - depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT - select DFU - select DFU_WRITE_ALT - select EFI_CAPSULE_FIRMWARE - default n - help - Select this option if you want to enable firmware management protocol - driver for raw image - config EFI_DEVICE_PATH_TO_TEXT bool "Device path to text protocol" default y diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 71d3d1e523ce..6d9f6aee237e 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -918,15 +918,15 @@ 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; + __maybe_unused efi_handle_t handle = NULL; efi_status_t ret = EFI_SUCCESS; if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)) { @@ -975,10 +975,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.