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 F05FBC433FE for ; Wed, 8 Dec 2021 10:19:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB27B830BA; Wed, 8 Dec 2021 11:19:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UJx2ln1X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9482582A59; Wed, 8 Dec 2021 11:19:04 +0100 (CET) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 4459F82A59 for ; Wed, 8 Dec 2021 11:18:59 +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=sughosh.ganu@linaro.org Received: by mail-io1-xd32.google.com with SMTP id p23so2194366iod.7 for ; Wed, 08 Dec 2021 02:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O4oue8ADLHbg4riMuumjMPvkYxePGk7G+HGj0Vl9AeA=; b=UJx2ln1XW6LnMNc2/59MztpkDaHfISpryCzGm4aH+mKnfF+xpX+hUe8YNvU3kwwWUW yNpqNGkhr9aS+xjoE3EFcIpj+a1mPm6JKkwVgSYmYyHFaepLJnZuGqD92N/q+nKp+UW1 rmX2RSPeVK+JvR3KHuohPAb432vf1sO17mp/sMRx+onPiaKuf/up6R1BGUGLCZ9WjWsz livbYezhmgvKLcJiFeXauYML6ncgZsz0pfhvl8NZu3eZZ9ML4atHI8Hk4Ql4aLJfiBsP QnqmOrhVFQIe4jfLoTPsa724KjdOLcvwyzLwAmAMDxAOl6O9Z3XYeTk9DuMpkfQSxTnL LRSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O4oue8ADLHbg4riMuumjMPvkYxePGk7G+HGj0Vl9AeA=; b=z+yiq81cjemWS2+sg0yPJMu4fcrGCiI89PvEH+mpYBQ4OZWciJUgL4fnz2/EbRo5LU 6Q1aRKdKypj1kiCgBJDe6yNq3TVVU7qcTCKa96pl251EdZ/X8wtsiC9SyWX+Hlpnia/r XX8HeDD1qTzaHCpEcbooqOHCAbjw38RFHqX5pBXlD95LBqLeJKf530EGevVEi7o5DGpa OcDRk6Szy62hMjJ5Z40aO8u79U0RlEqA5XzJdKA3oMhdJ7JhhrNRxKRcDTo2+q9ofAUp uFe3huEDN1Bpe5CZ5gF6nyIBaGWzOsVtlFy228e48GbQf56aFTaVe9piZxQK8YOXqVLX j5jQ== X-Gm-Message-State: AOAM533pd82P70jaD/mgtja75PAxf8a8nioXabXggcL1AZiugu79zCpa IG6MHsk70Y7A2+hwsU4Rc+Ofr45rqEg80HG6ZJTL+g== X-Google-Smtp-Source: ABdhPJzspx/YejnyJdE6YuAZM7HeclygaSGw2dZN9pU53+7i2+4FS7cBPXKglEarkyO/OEQOQuWHNVedeF2eVkuCe0A= X-Received: by 2002:a5d:9851:: with SMTP id p17mr5657361ios.85.1638958737905; Wed, 08 Dec 2021 02:18:57 -0800 (PST) MIME-Version: 1.0 References: <20211125070146.2389-1-sughosh.ganu@linaro.org> <20211125070146.2389-6-sughosh.ganu@linaro.org> In-Reply-To: From: Sughosh Ganu Date: Wed, 8 Dec 2021 15:48:47 +0530 Message-ID: Subject: Re: [RFC PATCH 05/10] FWU: stm32mp1: Add helper functions for accessing metadata To: Patrick DELAUNAY Cc: u-boot@lists.denx.de, Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , AKASHI Takahiro , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.38 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 hi Patrick, On Tue, 7 Dec 2021 at 20:03, Patrick DELAUNAY wrote: > Hi Sanghosh > > On 11/25/21 8:01 AM, Sughosh Ganu wrote: > > Add helper functions needed for accessing the 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 | 63 ++++++++++++++++++++++++++++++++++++ > > include/fwu_metadata.h | 3 ++ > > 2 files changed, 66 insertions(+) > > > > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c > > index 84592677e4..a6884d2772 100644 > > --- a/board/st/stm32mp1/stm32mp1.c > > +++ b/board/st/stm32mp1/stm32mp1.c > > @@ -7,6 +7,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -14,6 +15,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -23,6 +25,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -938,3 +941,63 @@ 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); > > + > > +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE > > + > > +int fwu_plat_get_update_index(u32 *update_idx) > > +{ > > + int ret; > > + u32 active_idx; > > + > > + ret = fwu_get_active_index(&active_idx); > > + > > + if (ret < 0) > > + return -1; > > + > > + *update_idx = active_idx ^= 0x1; > > + > > + return ret; > > +} > > + > > +int fwu_plat_get_blk_desc(struct blk_desc **desc) > > +{ > > + int ret; > > + struct mmc *mmc; > > + struct udevice *dev; > > + > > + /* > > + * Initial support is being added for the DK2 > > + * platform > > + */ > > + if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && > > + (of_machine_is_compatible("st,stm32mp157c-dk2"))) { > > + ret = uclass_get_device(UCLASS_MMC, 0, &dev); > > + if (ret) > > + return -1; > > + > > + mmc = mmc_get_mmc_dev(dev); > > + if (!mmc) > > + return -1; > > + > > + if (mmc_init(mmc)) > > + return -1; > > + > > + *desc = mmc_get_blk_desc(mmc); > > + if (!*desc) > > + return -1; > > + } > > + > > + return 0; > > +} > > + > > +struct fwu_metadata_ops *get_plat_fwu_metadata_ops(void) > > +{ > > + if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && > > + (of_machine_is_compatible("st,stm32mp157c-dk2"))) { > > + return &fwu_gpt_blk_ops; > > + } > > + > > + return NULL; > > +} > > + > > +#endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ > > diff --git a/include/fwu_metadata.h b/include/fwu_metadata.h > > index e692ef7506..6a5e814ab6 100644 > > --- a/include/fwu_metadata.h > > +++ b/include/fwu_metadata.h > > @@ -122,4 +122,7 @@ int fwu_accept_image(efi_guid_t *img_type_id); > > int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); > > int fwu_get_metadata(struct fwu_metadata **metadata); > > > > +int fwu_plat_get_update_index(u32 *update_idx); > > +int fwu_plat_get_blk_desc(struct blk_desc **desc); > > + > > #endif /* _FWU_METADATA_H_ */ > > > One general question: > > > How we can handle the EV1 board with 2 MMC devices => eMMC (mmc1) / > SDCard (mmc0) > The current metadata structure has a location_uuid, which can be used to identify the device which will contain the banks of firmware images. The current code for DK2 board does not have this implemented, but adding this logic should not be difficult. Based on the location_uuid, we can identify the device and return the blk_desc of that device. > > and how to managed HW partition of eMMC boot1 / boot2 > > => for eMMC boot, the TF-A BL2 is located in these eMMC hw partition. > > > in the serie, I see only support for partition > 0 => partition in GPT > but not the update of eMMC boot partition. > I will get back to you on this. The current specification is dealing with GPT formatted devices. Need to check how the boot partitions will be supported for multiple banks of images. -sughosh > > Regards > > Patrick > >