From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50181C433EF for ; Fri, 10 Jun 2022 11:53:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 197F284404; Fri, 10 Jun 2022 13:53:37 +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="r+yMLiZ6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A12284400; Fri, 10 Jun 2022 13:53:34 +0200 (CEST) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 CC4C5843FB for ; Fri, 10 Jun 2022 13:53:31 +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-ed1-x52e.google.com with SMTP id x5so29853940edi.2 for ; Fri, 10 Jun 2022 04:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KSsgpv9TWX82LyvP+R1jAUUysfEcbZAicoEd6JGeewM=; b=r+yMLiZ6nqH2TYgKDWyf1LZuKJ0Rsgl+qQErPMv3/Kh+6SsGNv+jVZMa7NM0w182Re JaIsH8kfqgIIrfWndhr+oTzRXHLHve6HYRSwdP2Pp1Q+7KJkJOcMHaD3lFk3gxcLCnOj 8aRzaAbwFTm1icoCDHJn7Bv3Zq9YDsjSPRUMKk2Gnh0+CB/qp1NKwZONniyGqOwuhGsH TJFgGytNPCoDpWfgbCIYdckkWvqQW/7SJ40tFnQfhV32iW+6J7RRAp3p5lM8sbu2ryQR qqg7a56LHELC1d0pclUUzv6htyrTkN+lSMhiCM0b46x6fxhHVwAgHWf/cUfBx32uRpAW KTXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KSsgpv9TWX82LyvP+R1jAUUysfEcbZAicoEd6JGeewM=; b=eWuNmi5duv+6ZxK43vduvZnH1pjwKWjfdK6s2wqSse38EXSVfA4rcDvfixFRFFlVg2 RT9pcAnIuk94IY22t5CjBXLuqt3wcL5atrrEBVnVAbYwrVT5EGXe7ZB7JPwC5EFYVhKA OntKZOxBtyGUaX7YDFSMWts6rimq+W77JXQlCQiVgYO5m3RE3b1N684JLikiTQRC7nB0 P7j4IGGiT22jdo5bqXxadcr/C8c90d2D9z7VegZZIVLk42+ye2DMeFm5oLI+fVVGPYsG ytxLtZ6QvHhkhXYQfiZIuyHO94VLFvydDTFHmT50L53UGMigbuJRXFBpyQkiqL6qlRfr 5aBA== X-Gm-Message-State: AOAM533Ew2KnCzOfWKJCibSphYg9UwhSdufJ7qwElxYTyUk87rL4926Y q8Aw4lN/OZ0VruSqbzVqskoabQ== X-Google-Smtp-Source: ABdhPJxivqnw7Qd8fG6j62FFWjBJuPPIagjEqQgFM5/NpyvirKuM9FImgnDyY9NOT1sW+S1mcWI+nw== X-Received: by 2002:a05:6402:34c:b0:42d:be29:23f9 with SMTP id r12-20020a056402034c00b0042dbe2923f9mr51381226edw.304.1654862011376; Fri, 10 Jun 2022 04:53:31 -0700 (PDT) Received: from hera (46-15-185.adsl.cyta.gr. [46.103.15.185]) by smtp.gmail.com with ESMTPSA id v3-20020a056402348300b0042dccb44e88sm5583522edc.23.2022.06.10.04.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 04:53:30 -0700 (PDT) Date: Fri, 10 Jun 2022 14:53:27 +0300 From: Ilias Apalodimas To: Sughosh Ganu Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Takahiro Akashi , Patrick Delaunay , Patrice Chotard , Simon Glass , Bin Meng , Tom Rini , Etienne Carriere , Michal Simek , Jassi Brar Subject: Re: [PATCH v5 06/23] FWU: stm32mp1: Add helper functions for accessing FWU metadata Message-ID: References: <20220609123010.1017463-1-sughosh.ganu@linaro.org> <20220609123010.1017463-7-sughosh.ganu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609123010.1017463-7-sughosh.ganu@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean Hi Sughosh, On Thu, Jun 09, 2022 at 05:59:53PM +0530, Sughosh Ganu wrote: > Add helper functions needed for accessing the FWU metadata which > contains information on the updatable images. These functions have > been added for the STM32MP157C-DK2 board which has the updatable > images on the uSD card, formatted as GPT partitions. > > Signed-off-by: Sughosh Ganu > --- > board/st/stm32mp1/stm32mp1.c | 115 +++++++++++++++++++++++++++++++++++ > include/fwu.h | 2 + > 2 files changed, 117 insertions(+) > > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c > index 62d98ad776..e68bf09955 100644 > --- a/board/st/stm32mp1/stm32mp1.c > +++ b/board/st/stm32mp1/stm32mp1.c > @@ -7,9 +7,11 @@ > > #include > #include > +#include > #include > #include > #include > +#include > #include > #include > #include > @@ -25,9 +27,11 @@ > #include > #include > #include > +#include > #include > #include > #include > +#include > #include > #include > #include > @@ -967,3 +971,114 @@ static void board_copro_image_process(ulong fw_image, size_t fw_size) > } > > U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process); > + > +#if defined(CONFIG_FWU_MULTI_BANK_UPDATE) > +#include > +#include > + > +static int get_gpt_dfu_identifier(struct blk_desc *desc, efi_guid_t *image_guid) > +{ > + int i; > + struct disk_partition info; > + efi_guid_t unique_part_guid; > + > + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { > + if (part_get_info(desc, i, &info)) > + continue; > + uuid_str_to_bin(info.uuid, unique_part_guid.b, > + UUID_STR_FORMAT_GUID); > + > + if (!guidcmp(&unique_part_guid, image_guid)) > + return i; > + } > + > + log_err("No partition found with image_guid %pUs\n", image_guid); > + return -ENOENT; > +} > + > +static int gpt_plat_get_alt_num(struct blk_desc *desc, efi_guid_t *image_guid, > + int *alt_num) Does this really need to be defined per platform? Most of the stuff in here are generic apart from the info of were the metadata is stored. So wouldn't it better to move this in the generic API and add an argument for the dfu device type? The platform portion would then just call this function with an extra arg e.g DFU_DEV_MMC > +{ > + int ret = -1; > + int i, part, dev_num; > + int nalt; > + struct dfu_entity *dfu; > + > + dev_num = desc->devnum; > + part = get_gpt_dfu_identifier(desc, image_guid); > + if (part < 0) > + return -ENOENT; > + > + dfu_init_env_entities(NULL, NULL); [...] Regards /Ilias