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 332E4C54EE9 for ; Sun, 11 Sep 2022 16:12:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E2FEB84BB6; Sun, 11 Sep 2022 18:11:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="C8pEVUAJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76D1484BA0; Sun, 11 Sep 2022 18:11:10 +0200 (CEST) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 E326984B96 for ; Sun, 11 Sep 2022 18:11:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-wr1-x434.google.com with SMTP id t14so11658642wrx.8 for ; Sun, 11 Sep 2022 09:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=JoxVkMnX4mW65M99Ggmh19GWKHTfkqLkntWgNAsZin4=; b=C8pEVUAJh2yXfHc2R/K5phIkWLurK0Yr/3pHA8zDcZMyYlwg6yZ5DMzfn/UT9E01uI zK8eKi0i+C/hcRFx8AB6XOhOaGhdxa/W5Z4pBLlu+jnSvm4gbFiwOe6i3G69sR7b36by KKhyNYVXPrJmVUECHZtPqa/U00IUE9WKD7Tll82DWrUcEJf9oFvOyv1LSOrVFgAh41xg Uuu+GLV7shBREpL1y7ZNPwzzBteuP5tKCQoiSa/4XYJ+4QydNeZRTRopw2duIFJQZVkF wATlm8CayrhweKwcr83AS7V5YXtDOuiu6K3TxjwEanUVODIY9qHK/32nMpZGyxuiHdl+ YRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=JoxVkMnX4mW65M99Ggmh19GWKHTfkqLkntWgNAsZin4=; b=GwFvE4CT9wbCj3GK5UedeKwfSblM/hKc6nq4QpLjM8EI0m36HWrOp9fhLCrGqQZzIn H75fleqLI2NN1Pl+J/0eoX9vFdZ6Y315POmYopMNm0J+iBtgDqk78x/+CXaluJ17SrnQ lfcD5UmR9yQdjkm7viAu85enR7B5o7ZKek4qFmAkpg0r/XEZTU/uRJL4/Xvd6jUYkE41 SMNsYIEDQRJFbmZ29qFXt71pGZXov03mcg+85u3rxAickV1QJ5NDpJh4wJ4SpY+3LgiH C/C1Q9UOhLHrvNQCvz9lmmU7ZQGhHr2MYTyLQBTu3kTlXpGpKo4XlxIuWwLiXBP2+aG+ Orvw== X-Gm-Message-State: ACgBeo0YYFo+C1j//hmJ1nwGQLM0rm2y9lPAaqVzfzBIiSEsUI9KieWl /zx/aKHyM3i509NO77nPGKJwF7c3G4Q= X-Google-Smtp-Source: AA6agR4XlqIhYQNZLDouA6JSi6E/YYUbf1R/QOxOF1qpW1yw4xWw9DGhMqk1bSTBzBABW2s742KN1Q== X-Received: by 2002:a05:6000:681:b0:22a:3007:df45 with SMTP id bo1-20020a056000068100b0022a3007df45mr9083220wrb.149.1662912662339; Sun, 11 Sep 2022 09:11:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f07:610e:db00:f58e:2331:88f2:f78b]) by smtp.gmail.com with ESMTPSA id h8-20020a05600c350800b003a608d69a64sm7446779wmq.21.2022.09.11.09.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Sep 2022 09:11:01 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Andy Shevchenko , Dzmitry Sankouski , Heinrich Schuchardt , Marek Vasut , Michal Simek , Rick Chen , Simon Glass , Wolfgang Denk Subject: [PATCH 3/4] common/board_f: introduce arch_setup_dest_addr() Date: Sun, 11 Sep 2022 19:10:50 +0300 Message-Id: <20220911161052.2986264-3-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220911161052.2986264-1-ovpanait@gmail.com> References: <20220911161052.2986264-1-ovpanait@gmail.com> 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.6 at phobos.denx.de X-Virus-Status: Clean In order to move ppc-specific code out of setup_dest_addr(), provide an arch-specific variant arch_setup_dest_addr(), that can be used by architecture code to fix up the initial reloc address. It is called at the end of setup_dest_addr() initcall and the default implementation is a nop stub. Signed-off-by: Ovidiu Panait --- arch/powerpc/lib/stack.c | 17 +++++++++++++++++ common/board_f.c | 21 +++++++-------------- include/init.h | 13 +++++++++++++ 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/lib/stack.c b/arch/powerpc/lib/stack.c index f2a4652e08..2e731aa870 100644 --- a/arch/powerpc/lib/stack.c +++ b/arch/powerpc/lib/stack.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -30,3 +31,19 @@ int arch_reserve_stacks(void) return 0; } + +int arch_setup_dest_addr(void) +{ +#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500)) + /* + * We need to make sure the location we intend to put secondary core + * boot code is reserved and not used by any part of u-boot + */ + if (gd->relocaddr > determine_mp_bootpg(NULL)) { + gd->relocaddr = determine_mp_bootpg(NULL); + debug("Reserving MP boot page to %08lx\n", gd->relocaddr); + } +#endif + + return 0; +} diff --git a/common/board_f.c b/common/board_f.c index 3789708a30..96458c5151 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -45,9 +45,6 @@ #include #include #include -#if defined(CONFIG_MP) && defined(CONFIG_PPC) -#include -#endif #include #include #include @@ -307,6 +304,11 @@ __weak ulong board_get_usable_ram_top(ulong total_size) return gd->ram_top; } +__weak int arch_setup_dest_addr(void) +{ + return 0; +} + static int setup_dest_addr(void) { debug("Monitor len: %08lX\n", gd->mon_len); @@ -334,17 +336,8 @@ static int setup_dest_addr(void) gd->ram_top = board_get_usable_ram_top(gd->mon_len); gd->relocaddr = gd->ram_top; debug("Ram top: %08lX\n", (ulong)gd->ram_top); -#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500)) - /* - * We need to make sure the location we intend to put secondary core - * boot code is reserved and not used by any part of u-boot - */ - if (gd->relocaddr > determine_mp_bootpg(NULL)) { - gd->relocaddr = determine_mp_bootpg(NULL); - debug("Reserving MP boot page to %08lx\n", gd->relocaddr); - } -#endif - return 0; + + return arch_setup_dest_addr(); } #ifdef CONFIG_PRAM diff --git a/include/init.h b/include/init.h index 7b8f62c121..448da34b46 100644 --- a/include/init.h +++ b/include/init.h @@ -103,6 +103,19 @@ phys_size_t get_effective_memsize(void); int testdram(void); +/** + * arch_setup_dest_addr() - Fix up initial reloc address + * + * This is called in generic board init sequence in common/board_f.c at the end + * of the setup_dest_addr() initcall. Each architecture could provide this + * function to make adjustments to the initial reloc address. + * + * If an implementation is not provided, it will just be a nop stub. + * + * Return: 0 if OK + */ +int arch_setup_dest_addr(void); + /** * arch_reserve_stacks() - Reserve all necessary stacks * -- 2.25.1