From patchwork Wed Aug 14 11:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 819132 Delivered-To: patch@linaro.org Received: by 2002:adf:cd01:0:b0:367:895a:4699 with SMTP id w1csp646568wrm; Wed, 14 Aug 2024 04:05:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWlgmMAsASgC4Pu70KojW7MRDpHjHBtGkHVeEsvPdqcpdOlOjekfl8PuvXplK7ry3Asm/LydKMC2SyLHfO7eb6f X-Google-Smtp-Source: AGHT+IGpO4/yRNBTQ+tO8Jwm3SG0kF+TlbzAhqy6aTCj0xEvPEqgf/VG94jAD9mO9jkGbBnftwOK X-Received: by 2002:a05:6402:3488:b0:5af:51d6:d8e with SMTP id 4fb4d7f45d1cf-5bea1c7b805mr1547788a12.20.1723633548747; Wed, 14 Aug 2024 04:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723633548; cv=none; d=google.com; s=arc-20160816; b=PEreCjgSihGBFZbAMaN7O08fgJEsU67M+fjVqad6bJZxYPwedGE2WH5pCeA4Mv/7Nr y+sMyNuttjCoXUtCPgGUxqJPCl4gC/NdSrbz1oXaKTd1c/nDIbzsnN315tIeGbnTK6wN AFkK9jTjJFGN0BXhPQIj2g0CdEzSd9MASZCkxjq+XbZqYSF3XMb4tGANFx0fl5dx6nvp QBCHKfNuGz3lWLoLfWD4nHhyRR8Rs2AOW2+a5/cr+Cl9oZ8yn8AWreiWy5yIIutljBpN B/07bOEx9C9pt03Z+DQo16+Ycl6uKMGxN67IechENiotXSuC8JGS5XWnPb1qeQd2O7JT UC2w== 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=HAz3yy2aN6FsgYTszVTDnMjyjnf0V0JTPtsy6gNwAJM=; fh=w4WyT9xL7ErtT1TeetrD/m0Y0mAgjnERgxacGUpGjSg=; b=ezN6JqcneuxgF0+H2wNKaLikW2+rUtduSoYsb+Mp+I53wkMBu/B0L6cOeoTK2pCOji uMNyEldVJydXcFVooFdKxdVs1hBzhsFbVQUzZhw1+5C+xU6sL3byVBkvLDIKkyf5DjDS XAIvX65vN0DgiXpL3kd0oD3okAa2TFT8ikT6FvK1VeePKNRYQr0a+/QipMATkCfWYX/k HQpXed5f+Wn1xQWI0Vi81j68fJkmkN3oJSvJQYuRMuKHZIh6XcBWR79Rs1YFLKqYNo/0 tO2EfdCJo/d/MVD7sT86UwsYaJrTbFGvSSiNSchU7AU174yOW3YA6zQbAIuIXJBAdd5s cowg==; 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 4fb4d7f45d1cf-5bd1a6123edsi4835100a12.565.2024.08.14.04.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 04:05:48 -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 393EF88A79; Wed, 14 Aug 2024 13:03:03 +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 DFFA088815; Wed, 14 Aug 2024 13:03:01 +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 3A88888A82 for ; Wed, 14 Aug 2024 13:02:59 +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 86894DA7; Wed, 14 Aug 2024 04:03:24 -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 131BC3F58B; Wed, 14 Aug 2024 04:02:53 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Marek Vasut , Tom Rini , Mark Kettenis , Michal Simek , Patrick DELAUNAY , Patrice CHOTARD , Huan Wang , Angelo Dureghello , Daniel Schwierzeck , Thomas Chou , Rick Chen , Max Filippov , Sughosh Ganu Subject: [PATCH v2 29/32] test: bdinfo: dump the global LMB memory map Date: Wed, 14 Aug 2024 16:30:06 +0530 Message-Id: <20240814110009.45310-30-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814110009.45310-1-sughosh.ganu@linaro.org> References: <20240814110009.45310-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: * Get the alloced lists through the lmb_get() function. test/cmd/bdinfo.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 1cd81a195b..7dd3f7ca5b 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,13 @@ 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) { + struct lmb *lmb = lmb_get(); + 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 +195,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()); }