diff mbox series

[13/13] x86: coreboot: Show unimplemented sysinfo tags

Message ID 20230220194927.476708-14-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Various minor enhancements for coreboot | expand

Commit Message

Simon Glass Feb. 20, 2023, 7:49 p.m. UTC
Sometimes coreboot adds new tags that U-Boot does not know about. These
are silently ignored, but it is useful to at least know what we are
missing.

Add a way to collect this information. For Brya it shows:

   Unimpl. 38 41 37 34 42 40

These are:

   LB_TAG_PLATFORM_BLOB_VERSION
   LB_TAG_ACPI_CNVS
   LB_TAG_FMAP
   LB_TAG_VBOOT_WORKBUF
   LB_TAG_TYPE_C_INFO
   LB_TAG_BOARD_CONFIG

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/x86/include/asm/cb_sysinfo.h  | 6 ++++++
 arch/x86/lib/coreboot/cb_sysinfo.c | 2 ++
 cmd/x86/cbsysinfo.c                | 8 ++++++++
 3 files changed, 16 insertions(+)

Comments

Bin Meng March 20, 2023, 8:19 a.m. UTC | #1
On Tue, Feb 21, 2023 at 3:49 AM Simon Glass <sjg@chromium.org> wrote:
>
> Sometimes coreboot adds new tags that U-Boot does not know about. These
> are silently ignored, but it is useful to at least know what we are
> missing.
>
> Add a way to collect this information. For Brya it shows:
>
>    Unimpl. 38 41 37 34 42 40
>
> These are:
>
>    LB_TAG_PLATFORM_BLOB_VERSION
>    LB_TAG_ACPI_CNVS
>    LB_TAG_FMAP
>    LB_TAG_VBOOT_WORKBUF
>    LB_TAG_TYPE_C_INFO
>    LB_TAG_BOARD_CONFIG
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/x86/include/asm/cb_sysinfo.h  | 6 ++++++
>  arch/x86/lib/coreboot/cb_sysinfo.c | 2 ++
>  cmd/x86/cbsysinfo.c                | 8 ++++++++
>  3 files changed, 16 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/arch/x86/include/asm/cb_sysinfo.h b/arch/x86/include/asm/cb_sysinfo.h
index 6b266149cf6..2c78b22d0d2 100644
--- a/arch/x86/include/asm/cb_sysinfo.h
+++ b/arch/x86/include/asm/cb_sysinfo.h
@@ -16,6 +16,8 @@ 
 #define SYSINFO_MAX_GPIOS	8
 /* Up to 10 MAC addresses */
 #define SYSINFO_MAX_MACS 10
+/* Track the first 32 unimplemented tags */
+#define SYSINFO_MAX_UNIMPL	32
 
 /**
  * struct sysinfo_t - Information passed to U-Boot from coreboot
@@ -134,6 +136,8 @@ 
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *	not used
  * @rsdp: Pointer to ACPI RSDP table
+ * @unimpl_count: Number of entries in unimpl_map[]
+ * @unimpl: List of unimplemented IDs (bottom 8 bits only)
  */
 struct sysinfo_t {
 	unsigned int cpu_khz;
@@ -213,6 +217,8 @@  struct sysinfo_t {
 	u32 mtc_size;
 	void	*chromeos_vpd;
 	void *rsdp;
+	u32 unimpl_count;
+	u8 unimpl[SYSINFO_MAX_UNIMPL];
 };
 
 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 a11a2587f66..42cc3a128d9 100644
--- a/arch/x86/lib/coreboot/cb_sysinfo.c
+++ b/arch/x86/lib/coreboot/cb_sysinfo.c
@@ -439,6 +439,8 @@  static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 			cb_parse_acpi_rsdp(rec, info);
 			break;
 		default:
+			if (info->unimpl_count < SYSINFO_MAX_UNIMPL)
+				info->unimpl[info->unimpl_count++] = rec->tag;
 			cb_parse_unhandled(rec->tag, ptr);
 			break;
 		}
diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c
index 07570b00c9a..2b8d3b0a435 100644
--- a/cmd/x86/cbsysinfo.c
+++ b/cmd/x86/cbsysinfo.c
@@ -364,6 +364,14 @@  static void show_table(struct sysinfo_t *info, bool verbose)
 
 	print_ptr("Chrome OS VPD", info->chromeos_vpd);
 	print_ptr("RSDP", info->rsdp);
+	printf("%-12s: ", "Unimpl.");
+	if (info->unimpl_count) {
+		for (i = 0; i < info->unimpl_count; i++)
+			printf("%02x ", info->unimpl[i]);
+		printf("\n");
+	} else {
+		printf("(none)\n");
+	}
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,