Skip to contentSkip to conversation

x86: Add a little more info to cbsysinfo

PATCH In review Simon Glass 2 participants 3 messages Jul 25, 2023 – Aug 1, 2023 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Add a little more info to cbsysinfo

Show the number of records in the table and the total table size in bytes.

---

 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(-)
arch/x86/include/asm/cb_sysinfo.h +4 -0
index 2c78b22d0d2..12fa395ffd2 100644
@@ -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;
arch/x86/lib/coreboot/cb_sysinfo.c +4 -0
index 42cc3a128d9..dfbc80c430e 100644
@@ -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;
cmd/x86/cbsysinfo.c +3 -2
index 2b8d3b0a435..84822a3e321 100644
@@ -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");
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Simon Glass

Show the number of records in the table and the total table size in bytes.

Quoted 8 lines

---

 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(-)
#2 lore raw
Quoted 9 lines · Bin Meng
Quoted 7 lines · Simon Glass

Show the number of records in the table and the total table size in bytes.

---

Quoted 7 lines
Quoted 5 lines
 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(-)

applied to u-boot-x86, thanks!