From patchwork Wed May 31 05:30:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jassi Brar X-Patchwork-Id: 687284 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1083802wru; Tue, 30 May 2023 22:30:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4E6LVYSF0ET5T4Dfm3jh1BBwMc7aRmqVmT7274dYH3yhfmFm09EwTCgx7zueKSGzoMEhnL X-Received: by 2002:a05:620a:2493:b0:75b:23a0:de91 with SMTP id i19-20020a05620a249300b0075b23a0de91mr5784503qkn.15.1685511024953; Tue, 30 May 2023 22:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685511024; cv=none; d=google.com; s=arc-20160816; b=zzTSrQxkymNQCAcoDdD5c9nezz+CxnUW7W5nrdwUQkFNox+/QDRI6/wQMxzuRASykh lt6gqv63j3WzIpNL55FLjsnPahXGImCTx36O+f6CGsjtjLvQLHTSto/vXwDBzL7HOqEx uZ3nrzZ+43tuYY/Df7ztwWSEm5A26AnfbupY5M/9m70vWw7j0kY8v2iMn84EOaV5kqKS C5Ma+e9/tOqyrm0eFwnD+9p1utzNujlyhrA5Pb3UWU99zlD7UJh0sml0XJD/kR3hFhtB LPNXmtu10cqR7Zb+n7BuLK/AmLKi9vUs66akOQpOXay0a+wAl0PPmepJFXs5VS6oUa8T xe6g== 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=I9XcgT61QsL7BxVRHbct/x5Cgqheqd71HgzZMDhiF5I=; b=xmmQ4vay4lI5/bs7s4uqALFPleKTmyGS5g9Ga2RAplyDLxei7TZsnLlBfQeYcrBMjp 2PxXxKzd00Qswu0zkBWw8HjAtqpkuQVGEtFir+NXFoONlffK1TjwdP/iyZ2NBQcZGiMP zfCR0LmwcwGzYSyuXGrQoWmAxSFgWMjrMT1CEcY0/WPoYDl59SFL/O+jAgPb9dHhxs53 +XB6kf5MmxzdlhbdiGYHLO7CgicauJGVfOpr89tSMsmiZxCjFE6vvn5GwpNfTiIeTS6d oF8rKPibEzlQ6AsD4RSGdqt2lvkPBJhcIRPXqjWrUb1P9pmIDlVPzJLjhSo4/rRgH+Ih GHdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KdEZ1uBG; 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 v20-20020a637a14000000b0053474003cf0si364981pgc.449.2023.05.30.22.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 22:30:24 -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=KdEZ1uBG; 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 E3F8A861E1; Wed, 31 May 2023 07:30:16 +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="KdEZ1uBG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0B118861DE; Wed, 31 May 2023 07:30:15 +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.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-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (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 E617F861C0 for ; Wed, 31 May 2023 07:30:10 +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=jaswinder.singh@linaro.org Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-b9a7e639656so9590010276.0 for ; Tue, 30 May 2023 22:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685511009; x=1688103009; 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=I9XcgT61QsL7BxVRHbct/x5Cgqheqd71HgzZMDhiF5I=; b=KdEZ1uBG9z9eRc5MUAads6uUIYtdsatfB+EupSfKhMEnw50yjkKjt0xTtlVLs/iqiN KmJm6oW1ZPwwCVqZZmCamewCZH3bbOpFjVWZ/xZiD/jll8VTC+cx/LH7unxUkLpTdppL IG/1fmYvBpeXYCITr2vVFa7LdCbmpcCW5AdtoZoEfuihO61aZo6KfiYSkLptKissm7CO GDb8Tgu4bjmbRA/+kIKKDzqT2xQXxItFTlcZ2oAfVGsKPCy5om4sjUCWC3DvC39l/Hls L/kM/4JLFMNFi9bORkbY1EmAEpaxFcbveR0zSE473FQ5fGSVFwmlzcBJ6vswqWVa0iEg 4mlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685511009; x=1688103009; 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=I9XcgT61QsL7BxVRHbct/x5Cgqheqd71HgzZMDhiF5I=; b=HdWXVR6cAu5+kXAgpMxk4RKwDcTEK6dprgr/0D44yb69bCNpP6DUC4i7lVgiyHjEHk 6wlh+5ojsdi0kG28J1UcSKnzvsRe4l+YwzMNSL4Ikgibf5HAS38nHOZtAaT46AChJnuh fTDhXGJBfcCVEig+MIgYxFULC4Vzz2Y1fRytRryuO2g6qRCLQ4hfJGCzxzgd7eUv+9yU qqrWMuYB8d+/kiM6M7KHY8BxcMV9H2+TYiVa6o1iDd/YcXFfnyWj7SkRa3E2pFx2YWjZ X/+ZwlqNptdMz89ye377q+0bcyrzz/g4UEzZRVtnL47kJ4/krTUtN9U0nfAl1YE9IK9X 6nGQ== X-Gm-Message-State: AC+VfDw6365uzAUDBEaVFsQXiZXeWRIAS9oXhz/aeD299OnXxq+GNHAB xmC1QIEmcmWB7lY288/V3PJC3dGbT3zpj9CU07g= X-Received: by 2002:a0d:f7c5:0:b0:55d:83ec:e0a2 with SMTP id h188-20020a0df7c5000000b0055d83ece0a2mr4787535ywf.31.1685511009502; Tue, 30 May 2023 22:30:09 -0700 (PDT) Received: from jassi-desktop.. (wnpgmb0311w-ds01-45-177-228.dynamic.bellmts.net. [206.45.177.228]) by smtp.gmail.com with ESMTPSA id n5-20020a819c45000000b0054fba955474sm5077172ywa.17.2023.05.30.22.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 22:30:09 -0700 (PDT) From: jaswinder.singh@linaro.org To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, etienne.carriere@linaro.org, trini@konsulko.com, sjg@chromium.org, sughosh.ganu@linaro.org, xypron.glpk@gmx.de, michal.simek@amd.com, takahiro.akashi@linaro.org, Jassi Brar Subject: [PATCH v6 6/6] fwu: provide default fwu_plat_get_bootidx Date: Wed, 31 May 2023 00:30:06 -0500 Message-Id: <20230531053006.21972-1-jaswinder.singh@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230531052804.21871-1-jaswinder.singh@linaro.org> References: <20230531052804.21871-1-jaswinder.singh@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 From: Jassi Brar Just like fwu_plat_get_update_index, provide a default/weak implementation of fwu_plat_get_bootidx. So that most platforms wouldn't have to re-implement the likely case. Signed-off-by: Jassi Brar --- lib/fwu_updates/fwu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index a24ccf567a..c9996f4d6d 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -545,6 +545,24 @@ __weak int fwu_plat_get_update_index(uint *update_idx) return ret; } +/** + * fwu_plat_get_bootidx() - Get the value of the boot index + * @boot_idx: Boot index value + * + * Get the value of the bank(partition) from which the platform + * has booted. This value is passed to U-Boot from the earlier + * stage bootloader which loads and boots all the relevant + * firmware images + */ +__weak void fwu_plat_get_bootidx(uint *boot_idx) +{ + int ret; + + ret = fwu_get_active_index(boot_idx); + if (ret < 0) + *boot_idx = 0; /* Dummy value */ +} + /** * fwu_update_checks_pass() - Check if FWU update can be done *