From patchwork Thu Jul 4 07:35:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 809940 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1043646wru; Thu, 4 Jul 2024 00:42:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX65F6Ns3CJKVeRrBhiBA1Lu9ye0vSwnUYojJkFupiShqjDx1/UxdKRYsBvE5nvJqcDCmj1iTlbRK+E7PLUvYaZ X-Google-Smtp-Source: AGHT+IGfux5dDJ7WJdxhaRHcWCe8GjxqSrGAJ9mYbaWXukXlZ5Aow5n8jwwhzLbikzGY5zhfR8jc X-Received: by 2002:a17:907:94d0:b0:a72:a8e5:530c with SMTP id a640c23a62f3a-a77ba7118a3mr61261766b.47.1720078940227; Thu, 04 Jul 2024 00:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720078940; cv=none; d=google.com; s=arc-20160816; b=pBKt606ma/tP2m9N54dY4mQJ9WAFEJLzupHyLytPgM+XGAf2QZfQY+HOLAJ+5MtMP2 mwO60ru/gVwl+K0/nfzNlQcr+YnXIpNcqAXpxQdBmWBXlNJ+IyD5uxdbkARbDZhoSbet B6le6Hx84sb9b1xFFGo85GBdsAdrnB2JI7znutd9LUH1rIqdd6wgiRPlj/4QabIH9cH9 OTuk7cCCUlW755LqRILigWqtOhK7MnxEZapn3f1VJHvsIbe71fUpYjaBbYZY9OACaClJ XonrNiZIHkByWKPkYcZV0Vl3Dxuddd1tfhGuecH1gzDlTgJ868sK0oHp+XiXbQVgFUTt Ml3w== 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=yz6+ylppohd8rCaOz/Dxtzi5nDsjkF+PGnhBg9uMWGE=; fh=ez1zzjhC0XWyqTp7tWutqrA/nFdALDnQKrnQnXYhk5Q=; b=huJILBdV/jFoUZrY51ypEM3b3OZq9yrLQdhQ0eYvHyU72BoEnRhaowjOBbdIBJV9At FS+zhMiHYdzT0SiUctgvLJVsAveGFpIZp/LlvdGi7wuUrfnqFuJSikAHL9MBtRxC2HVT 7KcFEEz5//Vj7bzcFmi9Uz6cQoAH2L2JQESH9bNuiBngBBkJ2MkQPk7iYPiMV660CWfm B2ocWMW5s/gnNamHPzkxtCLFHhspHvunw0dAQQsVDTwXQrb1jzBTLOINob6pBGcolcNh GkEGqgcJbXZ+rWGzcZ4l8BYLbGp84+0ZO5aFNWx+RVTUkz16v45HSRO7MQyeAYHK7kYk O5Xg==; 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 a640c23a62f3a-a72ab04a9d1si714097666b.433.2024.07.04.00.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 00:42:20 -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 2A706888CC; Thu, 4 Jul 2024 09:38:09 +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 EADFC888CC; Thu, 4 Jul 2024 09:38:07 +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 DFDF88895F for ; Thu, 4 Jul 2024 09:38:05 +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 6CC34367; Thu, 4 Jul 2024 00:38:30 -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 3BE873F762; Thu, 4 Jul 2024 00:38:01 -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 33/48] test: bdinfo: dump the global LMB memory map Date: Thu, 4 Jul 2024 13:05:29 +0530 Message-Id: <20240704073544.670249-34-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 The LMB code has been changed to make the memory reservations persistent and global. Make corresponding change the the lmb_test_dump_all() function to print the global LMB available and used memory. Signed-off-by: Sughosh Ganu --- Changes since V1: * Corresponding changes needed to work with alist based lmb lists. test/cmd/bdinfo.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 1cd81a195b..3184aaf629 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -5,6 +5,7 @@ * Copyright 2023 Marek Vasut */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -99,19 +101,20 @@ static int test_video_info(struct unit_test_state *uts) } static int lmb_test_dump_region(struct unit_test_state *uts, - struct lmb_region *rgn, char *name) + struct alist *lmb_rgn_lst, char *name) { + struct lmb_region *rgn = lmb_rgn_lst->data; unsigned long long base, size, end; enum lmb_flags flags; int i; - ut_assert_nextline(" %s.cnt = 0x%lx / max = 0x%lx", name, rgn->cnt, rgn->max); + ut_assert_nextline(" %s.count = 0x%hx", name, lmb_rgn_lst->count); - for (i = 0; i < rgn->cnt; i++) { - base = rgn->region[i].base; - size = rgn->region[i].size; + for (i = 0; i < lmb_rgn_lst->count; i++) { + base = rgn[i].base; + size = rgn[i].size; end = base + size - 1; - flags = rgn->region[i].flags; + flags = rgn[i].flags; if (!IS_ENABLED(CONFIG_SANDBOX) && i == 3) { ut_assert_nextlinen(" %s[%d]\t[", name, i); @@ -124,11 +127,14 @@ static int lmb_test_dump_region(struct unit_test_state *uts, return 0; } -static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb) +static int lmb_test_dump_all(struct unit_test_state *uts) { + extern struct alist lmb_free_mem; + extern struct alist lmb_used_mem; + ut_assert_nextline("lmb_dump_all:"); - ut_assertok(lmb_test_dump_region(uts, &lmb->memory, "memory")); - ut_assertok(lmb_test_dump_region(uts, &lmb->reserved, "reserved")); + ut_assertok(lmb_test_dump_region(uts, &lmb_free_mem, "memory")); + ut_assertok(lmb_test_dump_region(uts, &lmb_used_mem, "reserved")); return 0; } @@ -190,9 +196,7 @@ static int bdinfo_test_all(struct unit_test_state *uts) #endif if (IS_ENABLED(CONFIG_LMB) && gd->fdt_blob) { - struct lmb lmb; - - ut_assertok(lmb_test_dump_all(uts, &lmb)); + ut_assertok(lmb_test_dump_all(uts)); if (IS_ENABLED(CONFIG_OF_REAL)) ut_assert_nextline("devicetree = %s", fdtdec_get_srcname()); }