summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-26 00:37:06 +0300
committerBin Meng <bmeng.cn@gmail.com>2023-08-01 05:08:49 +0300
commitdb971a7587d04b3f1cf2e6d452f9e37f50c5b3ed (patch)
tree79795a577f17829294c18253349f4a56ef9d254e
parentd560f7cae04128061167c1507af08293b666c766 (diff)
downloadu-boot-db971a7587d04b3f1cf2e6d452f9e37f50c5b3ed.tar.xz
x86: Add a little more info to cbsysinfo
Show the number of records in the table and the total table size in bytes. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r--arch/x86/include/asm/cb_sysinfo.h4
-rw-r--r--arch/x86/lib/coreboot/cb_sysinfo.c4
-rw-r--r--cmd/x86/cbsysinfo.c5
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 2c78b22d0d..12fa395ffd 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 42cc3a128d..dfbc80c430 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 2b8d3b0a43..84822a3e32 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");