From patchwork Tue Jun 22 14:38:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 465169 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp715542jao; Tue, 22 Jun 2021 07:39:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3cL9wxw9GvCrAkvgyzGxAN3dSCcjN1ZBmsuNfF0sJWIjQVJZE8i9O+iXtPCTlftr6jJGp X-Received: by 2002:a17:906:585a:: with SMTP id h26mr4379832ejs.31.1624372762771; Tue, 22 Jun 2021 07:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624372762; cv=none; d=google.com; s=arc-20160816; b=aYfzAMpQkWGwR9Bqh2BomDbH2glvZypKiJtTOLjk78VUIpjo9u+srZ8xSo9jmXf7hh xNFK5G0qgtMx85MqVgusZ9xIeOoro8+TtVg5cSrC9MZv96e8C0P0Q8Y0VlInZfa2KW0z ibjZXMGcxc5KQ2J+TaJdxBTtS8WWQTp9uIsQe6RWcJlsA73VVkT9c950jdQfexsOPuPR VL7wNIz0mlYiwisZ0yzRxZY9SmVOJNXZuCGEJd8vfBTNpXi0s+Y+s+4KKso2+ecN1moT CzvNU3dW9B3iA/z50qvp0ODwoO0Qf9X7nPKX0EGgdvdE/Pxg9vioU2gRfs1UnfWdgOHA Ofvg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=sujtLF292oYFVhzMF5y3Tfd2OO0snB1vQaRoWfQRvKE=; b=Az8UkDOaUGbuvBmlDXi2MooGf5oPyvpd8D0gUVPqJxEES53x5jdxTJ40IVCCXPfDoR w0EkBlQKyllNinT40rtLQ0WwcAyvMM2lLbJKHBua2TSBqC4lKxUuOQYu5stM00sNu1kS 8QTGf4e6FGn+jVUnr0ZKKDmCT44UyJ3RG+J4I+rZ2jaTRjegYmnaqRiDtAo2bihAVZqW NuN0BetnXUwZDeRvJX1NcO3mcYhOj4yv7Z7m+fsTpLsScv+BgBrbG+WEmQL15Wl74/ZW C8aipi9jKEuWVxFEAt2KDz9GR0u0PLlPLbVYvU9fCJTt5xgz3qiLjwopYAEKdtafLwU1 BMmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pAhYN6mv; 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 gv6si2927402ejc.459.2021.06.22.07.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:39: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=pAhYN6mv; 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 77CA6829BF; Tue, 22 Jun 2021 16:39: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=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="pAhYN6mv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28E26829B7; Tue, 22 Jun 2021 16:39:02 +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-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450: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 64D7280F32 for ; Tue, 22 Jun 2021 16:38:58 +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-x432.google.com with SMTP id d11so21582521wrm.0 for ; Tue, 22 Jun 2021 07:38:58 -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:mime-version :content-transfer-encoding; bh=sujtLF292oYFVhzMF5y3Tfd2OO0snB1vQaRoWfQRvKE=; b=pAhYN6mv62u2H3IZ0Kr+nmm7g0MD9QE6xGOovRtxsgt/GP/zzVMRdBkBhcBA2kbkhN ud8LVDLGZwm7vyInLp5nFBc6qJjq14cKAp00FLFvmEaC5I/UxEZvTb1eZbsjSSSHjYbH Jz5ronutHhvLI8YbzxBn0CxPNrtilFMzHlxr6U9DovSNmbmr75gY9tzygF91bwIOAfW7 5/knXgO4YYofaL587QQIh2n9cJ81Z5Jo1NrAIlhiOoo/H9Zb+/SlgKYlsLYrpn9Tqhxn imqNEQyxOx+D9S9fX0BJ2ao9DnYHE8/QA2vNVrqarYAYJPGVV3/ezchOirXkaDLhyN1Q /cgQ== 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:mime-version :content-transfer-encoding; bh=sujtLF292oYFVhzMF5y3Tfd2OO0snB1vQaRoWfQRvKE=; b=dHi/oZSVwd/wpLXY00zgCcfwtPwjW5crQ8OghLq91PdinKnVndwFxsMKSmspcPaXdF pUg/1U3S7wKMmwUvM6/ncl6BszFf1bOj/Hqj3kyCLQGftvDaRbN9iM/cIe4bqLUNrzKP PPxCsYqOJRVveDMFTrcy4xeuImKMkUUizowYRU2xrxHnS03Wv1bnaEBUpfUjM0pjr1WO qWZkcPl99PjIKK7nxcnbZ2Y+lx9CUeB3LoexkL47O7nSVeH/RSt/sTMY7KTub2qiR+yn gb8gTq56FDnTSVnlZuoxc7dL9bg4dcIFLYLGT0dWEYMBQWiAY/pBCiZoRQPdAsoWX4eX 5Xlw== X-Gm-Message-State: AOAM531kKt1i/gSDsPdHYsvjrnbJnNLZCyG4BF/oXG6Ln3eBMRKGXWxK 46OxF5S3WF+pPZHAruP67eZA8Q== X-Received: by 2002:a5d:650b:: with SMTP id x11mr5473880wru.198.1624372737928; Tue, 22 Jun 2021 07:38:57 -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.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:38:57 -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 1/3 v3] efi: Fix to use null handle to create new handle for efi_fmp_raw Date: Tue, 22 Jun 2021 17:38:51 +0300 Message-Id: <20210622143854.15682-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.32.0.rc0 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 From: Masami Hiramatsu When running the efidebug capsule disk-update command, the efi_fmp_raw protocol installation fails with 2 (EFI_INVALID_PARAMETER) as below. This is because the code passes efi_root instead of the handle local var. => efidebug capsule disk-update EFI: Call: efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL) EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbaf5988) EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Entry efi_install_protocol_interface(00000000fbaf5988, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6ee8) EFI: new handle 00000000fbb37520 EFI: Exit: efi_install_protocol_interface: 0 EFI: 0 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Exit: efi_install_multiple_protocol_interfaces: 0 EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL) EFI: Call: efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL) EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbfec648) EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Entry efi_install_protocol_interface(00000000fbfec648, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6f18) EFI: handle 00000000fbaf8520 EFI: Exit: efi_install_protocol_interface: 2 EFI: 2 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Exit: efi_install_multiple_protocol_interfaces: 2 EFI: 2 returned by efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL) Command failed, result=1 To fix this issue, pass the handle local var which is set NULL right before installing efi_fmp_raw as same as the installing efi_fmp_fit. (In both cases, the local reference to the handle will be just discarded) Signed-off-by: Masami Hiramatsu Signed-off-by: Ilias Apalodimas --- Changes since v2: - Updated commit description Changes since v1: - lib/efi_loader/efi_capsule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.32.0.rc0 diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 60309d4a07d0..cc6ed453ed21 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -940,7 +940,7 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void) if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)) { handle = NULL; ret = EFI_CALL(efi_install_multiple_protocol_interfaces( - &efi_root, + &handle, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL)); } From patchwork Tue Jun 22 14:38:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 465168 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp715396jao; Tue, 22 Jun 2021 07:39:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWWF13aLwjHJY7loAywAz3TIJ71/0ySU9LFHDTMJANwx+vO68o9k42wIEFlli9aI1iXkMF X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr4399657ejb.492.1624372752616; Tue, 22 Jun 2021 07:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624372752; cv=none; d=google.com; s=arc-20160816; b=QdJs59AFuUyOJl0wx/B39ycJMnMWmrjupYc7PLaj3BT5rrbvCUZOl5NJ/TsJg36XVM sMFCRZUSw2wUwOcz5+4Ta2tb5M1hmJ8NWiKhVkTP8FhAWLS8R7FotqurgyH1RdAeGNYF HbxZr4t+5qYVapK+1RXLf0l1Ti0l0UL8JQ9MOIlSBsZQzrkWw+FSZ7wisEdoG5snBFG/ Uqz8ykWINN0+MQ7+S548PfZr7ffjYFqUV7eFX3ZIn2cT4NDzyfj9Biwjpi9nGJuiPU+l QxnFuo2d64bx3SxRUjSX+LgxeGAwDOuF+cp2Ejotwj7g7K3u0iBVMHUqWsJUe7N7fQ0i R1BA== 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=scL/5FgjbZG4+3lf4Tw6ZqLEe03kxfKL5qTLzaYJwTk=; b=XMhSbReIYnBxMzJAbZRIotTKab6JLhK/5LuWIs1zApabdM5/5MJUn4BLUXI/r6h88C fLY5udfc5W0hrFg1oO3IpOL0n+nHCJ+tfWNFWHS9SQBuANMeny/p1lyRixzlwYBPsc26 M1ffKuqhSGFbFfRKJSMTUDfCXH79O8fQ8lR0gpHtxGCHPVvNuDHEfprx1ibSal2mZR0Y 6EPdo4L3huJ64ybHVs7qEIFJ2Snh8a9fZ8vwGtOSp5RH406FZvZtW/4YA7OjNtXbjSnk TlqOmokDWI9eMHPW+h6bglRqdgV+wjR7ZzXsrEOrVdwCbay8EN7MsAvNnXwCTTjzsrkn vzZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="W5PDBEJ/"; 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 mc3si5630513ejb.354.2021.06.22.07.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:39:12 -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="W5PDBEJ/"; 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 98F77829B7; Tue, 22 Jun 2021 16:39:08 +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="W5PDBEJ/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF6DB829BC; Tue, 22 Jun 2021 16:39:05 +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-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450: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 45B2281E1C for ; Tue, 22 Jun 2021 16:39:00 +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-x432.google.com with SMTP id y7so23860912wrh.7 for ; Tue, 22 Jun 2021 07:39:00 -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=scL/5FgjbZG4+3lf4Tw6ZqLEe03kxfKL5qTLzaYJwTk=; b=W5PDBEJ/3fBpwDlxO+doKRBcEfvEC3ljbAQM4dz8fdpejt59WuW2Tannh92HRnRhZy xhC4/iLDC1U3L+/5jNgk/d5tRZrOvgjkiT1fYskobtF4AaHXvEvE47qXxwthYJ1F1jUD lUJ9IDYlyDE9DRuX4pp7pptz+VV5fy8EzlJyzREV4GtXeaMbKjsICwfiUBFuFFCZFGv/ BkO3QVf3yVbnr7DUSZGlZf1eYKchPCCcwKRRPjPydVQN4/N8qbqo6vbCJS8QZQ6FW3wG 8u/ea0eEBZjoN28ndaFK+1QmZD/4mIkFPsow3OxlmKXmEjSwXKyfxI/Ro2UlH/EnMudF h0ew== 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=scL/5FgjbZG4+3lf4Tw6ZqLEe03kxfKL5qTLzaYJwTk=; b=uje7mg/JWaHLcd/8EKvfKxpV+tl3rGRaMS46udA5/Pq7u6IPN4Z9LsC3oaOAxWvLUu exeELP5woxG8H28RpKsczoR6wao83TrSR0zooQvcrI67sa+WVgQB9+avJPLaWSbyjKvd dZGuTFLkV6fhuQiTFQ36WklDpvyidayc/m/dk9N/Ni1jDDz6a3QYAdELJaeLPW7s+1sc Uf4iU3yLihOUqCfQzV7S8+s3gi2rl8lOHyqjPkoXYLfG9ew8RRgWVYn8N/Njo4Ndn/Bs gThsx2hRmAunsfqUsLMaKicUUZnkPLKvKODsApeDi2JN9wBUAaF2MaP8X2SBLy4y5rPZ 95hg== X-Gm-Message-State: AOAM532a6gg+DX3lUseM/MM3tZoW55ORi+bYq/1SAKppacQm0ogNGTVi ga80rGcYHuLRUnPvwKdv+vYQMw== X-Received: by 2002:adf:e652:: with SMTP id b18mr5128313wrn.379.1624372739843; Tue, 22 Jun 2021 07:38:59 -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.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:38:59 -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 v3] efi_loader: Force a sinlge FMP instance per hardware store Date: Tue, 22 Jun 2021 17:38:52 +0300 Message-Id: <20210622143854.15682-2-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 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 --- Changes since v2: - Changes since v1: - Don't use 'choice' on Kconfig sicne we need both of the FMPs installed for sandbox testing instead just make them mutually exclusive with 'depends on' configs/xilinx_zynqmp_virt_defconfig | 1 - lib/efi_loader/Kconfig | 45 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 24 deletions(-) -- 2.32.0.rc0 Reviewed-by: Masami Hiramatsu diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index 6adbe987cb7f..4d34e6c4cba5 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -187,5 +187,4 @@ CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_EFI_SET_TIME=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=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 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: 465170 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp715725jao; Tue, 22 Jun 2021 07:39:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxQv/aJbnPFNkMVBuMVMKELK7YGPBjOZDHMpNqeglFC5fD+ek52PCDZYUGW/YREsOWOM6S X-Received: by 2002:a17:906:82cf:: with SMTP id a15mr4305967ejy.359.1624372773730; Tue, 22 Jun 2021 07:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624372773; cv=none; d=google.com; s=arc-20160816; b=0zUocrjkA5+q4Be29MzZ1iDakS/M4di/OTDCwvy7z8leTrTwY0DxcDFusFJPXSc/Jr 2jWFrm6wa2fAGWs9TBFUztU4QaZs/dG/7U8lTq7FTBJr0fIGzd+ZfQbOxgyJ2OGHbTdk knoTiweGf4BccpQsvT5tyyzupGqjOjb/O8q1rTy8JsvwfbW4Bz3hAeh4nWBfLP4UPaQL 9jbdMLg8TDGK1CdHMy7RTCFKCZ+tXsJqPHj+VPY4PI9bfjITfLwBNVwnPvwqYgGW9/Mo 7+J8XG8nxac8WuvjV0+LJE0Bzb8jnEiM0nyRDNTLsVDS1q0NkkC5MLuRzL5+pmQuV67u lv8w== 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=rpupr+k/yt0P3GX+hB+UHAUSqZjF5B/VtiJg7HWUyo8=; b=PdeNT9oNKMXm7HBmXjQT2A7Ox9mpnDxhRGaitAVMDKqp6TcH+pJ+lGMi50oQmPbWTe CXENP3oyA5uDAvMBBsKQiLEyX6pWaXE8ChgKP74g2gcR+EOuDG74kwqP+wH6GeSTbpvo 9Ah5X8/m7cxzZyM+nfjBwi8xojxPgB94pQMScJ9CjoAVd9r5wPlFXa+FKex/PcXsNqPf gsdeA4G1R9/8aXrQZzHK33f7r1H7z0SPwFYyLG/h3emW6kyNQnkG2EbBq33fV79w/BFF F0YOUUjF8vpwfrzHQw2tkEgfy57vfdx32mxNS6pk9OqXPPeVrfW7rt7qvXXR84Gpw9CF fsDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZyHtUaV; 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 21si13401808eji.338.2021.06.22.07.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:39:33 -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=vZyHtUaV; 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 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-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(-) -- 2.32.0.rc0 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)