{"id":2228525,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2228525/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260426154724.2042569-7-dario.binacchi@amarulasolutions.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260426154724.2042569-7-dario.binacchi@amarulasolutions.com>","list_archive_url":null,"date":"2026-04-26T15:46:59","name":"[v7,6/8] fwu: add helper to get image GUID by type and bank index","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6ed968b63b0ec6f5bfc44d455267bd63a777899d","submitter":{"id":83038,"url":"http://patchwork.ozlabs.org/api/1.2/people/83038/?format=json","name":"Dario Binacchi","email":"dario.binacchi@amarulasolutions.com"},"delegate":{"id":70413,"url":"http://patchwork.ozlabs.org/api/1.2/users/70413/?format=json","username":"pchotard","first_name":"Patrice","last_name":"Chotard","email":"patrice.chotard@st.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260426154724.2042569-7-dario.binacchi@amarulasolutions.com/mbox/","series":[{"id":501546,"url":"http://patchwork.ozlabs.org/api/1.2/series/501546/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=501546","date":"2026-04-26T15:46:53","name":"Support metadata-driven A/B boot for STM32MP25","version":7,"mbox":"http://patchwork.ozlabs.org/series/501546/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228525/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228525/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com\n header.a=rsa-sha256 header.s=google header.b=QsuPKd3g;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=amarulasolutions.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com\n header.b=\"QsuPKd3g\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=pass (p=none dis=none)\n header.from=amarulasolutions.com","phobos.denx.de; spf=pass\n smtp.mailfrom=dario.binacchi@amarulasolutions.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g3WLq113mz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 01:48:19 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 918A8840ED;\n\tSun, 26 Apr 2026 17:47:42 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 45D5784348; Sun, 26 Apr 2026 17:47:40 +0200 (CEST)","from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n [IPv6:2a00:1450:4864:20::432])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 445AB83FDB\n for <u-boot@lists.denx.de>; Sun, 26 Apr 2026 17:47:38 +0200 (CEST)","by mail-wr1-x432.google.com with SMTP id\n ffacd0b85a97d-43d73352cf2so7840625f8f.1\n for <u-boot@lists.denx.de>; Sun, 26 Apr 2026 08:47:38 -0700 (PDT)","from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com\n (host-82-56-22-134.retail.telecomitalia.it. [82.56.22.134])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-44123d23e0bsm34489985f8f.15.2026.04.26.08.47.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 26 Apr 2026 08:47:37 -0700 (PDT)"],"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,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=amarulasolutions.com; s=google; t=1777218457; x=1777823257;\n darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=5GSYQhGo2SyIVxnn6Fpy6y7erjo+T2Ff+eqsbRqEQV0=;\n b=QsuPKd3gCkgkW6ll3BIKJL8ZZXGfe0CPX+QkRfEJXvd+UJcziHIwZfJn+nPcANpOst\n AMQhZkrhzoIHGJe2fszoqTsVo9Z5RzyNLPADLJdtRV99XlXluSaw6r+6FnhBohW+mW+b\n 1W96VMavm/RW+W6YjdxU8REQifRLA0ZnHrRfw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777218457; x=1777823257;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=5GSYQhGo2SyIVxnn6Fpy6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dbnpUt7YlfkJ6J3FVGDW\n d4fitHhHZ3pJTXUAXaTpZNpsol0VUzUitruXJCW8hAtO0fFsz2CcZrXP57Nxj7GRgIAD407XSP5\n CM2dmKBD4UdO74enNgYG4TtgSDtrCA==","X-Received":"by 2002:a05:6000:4283:b0:43d:73ff:fd59 with SMTP id\n ffacd0b85a97d-43fe3db9bc9mr60196646f8f.10.1777218457451;\n Sun, 26 Apr 2026 08:47:37 -0700 (PDT)","From":"Dario Binacchi <dario.binacchi@amarulasolutions.com>","To":"u-boot@lists.denx.de","Cc":"linux-amarula@amarulasolutions.com,\n Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n Simon Glass <sjg@chromium.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Kory Maincent <kory.maincent@bootlin.com>,\n Michal Simek <michal.simek@amd.com>,\n Padmarao Begari <padmarao.begari@amd.com>,\n Sughosh Ganu <sughosh.ganu@arm.com>, Tom Rini <trini@konsulko.com>","Subject":"[PATCH v7 6/8] fwu: add helper to get image GUID by type and bank\n index","Date":"Sun, 26 Apr 2026 17:46:59 +0200","Message-ID":"<20260426154724.2042569-7-dario.binacchi@amarulasolutions.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260426154724.2042569-1-dario.binacchi@amarulasolutions.com>","References":"<20260426154724.2042569-1-dario.binacchi@amarulasolutions.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Introduce fwu_mdata_get_image_guid() to retrieve a specific image GUID\nfrom the FWU metadata based on the bank index and image type GUID.\n\nThis allows identifying the correct partition in multi-bank (A/B)\nscenarios, ensuring the correct image is targeted depending on the\ncurrent bank.\n\nSigned-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\nAcked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>\n\n---\n\n(no changes since v5)\n\nChanges in v5:\n- Add Acked-by of Ilias Apalodimas (added to v3)\n\nChanges in v4:\n- Add Reviewed-by of Simon Glass\n\nChanges in v3:\n- Add kerneldoc comment for fwu_mdata_get_image_guid() above its\n  declaration in fwu.h.\n\nChanges in v2:\n- Add kerneldoc comment for fwu_mdata_get_image_guid().\n- Pass efi_guid_t by pointer for consistency.\n\n include/fwu.h         | 11 +++++++++++\n lib/fwu_updates/fwu.c | 33 +++++++++++++++++++++++++++++++++\n 2 files changed, 44 insertions(+)","diff":"diff --git a/include/fwu.h b/include/fwu.h\nindex 9cee8fb085cb..68a51fb4296b 100644\n--- a/include/fwu.h\n+++ b/include/fwu.h\n@@ -396,6 +396,17 @@ void fwu_populate_mdata_image_info(struct fwu_data *data);\n  */\n int fwu_get_mdata_size(uint32_t *mdata_size);\n \n+/**\n+ * fwu_mdata_get_image_guid() - Get image GUID for a type and bank\n+ * @image_guid: Pointer to be filled with the found image GUID\n+ * @image_type_guid: Pointer to the image type GUID to search for\n+ * @bank_index: Index of the bank\n+ *\n+ * Return: 0 if OK, -ve on error\n+ */\n+int fwu_mdata_get_image_guid(efi_guid_t *image_guid,\n+\t\t\t     const efi_guid_t *image_type_guid, u32 bank_index);\n+\n /**\n  * fwu_state_machine_updates() - Update FWU state of the platform\n  * @state: FWU bank state\ndiff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c\nindex e82600a29a40..2b11e5da061d 100644\n--- a/lib/fwu_updates/fwu.c\n+++ b/lib/fwu_updates/fwu.c\n@@ -243,6 +243,39 @@ int fwu_sync_mdata(struct fwu_mdata *mdata, int part)\n \treturn 0;\n }\n \n+/**\n+ * fwu_mdata_get_image_guid() - Get image GUID for a type and bank\n+ * @image_guid: Pointer to be filled with the found image GUID\n+ * @image_type_guid: Pointer to the image type GUID to search for\n+ * @bank_index: Index of the bank\n+ *\n+ * Return: 0 if OK, -ve on error\n+ */\n+int fwu_mdata_get_image_guid(efi_guid_t *image_guid,\n+\t\t\t     const efi_guid_t *image_type_guid, u32 bank_index)\n+{\n+\tstruct fwu_data *data = &g_fwu_data;\n+\tstruct fwu_image_entry *image;\n+\tint i;\n+\n+\tif (bank_index >= data->num_banks)\n+\t\treturn -EINVAL;\n+\n+\tfor (i = 0; i < data->num_images; i++) {\n+\t\timage = &data->fwu_images[i];\n+\n+\t\tif (!guidcmp(image_type_guid, &image->image_type_guid)) {\n+\t\t\tstruct fwu_image_bank_info *bank;\n+\n+\t\t\tbank = &image->img_bank_info[bank_index];\n+\t\t\tguidcpy(image_guid, &bank->image_guid);\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn -ENOENT;\n+}\n+\n /**\n  * fwu_mdata_copies_allocate() - Allocate memory for metadata\n  * @mdata_size: Size of the metadata structure\n","prefixes":["v7","6/8"]}