From patchwork Mon Apr 10 23:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jassi Brar X-Patchwork-Id: 672045 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:184:0:0:0:0 with SMTP id p4csp495842wrx; Mon, 10 Apr 2023 16:05:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bu3CUukyrQN6tuoiDPLo3Y1F6w/rnXGHHsGFkTvEgcVK9AhqrVD4ehTXgbnsa1FCx+szqI X-Received: by 2002:a05:622a:1006:b0:3e6:2bba:87f3 with SMTP id d6-20020a05622a100600b003e62bba87f3mr21093307qte.47.1681167928368; Mon, 10 Apr 2023 16:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681167928; cv=none; d=google.com; s=arc-20160816; b=EX7aJgbnCQmxb3HfCQP65Jj6Kyrz8IqdTDIQhLIRmdtlnx/PSw7ekdhHuY8PZxJ/xP uTc4tMaEfoaOP7u6F6GEKotEI79OXaZ8nrFpS0JPlaUTIaDHRoPOLZYNOQrDmaaTh1dX GAM566VhdQJJjTc4MkTY2GOx0AO+/3/ODiagaAh5RxTqRAjQ+9+rFoprLRpZR8ntNZpG 3e7vtO5Khc3S7ol86BMx+GoOxiPF8xvt6qLiMkQh58NvoqUlzctj56VwoBbu64ZRSYho C+ijn7d5ir/SXV3I0hHUNycMZuzeCtKXhS1Oy0n57BZQuV7Lzz2VTmCHn+SldxlLGb6q 4ddQ== 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=IPTyz6lnbmbVYB3Pa6SrfsUf6afOuP2PcJq5Fii460lOZ3Qc5m4byTDX1Yd4Q7TWIF iVoQZZZCChPxR4a25tDM8iAz5oAyIiEcGcvP6VLePY5XYw2xMfuxVx5a0WiYTi4teQyh pEG8StMhAeQWCJgyavsziJB5v9aIzRYsZZtQBfNjnALDwYEQ7WKDLl3Ya5t4g0zr4uZl eOL7aoUvV3Xw0FSYIq5Z79u8aH1SeOgRW6QFX5wrB7LKR7ox6Dblgtzi9aV3Yo7yO2dY 937GMsEixH0IAfVkYRLGQVjP7iwTM8FvAvnwkJri4XSazfa/RDcn26UyIgYw2aU0Qkb+ zbzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g1n/xWJJ"; 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 d126-20020a37b484000000b007487c63263bsi7720301qkf.425.2023.04.10.16.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 16:05:28 -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="g1n/xWJJ"; 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 BDA1785D77; Tue, 11 Apr 2023 01:05:25 +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="g1n/xWJJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7437185E34; Tue, 11 Apr 2023 01:05:19 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (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 6B49485B31 for ; Tue, 11 Apr 2023 01:05:04 +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-yw1-x112e.google.com with SMTP id 00721157ae682-54c17fa9ae8so225810167b3.5 for ; Mon, 10 Apr 2023 16:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681167903; x=1683759903; 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=g1n/xWJJ2bMFlLW2EVq5lPWbgVOnKXzXXRYqwbcadEcoUoqqDlofcKVn5kopuizVIl la35wG7qpOHoXgvQ8z2MT+12tC0O4YNjmnPm8C1xgPsHgTZYkdqlPgICKsfNQ3rPhXQ0 zSce4vimT3eseWyiy8aktT+UqlVzhIoPD2KCzcJZhSuWz4LFrttVIu/ppB0xjPjNcW6S I7RMnYcUMwzNdunlojolUvyqscGDsr5i5B8rK/yREKLgX4tzB+ml039chnOwYIulGvEd KElRX1kwvkPh0GUd688d90kIqPj7hZnC0n5TsNvMQE9G2AnJr1ojksbAxGdwbbBibeWS 9SKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681167903; x=1683759903; 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=zY9eGnJ8nXzhtiP5e1NfROkYdnqsG1NmERwzawfNqkRsg4EQ3UXMprdHB1WSeNfFm+ VxOGZk91E0puQjsLak9IEMZUO/TJRzbQ58wuaTRKoh2fwO52cW26h1aY1yQCMWW+FAHX mG70M1vCDuD30pOTsOOBP40ygEDgW/a1JQbiXr0ghEBHPOPw/NAMItMtkYr1TivM64dK pRZIQBJsjkaj6f8LVELM2O4WdpZt6w1aZwb9J+z/T4j9nKtiqI8Pzh2eAKyVysaSxxzU xloldiv0Fm60cjZsYlap0hdKKOGAN+cEXgpwpshjqGCCBmEtoqQg1ZH9pvoPLrZw4+zX xIbw== X-Gm-Message-State: AAQBX9c5JNeCX9//ou42Q2+26L4xV5a/M402Y8RpT5ITe/AZmeF1k2Qs MkeaYP/kxd9PwmmHVigmxh3TR0+VAU0eIaW83lk= X-Received: by 2002:a0d:ddc5:0:b0:541:a166:a916 with SMTP id g188-20020a0dddc5000000b00541a166a916mr9478703ywe.36.1681167903044; Mon, 10 Apr 2023 16:05:03 -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 z35-20020a81ac63000000b005463f6ae720sm3053008ywj.68.2023.04.10.16.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 16:05:02 -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, takahiro.akashi@linaro.org, michal.simek@amd.com, Jassi Brar Subject: [PATCH v5 6/6] fwu: provide default fwu_plat_get_bootidx Date: Mon, 10 Apr 2023 18:04:59 -0500 Message-Id: <20230410230459.72680-1-jaswinder.singh@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410230143.72556-1-jaswinder.singh@linaro.org> References: <20230410230143.72556-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 *