From patchwork Wed Aug 14 10:59:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 819120 Delivered-To: patch@linaro.org Received: by 2002:adf:cd01:0:b0:367:895a:4699 with SMTP id w1csp645666wrm; Wed, 14 Aug 2024 04:03:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9TbijbQ/VAFQ6oILXFB2IH/6hBbQoDWVVpQpsN6YxI1bl+f4UrZ0KjIqNZaJbkjUFPC7aeW5G9tvQ+8DtqNeu X-Google-Smtp-Source: AGHT+IFutgN7rQrca+mUv5IO//+7Q31ZGYnl94anysNgvD9sR3pkb3V8j3AM+eYOzKg1nicPQ2tp X-Received: by 2002:a05:6402:3488:b0:5af:51d6:d8e with SMTP id 4fb4d7f45d1cf-5bea1c7b805mr1543027a12.20.1723633426482; Wed, 14 Aug 2024 04:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723633426; cv=none; d=google.com; s=arc-20160816; b=QFWvklcRe2tCa37P7xjZFV0ZuKiHIz0PUutzmWgxUSRFtsnm+5fC1muUiXDT0/CVSB +LSXSXvQp7uL7DnG7UsnlpmzpwR0w9ay48oO+4fqqVVcQ0b0JJI6nxiWjsti8MCHLGZh aZoULVY7T8E90/O6r9WtwxlWxnDITJxIquAgf5nUiXwQxwa+UANvAWWDOgRwSsSPHqt3 02WJsFdEJT0/Lz6Lcc0uIztW6ZqXg4DUuWoLUtNRdbV8pFJ/spbNkNkMhdp+HGHMPxyo oyW+j84+rWtG++zXZlDNX5VNTHlUYCSUUT1vT2DnJwYaBL0J+ZWHhgrcbw8GVS+5c9QE 4TcQ== 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; bh=y1vo7vzHFETLhLiGcsg4Lqi2sKeY3GVS+NhhqQTR840=; fh=w4WyT9xL7ErtT1TeetrD/m0Y0mAgjnERgxacGUpGjSg=; b=EkC9tzs0ccVD1R++ej4l35iT6ac+4rO7/aAuDUpN8AwfKSSJH+OkuWkBRqXjMaC03Z QBPYMsNpyPnSagD0Xwy80FauXSvVjKkw/VYb786tFAw4TYouIFzOjppQlVRFPKHkffIb AvvzcivFNHphZ9brswzAT9QHw+Qg7dIid9sIeIieMCyEHNA+FxReGQ73bKplwgOVK2Mj ynBJgfkVoTVCCJbxweczb883wQUBzqhSXGzilAdraUOvuVUvp2NwnGRAKuAuQ9LdU9qV yMckTghPwtAu5U6TzDC4UEDIdlgR1qxSIKzssS26l0L3WF1Q3Z8HElOWxJxlzgPsDeeb PJ0Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 4fb4d7f45d1cf-5bd1a5cc2bcsi5017865a12.328.2024.08.14.04.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 04:03:46 -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; 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=fail (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 0227288A54; Wed, 14 Aug 2024 13:02:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2284488A64; Wed, 14 Aug 2024 13:02:04 +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=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 8B13C88A54 for ; Wed, 14 Aug 2024 13:01:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F01C3DA7; Wed, 14 Aug 2024 04:02:23 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BE563F58B; Wed, 14 Aug 2024 04:01:53 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Tom Rini , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH v2 17/32] lmb: init: initialise the lmb data structures during board init Date: Wed, 14 Aug 2024 16:29:54 +0530 Message-Id: <20240814110009.45310-18-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814110009.45310-1-sughosh.ganu@linaro.org> References: <20240814110009.45310-1-sughosh.ganu@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 The memory map maintained by the LMB module is now persistent and global. This memory map is being maintained through the alloced list structure which can be extended at runtime -- there is one list for the available memory, and one for the used memory. Allocate and initialise these lists during the board init. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass --- Changes since V1: * Move the initr_lmb() function to board_r.c * Call lmb_init() from spl.c instead of initr_lmb(). common/board_r.c | 17 +++++++++++++++++ common/spl/spl.c | 3 +++ 2 files changed, 20 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index f445803d7a..0943ed3d01 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -510,6 +511,21 @@ int initr_mem(void) } #endif +static int initr_lmb(void) +{ +#if CONFIG_IS_ENABLED(LMB) + int ret; + + ret = lmb_init(); + if (ret) + printf("Unable to initialise the LMB data structures\n"); + + return ret; +#else + return 0; +#endif +} + static int dm_announce(void) { int device_count; @@ -612,6 +628,7 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_CLOCKS set_cpu_clk_info, /* Setup clock information */ #endif + initr_lmb, #ifdef CONFIG_EFI_LOADER efi_memory_init, #endif diff --git a/common/spl/spl.c b/common/spl/spl.c index d6a364de6e..4102e25115 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -723,6 +723,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2) IS_ENABLED(CONFIG_SPL_ATF)) dram_init_banksize(); + if (IS_ENABLED(CONFIG_SPL_LMB)) + lmb_init(); + if (CONFIG_IS_ENABLED(PCI) && !(gd->flags & GD_FLG_DM_DEAD)) { ret = pci_init(); if (ret)