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 907F8C77B7A for ; Wed, 31 May 2023 05:30:21 +0000 (UTC) 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) 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-Google-Smtp-Source: ACHHUZ6o8cVdHT0DwV/+KpUpXYUxvVqBHbpwjCxQMfoF0++awElF8qAK1CT4cppwCioNMw3Y8mr/8w== 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 Content-Transfer-Encoding: 8bit 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 * -- 2.34.1