From patchwork Fri Oct 25 12:15:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 838339 Delivered-To: patch@linaro.org Received: by 2002:adf:e287:0:b0:37d:45d0:187 with SMTP id v7csp239899wri; Fri, 25 Oct 2024 05:16:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXZ1zQW6qG+Hl0en6PuXgGHCHIGaan83lDhrXoJkf8Qaf2FdfX+9vU9tVbRrnQNpUTvUm6zuQ==@linaro.org X-Google-Smtp-Source: AGHT+IF6rZarpcxV0L013VuEaIZ08KBNzP3ApL5G9Ij/kYn459bUszGDFACaGmyl2gRqcI0W+gE4 X-Received: by 2002:a2e:4a01:0:b0:2fa:ddb5:77f9 with SMTP id 38308e7fff4ca-2fc9d383dc7mr39666581fa.40.1729858574309; Fri, 25 Oct 2024 05:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729858574; cv=none; d=google.com; s=arc-20240605; b=EFLTOKIJctaTNDbUO92jaowZLA79lc45FEdo9Su1evGW/gLCBuWId3yOfLhZydv5/z HyL+2kNEk+PpofgqI6TueTshNPJshS9EklEofR2RSAYJ+0COlyVtwHtyPf20BYnaG42u edu9K7equ4o4YmsmJHIGLKR66yFKwEuPk8vZZ9PelNjUfC7zMpjCoo0vmbUAaz/gFtAe UpfBLS6M3an0+fWGn5SXkSUE+zituRhsWx7cjvbw8nn3jMnZaXBfSnjGWEazlKj57Dq1 il/3TGJRTa8sXWEEUVLebAO4GvdrXNhdI1N0aj3cE7U1P+Eb12qmXFvlgu37eeDiT3SY cyAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=Jzv2PceBf2lJukFqt1wdgySxWwmBLva80CQs3kae474=; fh=GbcxIacvxzBGjRu6h7ap324UjtfY8k/ku32YgDYEa9o=; b=dPt5MCvYYcBCo1lwGkgobQobTc7jB+BsqgkVD4S7lGNHabZ3juVa9Py4yI0YAfsPAl XQIZ/hJo5wK/sTdoI9xr+nqajtpMX7dz5WhEtShYm6+hn/SLEC4ll4HMMSukSNi/MhPV mR+g17D1j7DlVvpcg17Krk8H4129oOWz3OWClQtsry00E4aX613IjYOJ8dNTDKZiGdE8 Sed2nsIlduGUCdaUvxeTJE3tEBiargP2wDswVD6INzj4vR9b9z3fuk7q9Fqu6EM+BiHA RBy2IJaZ8pM8UVv8FEr7MKzw3Nye98xFwtQcbcdU/dbTgD+2UbBB6EKB0qxazVPjTnw5 Ig6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id 38308e7fff4ca-2fcb462585esi3315501fa.464.2024.10.25.05.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 05:16:14 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 C0C2A88CD9; Fri, 25 Oct 2024 14:16:07 +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 4EC4F88DEA; Fri, 25 Oct 2024 14:16:07 +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_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL 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 54BD488C10 for ; Fri, 25 Oct 2024 14:16:05 +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 40D8F339; Fri, 25 Oct 2024 05:16:34 -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 E67E43F71E; Fri, 25 Oct 2024 05:16:02 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Michal Simek , love.kumar@amd.com, Tom Rini Subject: [PATCH 0/2] Add generic function for computing ram_top Date: Fri, 25 Oct 2024 17:45:45 +0530 Message-Id: <20241025121547.181633-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 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 board_get_usable_ram_top() function is used by boards to compute uppermost address of RAM(ram_top) that is to be used by U-Boot -- this need not be the highest RAM address of the platform. This computation happens before U-Boot relocates to its final destination address in RAM. Certain platforms, like the Xilinx boards were computing the ram_top value in an indirect manner, through some LMB API's. Thus it is no longer possible to use these LMB API's to compute the ram_top, as the LMB module gets initialised only after relocation, and the heap memory has been set up. Add generic functionality to compute the value of ram_top which can be used by platforms. Sughosh Ganu (2): common: memtop: add logic to detect ram_top xilinx: use get_mem_top() to compute ram_top board/xilinx/common/board.c | 25 +++++ common/Makefile | 1 + common/memtop.c | 186 ++++++++++++++++++++++++++++++++++++ include/memtop.h | 22 +++++ 4 files changed, 234 insertions(+) create mode 100644 common/memtop.c create mode 100644 include/memtop.h Tested-by: Michal Simek