From patchwork Sun Oct 13 10:55:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 835071 Delivered-To: patch@linaro.org Received: by 2002:adf:b352:0:b0:37d:45d0:187 with SMTP id k18csp1536655wrd; Sun, 13 Oct 2024 03:56:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWI6SJWffIaywhOqBvZZaK3aPpQOboArq1WNezE671vbBYqvzOpU/xyD6oVMpOtRyBhL5KJCQ==@linaro.org X-Google-Smtp-Source: AGHT+IFNHvAFffZ1JPhPs/7qH/SVE2jfIHKjUhEGrLFV+8ga2KIVv6JhvpKeJqe+0U2sfFSDdEjQ X-Received: by 2002:a05:6e02:1caa:b0:3a0:bc39:2d8c with SMTP id e9e14a558f8ab-3a3bce0fc22mr33961025ab.25.1728816996600; Sun, 13 Oct 2024 03:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728816996; cv=none; d=google.com; s=arc-20240605; b=MrrWf5oMIQqO1HDt5Rs5uQ87kH+zig0aPo7lRkq5F0eKW27FGveexp3KgA5qjs7okK mD2mxhhGZN8+WpCsyqBjP65MfzA3aUszwYkJu7RCbnCx49hcaEpP0XLEDiMlbzSX3nde VBuOVAMoGoxhskrlj57xEFOMQkTrVfAM78pgiXfOpC4RzPcMa0PDAWro+b6UEMKGh5Bc rmbk6c2A2PnjSjnf8Soy0bIOtwBH6gHYUooLogOsHtAONfsbXDAwBqizUJqWSZmw9g5O P+R9jTGuOqXIi1/mkX6MqMiEe6iLhXQYVfVqz1zaOpW0QApW72Hiz9BwHzCNJCtgzqrK B+3A== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=r4V/azlZEZZiY372mP6kjIwTenlGqBB9hvsGrtN4WuY=; fh=DqKFq13hCy9hcb48ZltPVvgEKSF1g1c/m42wn0WwlIc=; b=Wni54MkYdNHKXCJ2dt6ZP2JzeSjumQOsiM5M0g84Hv3ZhmmoE6d1ifB1jcz1wx2kKq oGb0Gc1AvMsQ1Ek0rvHB1rBd42ys9jB9/Yu7qH6F7N4+Lyi8LFNLN+RTztCS5UShXPyv HiOj4ZEr9MiaW4fhB3ffbSy6Al9zvri2xVVy1k5PrkphfHXXFPA1OcNn+qqLdeoZWxzx 1yqODbZq4lnSElnJ9R7Gn0t7xv5l2qyrQBvpkzD9jFQqQ4eME/rbGj1LHh59lVEarXeO Xv0kZlPfbjyuYUirmRPGG+EgndutssiSCilvEcmAqDjymD4DgVqz2UQ30aB6yHyvWs0D mnNQ==; 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 e9e14a558f8ab-3a3afdfb489si32888915ab.121.2024.10.13.03.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 03:56:36 -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 362B388EEA; Sun, 13 Oct 2024 12:56:01 +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 8003588EE8; Sun, 13 Oct 2024 12:55:59 +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_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_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 8C22E88DF5 for ; Sun, 13 Oct 2024 12:55:57 +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 9BC081007; Sun, 13 Oct 2024 03:56:26 -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 74E793F71E; Sun, 13 Oct 2024 03:55:54 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Tom Rini , Caleb Connolly , Jonas Karlman , Sughosh Ganu Subject: [PATCH v3 05/15] add a function to check if an address is in RAM memory Date: Sun, 13 Oct 2024 16:25:12 +0530 Message-Id: <20241013105522.391414-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241013105522.391414-1-sughosh.ganu@linaro.org> References: <20241013105522.391414-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 Add a function to check if a given address falls within the RAM address used by U-Boot. This will be used to notify other modules if the address gets allocated, so as to not get re-allocated by some other module. Signed-off-by: Sughosh Ganu --- Changes since V2: None common/board_r.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 1acad069d9..4694f49a43 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -73,6 +73,11 @@ DECLARE_GLOBAL_DATA_PTR; ulong monitor_flash_len; +__weak bool __maybe_unused is_addr_in_ram(uintptr_t addr) +{ + return addr >= gd->ram_base && addr <= gd->ram_top; +} + __weak int board_flash_wp_on(void) { /*