From patchwork Tue Oct 8 18:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 833590 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp435636wrv; Tue, 8 Oct 2024 11:15:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUkfWzS1XaziSkjfkbhbPFzQBf1qFaSLxdQ7GNqTjOAw2nu7oEDngz7StkrVUD/bwCiH22YxQ==@linaro.org X-Google-Smtp-Source: AGHT+IGXhQuUJNIiTG3gwDTUf3ODKhIpcLlYgutrb+oWOA/B271sSKRLrLw9Lpj2vwuNcWd1UHDR X-Received: by 2002:a05:6602:474e:b0:82c:d768:aa4d with SMTP id ca18e2360f4ac-834f7ce8e89mr1500634839f.9.1728411346115; Tue, 08 Oct 2024 11:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728411346; cv=none; d=google.com; s=arc-20240605; b=YfrRc9irIGuA40XLHpARrTUL5V/y9B5ccwRAXqJT4vzI4eh1aUe2hOo66AhTTedyAP RnmeEB6UN0Be3dC5IliQY9JLcrxZsPBUk7lMKvfL+94OxaBvkC+abIrbrs/0o842uGb/ mMCB6dR+aSK/A1dwnC1osaaqrWQaBzlW+BHVpBp+GfhbMZ8VKc0XiwOe29OY93MM5HZF YAb06ey6RnzFET9tZz2Y1xArGgBtsCqH92Sddi1RtklWjvSQIt32hvog4sUJhD1gJFIG ytlBqmMy2V9SxCQF0VCQjci1IWFtUWC2vfdNXwihk9pFL7p7ZDyqK3WvTeHmRlrNpW+B LE/A== 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=EiUytkx1HbRL+lc/bYqo/egjpcciKImkbqU95OuxUlE=; fh=EURqIhM9Cs9+QDCQ9Vm6IsJQ8gNya1VBDuunKFxPiA8=; b=GC4D3f7Z7N+QzjvjHLCQ1Nz7X8oqfiBikOU6CmJd4A/wrlr9nsGHkYNTDz7Mh2nIB+ EuA8y+TxGAO6sCNcb2Dau0lh2+wHCp0FTbARpoyZQPku0EeIxklhe7rqv2cW7gZXE+UJ o6SEukdz/qVizkffbbFzERWmZoBhpTgut/b682VE8vuGcvHMy5P7ccxVGILhrtCv1XNz xV5/x5a5WVWtzUjTCNTEVqn6yka2UD+gShyZERAZdhRaOBaRLNkYA/Ojx4rNtzcP1fR4 PxaJ5VzBQ/RP9kHIcIWBCU78ubW/3ZMfEESHbBWnj1HICswyM9qu2B2sV3cJeZq8pHpG 0LcA==; 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 8926c6da1cb9f-4db817b1a86si2751701173.26.2024.10.08.11.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:15:46 -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 812FB88EFB; Tue, 8 Oct 2024 20:15:06 +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 DF42F88F0C; Tue, 8 Oct 2024 20:15:05 +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 F3E3688EF9 for ; Tue, 8 Oct 2024 20:15:03 +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 0270BDA7; Tue, 8 Oct 2024 11:15:33 -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 8D3053F64C; Tue, 8 Oct 2024 11:15:00 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Tom Rini , Bin Meng , Caleb Connolly , Jonas Karlman , Sughosh Ganu Subject: [PATCH v2 05/14] add a function to check if an address is in RAM memory Date: Tue, 8 Oct 2024 23:44:26 +0530 Message-Id: <20241008181435.1753814-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008181435.1753814-1-sughosh.ganu@linaro.org> References: <20241008181435.1753814-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 V1: None common/board_r.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 4faaa202421..877ea3afd06 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -72,6 +72,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) { /*