From patchwork Tue Nov 14 09:25:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 743762 Delivered-To: patch@linaro.org Received: by 2002:a5d:67cf:0:b0:32d:baff:b0ca with SMTP id n15csp2075105wrw; Tue, 14 Nov 2023 01:26:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEh+HEAYRE/9oR6AkdNfUnKaMjbpJHMgsuXhYTThvgF6nScaidUJq/bookgJfeKwwyPcbuz X-Received: by 2002:a17:906:2556:b0:9ae:699d:8a2a with SMTP id j22-20020a170906255600b009ae699d8a2amr6254757ejb.5.1699954008211; Tue, 14 Nov 2023 01:26:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699954008; cv=none; d=google.com; s=arc-20160816; b=w4K2FZMF/st41VX6/fXINbWNai8H2bm0g4U6s1qxZDnIhwJ0X68evcpbcbmFtoFwZY 8tkiHtZcTd1JTjLihtfRIOGmzvSaAo5EpYM2qcOngszr2jhthEwz54OfTq7+X4h5wRF/ 7bpHQwhNj2oF3x3jxov7nmXtvasXD4qiLGjk+WirbJ07pkMLRzLtcfgefBqbFZD+XgWg /eLtDw2znDH8t3SpUaTY59Lm2guXxhpmD1I2/b04D26yIMtf5KzQFJPV4jm1pvMNp4+b yuOoeqi33UEZj7kQy4c8zqUoFprNtvJtY1kgYTD3cK25D4OS5fYWA7ne2jS+hy7RYMUW T+jw== 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=g3Vyj8zH1wilO2p+N0KC7xECw+I4drVeJwtAwojUGV0=; fh=WO6lTKtGPINN9KZpMhJhgJRkFWf7EvZ6aTaftTHD+5o=; b=pCgRf4HdeRXL0iGDIhv0DrjoLm9PmUtIiW67oT6sn7QJAIBYjuweCsC7YDsTd1UPJy yxN8dF1XFZIMtgRrvhHeSQVMEUzfBC9uCJDYR8NIo0bCypobqpvIDORf8hZ/M7VcHRdw cHHCplPCovX1toSUXNnkYjh9yJewkGhMnwKZHMqie6tewewXNxpoqz2y0R+EYfY2wphK f7slxvB7JHJP+24/oyArIYmJ6+Zsb5E/BUGUBZSiydG0OyfDK1XXecuondkNq1XCzEg2 V4wYlh3Q5m9xybMYteOTm8DQsu2Rg60E10CNEnnm9hg8vZU7bjFXmRJFD3clDjYmCZl0 S61A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zEnpK2sm; 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 gb21-20020a170907961500b009e659d57c15si3405115ejc.541.2023.11.14.01.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 01:26:48 -0800 (PST) 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=zEnpK2sm; 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 1F86687440; Tue, 14 Nov 2023 10:26:43 +0100 (CET) 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="zEnpK2sm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5534F86FB2; Tue, 14 Nov 2023 10:26:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 2A2C487269 for ; Tue, 14 Nov 2023 10:26:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2800bdf888dso4082425a91.1 for ; Tue, 14 Nov 2023 01:26:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699953997; x=1700558797; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g3Vyj8zH1wilO2p+N0KC7xECw+I4drVeJwtAwojUGV0=; b=zEnpK2smXYUWLBFswzipt3JUpoJdlgYWNGInL4SYUhEo10Ni7HTJj3ult51r9BIpIC JZYbHy53jqM1Cv+PVyQuSl5Wy0p+wez+TwcaLNz+R9AeOYLd/l12IsxtFwHDB7gPp6fJ bGzns/pjvn4vQ1pvWwqDz4LYI/o6B9kHd7pr9hYnJdb+E3G6ewqUZE73QStwymEAX6cI O7kKePA9M3CcXd2dkG/bJRuQU4k0LzcMPcncPR0DcX8V9TkoRCQk7k57AJas7uDXdgZZ 56zSKpi8PYa2+aw+mAnYAHpkOZImIbGD+vpB2pHKanr3g0riVtAhZBwZHZPVxtmXNc6h GFgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699953997; x=1700558797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g3Vyj8zH1wilO2p+N0KC7xECw+I4drVeJwtAwojUGV0=; b=h2PeQsvs9OeiqcpLS7Gv2mnJ5d9zdJAY+r1bDWifkZuvHYGfWniX0g7T+GT2yz2VF/ ata96VpTUUBRJpec04tJAAOqNWmk7AZTAzOz+lkpLTKda5JkSQQ3G3gUSxDhcwgKsAmQ zEY0IjTvH4QsJlhhh7hBwZfsIvuHw3Ukbzn5lNST5AyFQW3jdv99xzdp/vH4mv5QRpml Vnov9gjStPriTD4VtFugRGp2gDEAu25MlHzs7tP4+QqMkUpXuI06L3Mh+zXklMiuE8zv 811jJ73AGCMwe8s7oXKQvGdrnnC6i2PCUeY+0YmdMO++JQ9SQZc1SUKIMaspBmuuXNg4 abOg== X-Gm-Message-State: AOJu0YzzFqHVH3wSB/axpQrtt7O5EwGNyZwUIJ7W4vd6KCY4mHoGN2k/ RBuu7+1HQYS1lpsjx0wpsw22FNll5j3dbxCXbmg= X-Received: by 2002:a17:90a:d348:b0:280:6cde:ecc2 with SMTP id i8-20020a17090ad34800b002806cdeecc2mr2936766pjx.11.1699953997049; Tue, 14 Nov 2023 01:26:37 -0800 (PST) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 22-20020a17090a001600b0027ceac90684sm5526577pja.18.2023.11.14.01.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 01:26:36 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Sughosh Ganu , Jassi Brar , Masahisa Kojima Subject: [PATCH 1/2] efi_loader: use original image_index for FMP versioning Date: Tue, 14 Nov 2023 18:25:07 +0900 Message-Id: <20231114092508.3955838-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114092508.3955838-1-masahisa.kojima@linaro.org> References: <20231114092508.3955838-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean FMP versioning uses the image_index argument of EFI_FIRMWARE_MANAGEMENT_PROTOCOL.SetImage() service. When CONFIG_FWU_MULTI_BANK_UPDATE is enabled, image_index is updated by fwu_get_image_index() function. This commit saves the original image_index argument and use it for FMP versioning. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 9abb29f1df..9c1a273926 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -612,6 +612,8 @@ efi_status_t EFIAPI efi_firmware_raw_set_image( { int ret; efi_status_t status; + u8 original_image_index = image_index; + struct fmp_state state = { 0 }; EFI_ENTRY("%p %d %p %zu %p %p %p\n", this, image_index, image, @@ -641,7 +643,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image( NULL, NULL)) return EFI_EXIT(EFI_DEVICE_ERROR); - efi_firmware_set_fmp_state_var(&state, image_index); + efi_firmware_set_fmp_state_var(&state, original_image_index); return EFI_EXIT(EFI_SUCCESS); }