From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ABF4C4338F for ; Sun, 15 Aug 2021 18:18:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B432561245 for ; Sun, 15 Aug 2021 18:18:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B432561245 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B863982E54; Sun, 15 Aug 2021 20:17:35 +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="SLdOro0a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60E6C82DF6; Sun, 15 Aug 2021 20:17:24 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 4B38982B77 for ; Sun, 15 Aug 2021 20:17:16 +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=marek.vasut@gmail.com Received: by mail-wm1-x330.google.com with SMTP id f10so7075927wml.2 for ; Sun, 15 Aug 2021 11:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YVgT2/Zcpc37kHwgDPnUhAhxxztpp3JuxcoKULBSZV4=; b=SLdOro0a7qtuF59emUGbwZ87PUxKp5ak96TMdCA43c5Kgyhqb5hRDW1m1pLyH9fzuE GHNhv0FVsNiZ6vnuazYymv08uaJQ07JfGnvDnfcJaZEn6DYVp21czg5QOqakIb71zbgm d1VbcB0e96H/NjEyAwJoyL/OG08bIEzJYwkXFaVPqRsMMKa/pi84SGK/DPeVEn7haX6W L2A11d9W0SEFpHv8FyBLBQgFoOKG3+WAg4JGGbDBRpPLdsw8HEcnnpGf7if703F1gyh6 9l/73Ox1pzWLvexyv10AvP8cVX1ZLKuTkWt2XBqlYmYJpeUfuQlgra6A9qmeI5rC9oIK A04w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YVgT2/Zcpc37kHwgDPnUhAhxxztpp3JuxcoKULBSZV4=; b=geRUx1K0BgldoMxmHpNW4Uk8GbP9Cc+eXD7o0CSxEDIW48ZfJ+Cd2iswVCsEW8un3j yDqi6sFD71/YF4Fja+jIyri2pCKcpDdQ9LJye+F0JrKu924dLpTmDhnfBwsV9kkfXtY8 mwqLyxX7l8P8fssJgPciCXC21aSY0qajiRXNtLqoV9MCXB+3v3JyZeOjyrsNyDYt2087 urZD2sH35xX8MoZ+CBE1sWzvO8Pj6/cgmnkfFQy83f+z7+M9eTVEObf05hRsnlWlZTP8 qTGfUwMi0zuV6DobzRaIQGhsLVsm6/cd+HQn2KyQN49uJEp9uWLRmuQTap/3zMIP50Dy zsNQ== X-Gm-Message-State: AOAM533TTX8RHyImT+XQyBYJp5zuAv498LV+KT11UEowWkkrQox6Kwh9 4o3YOOXqSGeYz8IXRKCqksv48CC+9b/F3w== X-Google-Smtp-Source: ABdhPJzlRW3sPJQD3HC5AGfQleR7WyuA5EBmBnbPx+zpjL7vJ/JvyKKMgVn8jw6AdnT5IcjjbXgqVw== X-Received: by 2002:a1c:27c2:: with SMTP id n185mr11454208wmn.20.1629051435950; Sun, 15 Aug 2021 11:17:15 -0700 (PDT) Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz. [89.176.112.137]) by smtp.gmail.com with ESMTPSA id i8sm5920343wrv.70.2021.08.15.11.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Aug 2021 11:17:15 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Alexey Brodkin , Angelo Dureghello , Daniel Schwierzeck , Eugeniy Paltsev , Hai Pham , Michal Simek , Simon Goldschmidt , Tom Rini , Wolfgang Denk Subject: [PATCH 06/14] lmb: Switch to generic arch_lmb_reserve_generic() Date: Sun, 15 Aug 2021 20:13:06 +0200 Message-Id: <20210815181314.132330-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210815181314.132330-1-marek.vasut+renesas@gmail.com> References: <20210815181314.132330-1-marek.vasut+renesas@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Switch arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() to arch_lmb_reserve_generic(). Signed-off-by: Marek Vasut Cc: Alexey Brodkin Cc: Angelo Dureghello Cc: Daniel Schwierzeck Cc: Eugeniy Paltsev Cc: Hai Pham Cc: Michal Simek Cc: Simon Goldschmidt Cc: Tom Rini Cc: Wolfgang Denk --- arch/arc/lib/cache.c | 18 +----------------- arch/arm/lib/stack.c | 33 +-------------------------------- arch/m68k/lib/bootm.c | 18 +----------------- arch/microblaze/lib/bootm.c | 28 +--------------------------- arch/mips/lib/bootm.c | 9 +-------- arch/powerpc/lib/bootm.c | 18 ++---------------- 6 files changed, 7 insertions(+), 117 deletions(-) diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c index 4ba180482c..4c696cb53a 100644 --- a/arch/arc/lib/cache.c +++ b/arch/arc/lib/cache.c @@ -832,21 +832,5 @@ static ulong get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { - ulong sp; - - /* - * Booting a (Linux) kernel image - * - * Allocate space for command line and board info - the - * address should be as high as possible within the reach of - * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused - * memory, which means far enough below the current stack - * pointer. - */ - sp = get_sp(); - debug("## Current stack ends at 0x%08lx ", sp); - - /* adjust sp by 4K to be safe */ - sp -= 4096; - lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp)); + arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096); } diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c index 3f961f4454..52d9f15298 100644 --- a/arch/arm/lib/stack.c +++ b/arch/arm/lib/stack.c @@ -45,36 +45,5 @@ static ulong get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { - ulong sp, bank_end; - int bank; - - /* - * Booting a (Linux) kernel image - * - * Allocate space for command line and board info - the - * address should be as high as possible within the reach of - * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused - * memory, which means far enough below the current stack - * pointer. - */ - sp = get_sp(); - debug("## Current stack ends at 0x%08lx ", sp); - - /* adjust sp by 4K to be safe */ - sp -= 4096; - for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { - if (!gd->bd->bi_dram[bank].size || - sp < gd->bd->bi_dram[bank].start) - continue; - /* Watch out for RAM at end of address space! */ - bank_end = gd->bd->bi_dram[bank].start + - gd->bd->bi_dram[bank].size - 1; - if (sp > bank_end) - continue; - if (bank_end > gd->ram_top) - bank_end = gd->ram_top - 1; - - lmb_reserve(lmb, sp, bank_end - sp + 1); - break; - } + arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096); } diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c index 51a6f93858..27729db67e 100644 --- a/arch/m68k/lib/bootm.c +++ b/arch/m68k/lib/bootm.c @@ -32,23 +32,7 @@ static void set_clocks_in_mhz (struct bd_info *kbd); void arch_lmb_reserve(struct lmb *lmb) { - ulong sp; - - /* - * Booting a (Linux) kernel image - * - * Allocate space for command line and board info - the - * address should be as high as possible within the reach of - * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused - * memory, which means far enough below the current stack - * pointer. - */ - sp = get_sp(); - debug ("## Current stack ends at 0x%08lx ", sp); - - /* adjust sp by 1K to be safe */ - sp -= 1024; - lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp)); + arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024); } int do_bootm_linux(int flag, int argc, char *const argv[], diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index 6695ac63c7..3a6da6e29f 100644 --- a/arch/microblaze/lib/bootm.c +++ b/arch/microblaze/lib/bootm.c @@ -34,33 +34,7 @@ static ulong get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { - ulong sp, bank_end; - int bank; - - /* - * Booting a (Linux) kernel image - * - * Allocate space for command line and board info - the - * address should be as high as possible within the reach of - * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused - * memory, which means far enough below the current stack - * pointer. - */ - sp = get_sp(); - debug("## Current stack ends at 0x%08lx ", sp); - - /* adjust sp by 4K to be safe */ - sp -= 4096; - for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { - if (sp < gd->bd->bi_dram[bank].start) - continue; - bank_end = gd->bd->bi_dram[bank].start + - gd->bd->bi_dram[bank].size; - if (sp >= bank_end) - continue; - lmb_reserve(lmb, sp, bank_end - sp); - break; - } + arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096); } static void boot_jump_linux(bootm_headers_t *images, int flag) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index fde90fced4..cab8da4860 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -39,14 +39,7 @@ static ulong arch_get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { - ulong sp; - - sp = arch_get_sp(); - debug("## Current stack ends at 0x%08lx\n", sp); - - /* adjust sp by 4K to be safe */ - sp -= 4096; - lmb_reserve(lmb, sp, gd->ram_top - sp); + arch_lmb_reserve_generic(lmb, arch_get_sp(), gd->ram_top, 4096); } static void linux_cmdline_init(void) diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c index 31c17b5bb3..8d65047aa4 100644 --- a/arch/powerpc/lib/bootm.c +++ b/arch/powerpc/lib/bootm.c @@ -119,7 +119,7 @@ static void boot_jump_linux(bootm_headers_t *images) void arch_lmb_reserve(struct lmb *lmb) { phys_size_t bootm_size; - ulong size, sp, bootmap_base; + ulong size, bootmap_base; bootmap_base = env_get_bootm_low(); bootm_size = env_get_bootm_size(); @@ -141,21 +141,7 @@ void arch_lmb_reserve(struct lmb *lmb) lmb_reserve(lmb, base, bootm_size - size); } - /* - * Booting a (Linux) kernel image - * - * Allocate space for command line and board info - the - * address should be as high as possible within the reach of - * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused - * memory, which means far enough below the current stack - * pointer. - */ - sp = get_sp(); - debug("## Current stack ends at 0x%08lx\n", sp); - - /* adjust sp by 4K to be safe */ - sp -= 4096; - lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp)); + arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096); #ifdef CONFIG_MP cpu_mp_lmb_reserve(lmb); -- 2.30.2