Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9001AC04AA5 for ; Thu, 25 Aug 2022 06:42:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 18BDD84865; Thu, 25 Aug 2022 08:41:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JpeImfmS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6717E8484F; Thu, 25 Aug 2022 08:41:48 +0200 (CEST) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1E6E384522 for ; Thu, 25 Aug 2022 08:41:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x52a.google.com with SMTP id e21so19962222edc.7 for ; Wed, 24 Aug 2022 23:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=4V4jRJyYolEnrIly4BodAYzfR2odPk5m95NvCpE5kNg=; b=JpeImfmSdbkmi61dY1Ci94nFAslJaiG2tEj06fm67/7zRax3J0Ft8cW0jhN8opZuUv bbVFSvUihFaQtkwRw6JTu87J511nAquBZHSq776D0BJpI8mx+LKJWXIaAkC9ayqPzHEc 5Ebx9QmPXFplvAtHZormsWzNoVo58qYxoCu0zYZ+1aKyQXzqIE93yYe9WGE8jZwbl9Rg DMMQTKpIbfH5eNaiWbsqWol5sEwMvRT/yblqbNEJW//asp1OsHR7B0WxqGknlW/HaKCY VsyM3UiCIxsKt8Gc871zv8POlT59V0o9fv5ZIEJ7DJlfBUgl8Rr1YI+F5COGTX8UmNJx Mjyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4V4jRJyYolEnrIly4BodAYzfR2odPk5m95NvCpE5kNg=; b=vYXUchTWiks6Qw2YZBlHE1gE8HfQm79w/tM3emOapoEq5iCzs6i/eWXccQgEaXfx+y h3/Jw1UXIee+89iiyWXODu9eS0+OY422kcU5gEM+AxvIrleZ2RYT32gIdpjUX10/N3RZ olFJgUpHHZ8l3Wi0ogWtv0UgYTP29tIo6bCIRnnFHHzACZbpPfQcopUfT/IulJw+gtVw hKROMGHhS66P+uURK82gsyR5TuO+hnC9m6mqA1h+tJpIyiq00Y0AGHR998u4f/Oj2zE5 qO9l/GewuBAKS8p5fZ8NAnO4toDHkLKAbv0KzqyJ4cpNrVas+egOByA0GD/ClFEiIs+n znZw== X-Gm-Message-State: ACgBeo0Oz1gKD2DGaFEXCr4NUrrGtS3QIzn6DSE5wcv7v3X6xw/BN4P1 AL416v/uCGDf++3B3KqMundw0lculjjbyA== X-Google-Smtp-Source: AA6agR4FfgF4gWA8pDNb0Lu9ifgddoCa07UK6OluyEhWmdgw9tr0KHCiTMnDSVnIvTZjMpaEMJpAOw== X-Received: by 2002:a05:6402:11cb:b0:43c:c7a3:ff86 with SMTP id j11-20020a05640211cb00b0043cc7a3ff86mr1956358edw.383.1661409705667; Wed, 24 Aug 2022 23:41:45 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f07:610e:db00:4487:9f7e:854:3f2c]) by smtp.gmail.com with ESMTPSA id x2-20020aa7d382000000b00446473adeacsm4201616edq.82.2022.08.24.23.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 23:41:45 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Andy Shevchenko , Dzmitry Sankouski , Heinrich Schuchardt , Jason Liu , Simon Glass Subject: [PATCH 3/4] cmd: bdinfo: introduce bdinfo_print_size() helper Date: Thu, 25 Aug 2022 09:41:30 +0300 Message-Id: <20220825064131.673958-3-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220825064131.673958-1-ovpanait@gmail.com> References: <20220825064131.673958-1-ovpanait@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Add bdinfo_print_size() helper to display size variables (such as cache sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", "xxx GiB", etc as needed; Signed-off-by: Ovidiu Panait --- cmd/bdinfo.c | 7 +++++++ include/init.h | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 37cd8a57eb..9e23c4dd8f 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -16,9 +16,16 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; +void bdinfo_print_size(const char *name, uint64_t size) +{ + printf("%-12s= ", name); + print_size(size, "\n"); +} + void bdinfo_print_num_l(const char *name, ulong value) { printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value); diff --git a/include/init.h b/include/init.h index 7b8f62c121..02bb4ce13e 100644 --- a/include/init.h +++ b/include/init.h @@ -343,6 +343,19 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value); /* Print a clock speed in MHz */ void bdinfo_print_mhz(const char *name, unsigned long hz); +/** + * bdinfo_print_size - print size variables in bdinfo format + * @name: string to print before the size + * @size: size to print + * + * Helper function for displaying size variables as properly formatted bdinfo + * entries. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", + * "xxx GiB", etc. as needed; + * + * For use in arch_print_bdinfo(). + */ +void bdinfo_print_size(const char *name, uint64_t size); + /* Show arch-specific information for the 'bd' command */ void arch_print_bdinfo(void); -- 2.25.1