From patchwork Fri Jun 7 18:52:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 802323 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp949159wro; Fri, 7 Jun 2024 11:55:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIu/dvQ3ATPMp4TSpDxsF6JxT5aGVG/Z+XJD0Kdkq0ZIh2E5Ld3LiqQPyWmQOdOKJgHYUk6c/JfNk2Fb3ujj6K X-Google-Smtp-Source: AGHT+IGvzaiPPheD/b68NKi/4SkmDYI2QeYIJbNSG/Fc49NOiy4DrhT2QvtACCc6UntvfxyiSgTz X-Received: by 2002:a17:906:7192:b0:a6e:fccc:e4a with SMTP id a640c23a62f3a-a6efccc1101mr10712566b.0.1717786542436; Fri, 07 Jun 2024 11:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717786542; cv=none; d=google.com; s=arc-20160816; b=cerKVHrSzHg0eS2y/PUZR3pq6V8FJSRNXJO/BKsNJmIY87ICkpjrWf23HEVyiBdGMF kKbMX17dBExpRu6jqfTzEwROuP3B7zlVpQ7O1iAW8GZkVT8oTl/mG3YYaEaY5LanQOI9 fOzpfZOWcbNRtSsY5mw/f6bd/FFXQU19Y+ABkeXezVOcQmcrfr7y7gMGkdm6McYuvhaA XO2qQjb+vLgTnbYe+3F6TuVEY1oYtcMy88cXyYcblPQf0fQaAWziJl8KDxJkZVXx+XcZ q86x8V5kQ+bVGDApP7EmBCC8wBQlVEUJcFSqhC7mOnsJHy2K9euYYaMyBjIH+aEoUFPz ZNwQ== 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=HXUIrkkPI7HqmmV3px8qqWOkkz5VaklkEFLPy9wGthg=; fh=xLSOOz5Q0Mrmzd+lwBRTYS7D/8TpUWM8TEHgIjpMzow=; b=FBjrZyC9wkQB/fum2KzxP8UOBPEUoAapw0avNUdcnxPkjkn9cMk7/JHmsLg0c4NlMZ jk84TtYnf8yFslr2euIqQOK8Fpxfc4wNJJzpOzUdSD5TjjD5+HoyR/fH3JOsWRytQ2Y9 JjhifUrxZXdaRfjhsMqQjJuh2018YWzwtRM5UHH6ELFGFPFp6Bsqgdrd2GDv+bWLMbp1 5bcwIHG6aBw9fjiUBfAUrNljfbuNgICSwFRWKqbckE5283TGHcboKti7O9Oq/eiC5Pvn Kx/z5cGF/jY9G420+zgEjfAFeUJPDHNRniNESj8ZhRPLUSE+00aJNqUXi7l4Ppm6UUrO pb7A==; 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-a6e8b8f13b8si66540966b.769.2024.06.07.11.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 11:55:42 -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 70B20884CD; Fri, 7 Jun 2024 20:54:16 +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 0B646884D7; Fri, 7 Jun 2024 20:54:15 +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,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 1115B884F1 for ; Fri, 7 Jun 2024 20:54:12 +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 C66F61480; Fri, 7 Jun 2024 11:54:35 -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 A7AD13F792; Fri, 7 Jun 2024 11:54:08 -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 , Sughosh Ganu Subject: [RFC PATCH 12/31] add a function to check if an address is in RAM memory Date: Sat, 8 Jun 2024 00:22:21 +0530 Message-Id: <20240607185240.1892031-13-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607185240.1892031-1-sughosh.ganu@linaro.org> References: <20240607185240.1892031-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 --- arch/sandbox/cpu/cpu.c | 5 +++++ common/board_r.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 0ed85b354c..d7a0176497 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -413,3 +413,8 @@ int sandbox_load_other_fdt(void **fdtp, int *sizep) return 0; } + +bool __maybe_unused is_addr_in_ram(uintptr_t addr) +{ + return is_in_sandbox_mem((const void *)addr); +} diff --git a/common/board_r.c b/common/board_r.c index a9f0b0cec1..aabc0cdf26 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) { /*