From patchwork Thu Jul 4 07:35:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 809946 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1043900wru; Thu, 4 Jul 2024 00:43:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkPruSuZDAPK3CcWy6syw8nLOvhbiAYT+yNnOTrSUE70Ba2LMn50sK+7JWxNHJGtJzIl9eT9Fkpb5Q6NWK6eWf X-Google-Smtp-Source: AGHT+IF//n3eADos6mplnQSYcWtoFT6XZoSAivLdtZmGUjVZB/88oFL0E6phP9wCe3cKuAd0b7+7 X-Received: by 2002:a17:907:3d9f:b0:a6f:c886:b68b with SMTP id a640c23a62f3a-a77ba4828famr63404166b.43.1720079003412; Thu, 04 Jul 2024 00:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720079003; cv=none; d=google.com; s=arc-20160816; b=ExXfieAzYOELCV2eyteO0gS8zKr2DYXri8k3rzQTJd6krrPE0BYXBVil9DFDWD9t7Q lywSkhoP2EPSMhT9wmmlq1cYY9SPugF8MGzshp1DrDcjxrBhTP6kFXydkB1R9G/6sPZP 9DuOMLmqhbBiOzYuOhnJLGzNfuo86SP5uLVSE62BCxnhyXgPXDKKjigw9QzAgmEjTlRj D2H0nMlR/tbHm5t6yFedIxyPjOzQfWC5DuoGGrbf0xvWTgl00ZJB9AAo8PBosyqro7ME sdtv2nlexKhR3avXZmAVFYxLlDBxbz8ndZjJuhXgX2/whq/0CeIC+dXSdIMGnyaR8YkE 88+g== 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=PAfXyw1/aqYleZPdXlBiilqD0gfZCYC1chsUv8DXHXc=; fh=ez1zzjhC0XWyqTp7tWutqrA/nFdALDnQKrnQnXYhk5Q=; b=KQ+4Cxx4iJOPXY5YMAbR+xaOwekN8fQWI62FPRNJ7HXERhkbS+97ixRmZdEORyAR3i 1Wc5nd4Q5ygJHIqa3F/E7GnzqGLleRSK8P+/l/W4S7tCVfuZB6YGI5qfhdWgX//fS4n0 EFdSokhc0qcqF7J3kiw7Lmk4kudO1yIM6VLCo9fpZhlMEwcjc/xpOd+r16saqu7XG0bw AFiE6EhV1T7BbnLUaMEjbd30R4qJgsOUUi/SiLW4leAF6pSkdkV8FBQWwj0WCo8Dxxrg Z98w9B+IKxnq/a/4G1XiuNHeJxsfsz/rXK74MSPKUvPmEbraNc+buEpB036zsivxabl2 S0pg==; 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 a640c23a62f3a-a72ab0bcfc5si656701366b.1014.2024.07.04.00.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 00:43:23 -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 71061888E0; Thu, 4 Jul 2024 09:38:31 +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 5C5998889D; Thu, 4 Jul 2024 09:38:30 +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 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 67A9B88970 for ; Thu, 4 Jul 2024 09:38:28 +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 E8EBFDA7; Thu, 4 Jul 2024 00:38:52 -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 AE9183F762; Thu, 4 Jul 2024 00:38:24 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Mark Kettenis , Fabio Estevam , Michal Simek , Sughosh Ganu Subject: [RFC PATCH v2 39/48] add a function to check if an address is in RAM memory Date: Thu, 4 Jul 2024 13:05:35 +0530 Message-Id: <20240704073544.670249-40-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240704073544.670249-1-sughosh.ganu@linaro.org> References: <20240704073544.670249-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: * Have a common weak function for all platforms, sandbox included. common/board_r.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 1a5bb98218..427688168c 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) { /*