From patchwork Tue Jul 25 21:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1812884 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=UOBMZQTl; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R9VmT1Tq2z1yZv for ; Wed, 26 Jul 2023 07:39:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E516B86868; Tue, 25 Jul 2023 23:38:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UOBMZQTl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EC7C86679; Tue, 25 Jul 2023 23:37:24 +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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 C36D886809 for ; Tue, 25 Jul 2023 23:37:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-34637e55d8dso26776085ab.2 for ; Tue, 25 Jul 2023 14:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690321033; x=1690925833; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fPnK03VH31xY2K+TxrRCTJxz9tqOM2c/KDi0/4C+P2Q=; b=UOBMZQTl3cpoTnOoVEzBUQgSXZ97U6Y2d1Xchd05HdHSWmASRZDhEg9hh3KlC0ikMa QzURQU80dY70BsJmLRWDdmGyoUm09Uq/bE/rTYdH+XMk+PrmUxyzW6dSTyl7mFbFLaC7 ztWBq3DaQ+XKk75/ET6SWh+Qq2FWBSwZjowVM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690321033; x=1690925833; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fPnK03VH31xY2K+TxrRCTJxz9tqOM2c/KDi0/4C+P2Q=; b=ZUCdNT90LWVU9el3nhlL2+9wJjv+O41kwh55RT3Wkt9AWxjL+Hl6FNwxq/wSRNXVfU N1jV5AyrdM2rkgA3Nf8ymyxJo3gVvfNO/xYoWPOJZ70TAzueS2GkJ8ECzMJ4YqKNXrKp n1ZEEexYh1+NEUKfF3b6uMkc4FJLffE6MGkaQHG4OdJXeTVWt71530e9OLWhyKR7jU5n 8SGq+ls5oKomtPmIkj4hpHZ0YT8Y3+TxFDPC8P2sUnPfkkh+r/+C0eJUE20clL+kpn7S m2lWChk7vK3McZPvzyFWiBNa18PqEPbpM0wSnAd2sLKEuVBDCC/YE6U2CSxqxNO3/n4P 2r1A== X-Gm-Message-State: ABy/qLbcGd2ijl1cn9LQC8XE9/0RkZZTUasCiUfrs2/Gj/WT6ejgbRRI B9FFHzhdAU/EzvQn4OeWASY0iMDms1LwyE/afCM= X-Google-Smtp-Source: APBJJlFd7baYZ+f4dXV/i9rchZwJZF4Eb6lf1dnRqgz4rBz9tl4emUAZb2dz7OSJahkbrpH8VItNYg== X-Received: by 2002:a05:6e02:156b:b0:347:7399:e9c1 with SMTP id k11-20020a056e02156b00b003477399e9c1mr274860ilu.14.1690321033339; Tue, 25 Jul 2023 14:37:13 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ce78:3dad:1309:8d43]) by smtp.gmail.com with ESMTPSA id a10-20020a92d58a000000b00348d41ffd13sm1586259iln.85.2023.07.25.14.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 14:37:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass Subject: [PATCH] x86: Add a little more info to cbsysinfo Date: Tue, 25 Jul 2023 15:37:06 -0600 Message-ID: <20230725213708.255726-1-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog 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 Show the number of records in the table and the total table size in bytes. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/include/asm/cb_sysinfo.h | 4 ++++ arch/x86/lib/coreboot/cb_sysinfo.c | 4 ++++ cmd/x86/cbsysinfo.c | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cb_sysinfo.h b/arch/x86/include/asm/cb_sysinfo.h index 2c78b22d0d2..12fa395ffd2 100644 --- a/arch/x86/include/asm/cb_sysinfo.h +++ b/arch/x86/include/asm/cb_sysinfo.h @@ -138,6 +138,8 @@ * @rsdp: Pointer to ACPI RSDP table * @unimpl_count: Number of entries in unimpl_map[] * @unimpl: List of unimplemented IDs (bottom 8 bits only) + * @table_size: Number of bytes taken up by the sysinfo table + * @rec_count: Number of records in the sysinfo table */ struct sysinfo_t { unsigned int cpu_khz; @@ -219,6 +221,8 @@ struct sysinfo_t { void *rsdp; u32 unimpl_count; u8 unimpl[SYSINFO_MAX_UNIMPL]; + uint table_size; + uint rec_count; }; extern struct sysinfo_t lib_sysinfo; diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c index 42cc3a128d9..dfbc80c430e 100644 --- a/arch/x86/lib/coreboot/cb_sysinfo.c +++ b/arch/x86/lib/coreboot/cb_sysinfo.c @@ -447,6 +447,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) ptr += rec->size; } + info->table_size += (void *)ptr - (void *)header; + info->rec_count += header->table_entries; return 1; } @@ -462,6 +464,8 @@ int get_coreboot_info(struct sysinfo_t *info) addr = locate_coreboot_table(); if (addr < 0) return addr; + info->table_size = 0; + info->rec_count = 0; ret = cb_parse_header((void *)addr, 0x1000, info); if (!ret) return -ENOENT; diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c index 2b8d3b0a435..84822a3e321 100644 --- a/cmd/x86/cbsysinfo.c +++ b/cmd/x86/cbsysinfo.c @@ -190,8 +190,9 @@ static void show_table(struct sysinfo_t *info, bool verbose) struct cb_serial *ser = info->serial; int i; - printf("Coreboot table at %lx, decoded to %p", - gd->arch.coreboot_table, info); + printf("Coreboot table at %lx, size %x, records %x (dec %d), decoded to %p", + gd->arch.coreboot_table, info->table_size, info->rec_count, + info->rec_count, info); if (info->header) printf(", forwarded to %p\n", info->header); printf("\n");