From patchwork Mon Jun 12 08:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 1793806 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=cIp5SR2d; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QfkxP5pKQz20X6 for ; Mon, 12 Jun 2023 18:14:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2492786180; Mon, 12 Jun 2023 10:13:43 +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="cIp5SR2d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9672986068; Mon, 12 Jun 2023 10:13:32 +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-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 3818D860BB for ; Mon, 12 Jun 2023 10:13:27 +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=rui.silva@linaro.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-30ad458f085so2857906f8f.0 for ; Mon, 12 Jun 2023 01:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686557606; x=1689149606; 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=k80/pMirkb2jWWuhd9T5GN+t3ZNRVU51/E4vwNeD9I8=; b=cIp5SR2de0Z4+S7gSlYMVelqtHV6I8UtBOmIiHBgv4UlUH0AbZ11krx4iL6ywiDJ60 LDYAHVBpkKXCLZbpyB/mOimOKuIzfAKu2joW3inFzBt1+TOeXj/mx82k3ZmjxtRjQCEW 54yhfLfQiANqxrsUKtCMZhn7hbzWF6MgX1iBZIM+GjxeE1PGd5oqYTrBFuJD7A45q11G CTdwGwCYbOdWs5orUefQa8ktntF0us51kA0bIUwMQ195CuBc3zvKFV8s5hXnElF0AwPH +teLhOMZQOPW0ZE7NyAgisX6TvXruZTVFsH1eBeRAK+/qYj/NNd0pCi0xLufPmu2SIzB jenQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686557606; x=1689149606; 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=k80/pMirkb2jWWuhd9T5GN+t3ZNRVU51/E4vwNeD9I8=; b=V12C0GL00FYw9lETA7yuqlTSbLPM7wnUSDEZdu9SLqPySRm37WrgONAc7nPJweHr5f bkioRZies99JdX+PUCLCgtm99nLUipaeO6DGDn8oXXlOdLhA7Xb1hTal+paGyru9w+M4 2K3VARo+/nAuGjC/Ab/QMVuh8NUNDUzjXDxoEULDXY1NkBs0bhW630d8aXfTRA5fXQLa CLAcnBBqALS6/UE4UEl8Auh/UchmXinFyyzORyodOTzG3BtNOzoEQwNjlngXUae1uekD 6u0tX340qsOQ9VGoP76rA2Bj2lvaoAGbSBuv96sHsyh67evN3OrHE9pl8YnXXmwhZ7SE MCzA== X-Gm-Message-State: AC+VfDyun7GGvrphQDXS419CoQwlbYE8WgiPqmjMRZGEb9VysgQNPzL0 S/ByfPBTwhWvpb4Jw8BkEQD50TwzhVp3YH/cCIM= X-Google-Smtp-Source: ACHHUZ4ATdFC2rEe5tCLmBAUaw9BAmqHtLUgpT2RPlpGZOHzCuAUqrCfwG5CmgsYwKcJ2UEIg6Obkw== X-Received: by 2002:a5d:5267:0:b0:30a:f68f:9b94 with SMTP id l7-20020a5d5267000000b0030af68f9b94mr4420100wrc.21.1686557606415; Mon, 12 Jun 2023 01:13:26 -0700 (PDT) Received: from arch-thunder.local (a109-49-33-111.cpe.netcabo.pt. [109.49.33.111]) by smtp.gmail.com with ESMTPSA id m9-20020a056000008900b0030ae499da59sm11637390wrx.111.2023.06.12.01.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 01:13:26 -0700 (PDT) From: Rui Miguel Silva To: u-boot@lists.denx.de Cc: Simon Glass , Tom Rini , Ilias Apalodimas , Rui Miguel Silva Subject: [PATCH v3 4/6] corstone1000: add boot index Date: Mon, 12 Jun 2023 09:09:18 +0100 Message-ID: <20230612081314.723786-5-rui.silva@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612081314.723786-1-rui.silva@linaro.org> References: <20230612081314.723786-1-rui.silva@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 it is expected that the firmware that runs before u-boot somehow provide the information of the bank for now we will fetch the info from the metadata since the Secure enclave is the one responsible for this information. Signed-off-by: Rui Miguel Silva --- board/armltd/corstone1000/corstone1000.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c index 6ec8e6144fb4..1bead7a0a8b4 100644 --- a/board/armltd/corstone1000/corstone1000.c +++ b/board/armltd/corstone1000/corstone1000.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -87,6 +89,20 @@ int dram_init_banksize(void) return 0; } -void reset_cpu(void) +void fwu_plat_get_bootidx(uint *boot_idx) { + int ret; + + /* + * in our platform, the Secure Enclave is the one who controls + * all the boot tries and status, so, every time we get here + * we know that the we are booting from the active index + */ + ret = fwu_get_active_index(boot_idx); + if (ret < 0) { + *boot_idx = CONFIG_FWU_NUM_BANKS; + log_err("corstone1000: failed to read active index\n"); + } + + return ret; }