From mboxrd@z Thu Jan 1 00:00:00 1970 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 C5CECC6FA69 for ; Mon, 29 Aug 2022 17:02:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 90CB28497C; Mon, 29 Aug 2022 19:02:23 +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="HF1scuX4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BE93B8495B; Mon, 29 Aug 2022 19:02:17 +0200 (CEST) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 09CF984314 for ; Mon, 29 Aug 2022 19:02:15 +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-x532.google.com with SMTP id z8so2153843edb.6 for ; Mon, 29 Aug 2022 10:02:15 -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=EeaxXmCkR/oMN32KkHBhdC7ldRe67+rTWDeroAPMrUY=; b=HF1scuX42vMYZ/7/tAeewCBU4dUYw8qWq1ikdbK31YBa1hwJ4XdcnjAopwN3cmcryB pVFBD7/xzDJWJyl0m8gogs1T0xodGHB5gKNo4Il6cX9QnTTD2hsRu1uoi/lu7XirCLSh u1jQtN9Co+yPT9M+SJv9Rdzw6+PgG6P1T/8buoQOyGCBd8R0oqsYTj3PJtjslgY75oXa XdghmqfdiHSuERSBs5+R910zpSBvcOeVUdi+gt2vSGU32ZyTIc6l7JC0q+1y81cIFnWJ nViJON+rqd+pp//ZuEoD4jq3sIot4EPUF5yebdukgojcbWr4p40QMk9S9ADpxNOq9gJv KLEA== 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=EeaxXmCkR/oMN32KkHBhdC7ldRe67+rTWDeroAPMrUY=; b=vB1eMeh01gobsKANeBqNE+jiT25nKD8TtoZpz5wYfgWdFn0/shXjMGUzRpEIiFetZB 0IEZQNvLJRe73pKCSxKyBBLQqPxdILFlC6P92Ai+tc5TrnI3ZGTW+xIKz4fLtKPUoohA 6iSp2HIKzjMvpZis6C+C/pxL0/74laAxO5GfTA7hxaQvI0qM61hpkLq7UbsyNuSZdkGO BE/HYTvyVusVbO2AGgAcWauMTbtjyxfuS9eQFYK3nicTwBt9qIIKdm16r5/NmWPHiRNk kK9osIxgmKFJxEOF1yYBjFZDeQlhOsIvY5mDEsEGWslaauUab534Frv/dj7rQm+wzeoM ceuQ== X-Gm-Message-State: ACgBeo2nnj7aqN+0r1oNf4jZmFm2qus/s3qbu2EQny6Mx1NzVvVqBW6q Hu7hQPWKN/mqCyWuZ7hsJoR5R2+0mA8a8w== X-Google-Smtp-Source: AA6agR6gf9Z4vTqzS7QetFzvJZ/yNH5anp2cvuiS0HzaXcrEAQcuRS0Ik7est2dusLPTkZlqK3UAHg== X-Received: by 2002:a05:6402:100c:b0:447:9153:8fdf with SMTP id c12-20020a056402100c00b0044791538fdfmr17559697edu.187.1661792534647; Mon, 29 Aug 2022 10:02:14 -0700 (PDT) Received: from wsdell.corp.ad.wrs.com ([2a02:2f07:610e:db00:a66a:9c69:59fb:17ec]) by smtp.gmail.com with ESMTPSA id g24-20020a50d0d8000000b0044786c2c5c1sm6012852edf.3.2022.08.29.10.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 10:02:14 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Simon Glass , Andy Shevchenko , Dzmitry Sankouski , Heinrich Schuchardt , Jason Liu Subject: [PATCH v2 3/4] cmd: bdinfo: introduce bdinfo_print_size() helper Date: Mon, 29 Aug 2022 20:02:04 +0300 Message-Id: <20220829170205.1274484-3-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829170205.1274484-1-ovpanait@gmail.com> References: <20220829170205.1274484-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; Reviewed-by: Simon Glass Signed-off-by: Ovidiu Panait --- Changes in v2: Added "Reviewed-by" tag from Simon. 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