From patchwork Thu Sep 5 08:28:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 825619 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp186804wrb; Thu, 5 Sep 2024 01:29:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXya42zUzAjd2wycqJdYyi84pu27a3C/lbTouU6qHGl4wrRpCmfB7SIwJ9rjQH+ym6xjxgzyw==@linaro.org X-Google-Smtp-Source: AGHT+IHWFUu0S+Sqv6rm/9Sj9LUcuQX6LKe2vh3kTAA9cZswFyj/ik6r9MtxuZfEErWWZO8cmgFT X-Received: by 2002:a05:6402:1d51:b0:5c0:a8d0:8782 with SMTP id 4fb4d7f45d1cf-5c24377a939mr12638558a12.28.1725524976795; Thu, 05 Sep 2024 01:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725524976; cv=none; d=google.com; s=arc-20240605; b=KX4V+Kh+XPw317kVFsZvQCq0LZMjc3y7o+Gkeg50lhNAdw7I8UM2SsIbBZauLw7nsd uoW9255gXBkff8gGY/sofLrLXQqJgAfq7cQ9RNCizXVRXgBUW+zgWrYkZvEg+Og8yaxr ELyJgqV7Nro6ZrJaeQpNl4gombAecWpdEJSATjF1DYsmEe5R03BcQi0165fZnz+QuVTQ p9WKrmbzZMqWDTmqQMHJAAYv6mQNixQ6LNwfcoll7sN9a1c1MVy+anT742QI8yV41TAu c2NJ9lMyJGISuXjAt0yFv7r1Xc+czjbXqGbKnT0X96/mRc77ypy8mMDAp6evFr2eGCe7 WzPw== 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=GzSW4VU9+fYhN/NA3Sd5uPm2n3Ymbbb4PQUQU3dgpAA=; fh=xhhG27Jur2HVmyj6xWbgrQg2vRawqr6LmtjP4yz05ls=; b=fmHE9tReNklURmSaBOBEb78gzgkndcGYTBgQLbtEnBM5+ytECfHRAlErH4h+ei7PPO a7up6oZTxxTVnjlU7owb/phS/4zQxOEn1CDTZzTMWTtp4MxBMVyLtdGuQomiHOMBF5Tn 35pX6S9xobUwJDMrZLyr05SENCEYoIQwJuE2xT1m5iOI2GKpyZSu74WKmnyhdQjQeDmL zZwPjsAKsSAy09yPnay63G3TkG/0ult+4sXASYbahaTF9FnsPgTNuXKS9kP1e4DW2XkD QkleBnrZ7kZdj4lpTeYdSnwg4n8iLp7OyfuGCECSgPR1FSr0JAyoeXsPAmOpKQ6ebMyJ mh3Q==; 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 4fb4d7f45d1cf-5c3cc6b0da6si1141183a12.572.2024.09.05.01.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 01:29:36 -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 D0E0088C94; Thu, 5 Sep 2024 10:28:57 +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 2410888C91; Thu, 5 Sep 2024 10:28:56 +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_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_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 190BD88CC2 for ; Thu, 5 Sep 2024 10:28:52 +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 27174FEC; Thu, 5 Sep 2024 01:29:18 -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 342363F66E; Thu, 5 Sep 2024 01:28:48 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Tom Rini , Bin Meng , Sughosh Ganu Subject: [PATCH 06/16] add a function to check if an address is in RAM memory Date: Thu, 5 Sep 2024 13:58:01 +0530 Message-Id: <20240905082811.1585467-7-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905082811.1585467-1-sughosh.ganu@linaro.org> References: <20240905082811.1585467-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 --- common/board_r.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 4faaa20242..877ea3afd0 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) { /*