Skip to contentSkip to conversation

sysinfo: Expand sysinfo with some more banner information

PATCH In review Simon Glass 4 participants 17 messages Nov 13, 2023 – Feb 7, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover sysinfo: Expand sysinfo with some more banner information

The show_board_info() function was adjusted to weak so that it could be entirely replaced with a board-specific implementation.

The intended way for boards to provide their own information is via a sysinfo driver. But currently there is no way to show anything other than the model name.

This series adds support for showing a few more items, in a way that is easy for boards to extend.

Since there is already a weak checkboard() function, we don't need to have two levels of weak function here. So this series drops the weak attribute from show_board_info()

Existing boards will see a slight change in output, in that the model name will appear first, before any custom output. If that is a problem, then the solution is to implement a sysinfo driver for the board.

Simon Glass (9):
board: Move show_board_info() comment to header file
meson: Use checkboard() instead of show_board_info()
turris: Use checkboard() instead of show_board_info()
solidrun: Use checkboard() instead of show_board_info()
toradex: Use checkboard() instead of show_board_info()
udoo: Use checkboard() instead of show_board_info() Revert "generic-board: make show_board_info a weak function"
sysinfo: Allow displaying more info on startup
x86: coreboot: Add a sysinfo driver

 arch/arm/mach-meson/board-info.c              |  2 +-
 arch/x86/cpu/coreboot/Kconfig                 |  2 +
 arch/x86/dts/coreboot.dts                     |  4 +
 board/CZ.NIC/turris_mox/turris_mox.c          |  2 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c      |  2 +-
 board/coreboot/coreboot/Makefile              |  1 +
 board/coreboot/coreboot/coreboot.c            | 44 ---------
 board/coreboot/coreboot/sysinfo.c             | 89 +++++++++++++++++++
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |  7 +-
 board/toradex/apalis-imx8/apalis-imx8.c       |  2 +-
 board/toradex/apalis-tk1/apalis-tk1.c         |  2 +-
 board/toradex/apalis_imx6/apalis_imx6.c       |  3 +-
 board/toradex/apalis_t30/apalis_t30.c         |  2 +-
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  2 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  2 +-
 board/toradex/colibri_imx6/colibri_imx6.c     |  3 +-
 board/toradex/colibri_imx7/colibri_imx7.c     |  2 +-
 board/toradex/colibri_t20/colibri_t20.c       |  2 +-
 board/toradex/colibri_t30/colibri_t30.c       |  2 +-
 board/toradex/colibri_vf/colibri_vf.c         |  2 +-
 board/toradex/common/tdx-common.c             |  2 +-
 board/toradex/common/tdx-common.h             |  1 +
 board/udoo/neo/neo.c                          |  2 +-
 common/board_info.c                           | 80 +++++++++++------
 drivers/sysinfo/Kconfig                       |  7 ++
 include/init.h                                | 11 +++
 include/sysinfo.h                             |  3 +
 27 files changed, 189 insertions(+), 94 deletions(-)
 create mode 100644 board/coreboot/coreboot/sysinfo.c
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#1 lore raw

PATCH 1/9 board: Move show_board_info() comment to header file

Move this comment to its prototype and tidy it up a bit.

---

 common/board_info.c |  6 ------
 include/init.h      | 11 +++++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)
common/board_info.c +0 -6
index e0f2d9392204..3185793da4a7 100644
@@ -15,12 +15,6 @@ int __weak checkboard(void)
 	return 0;
 }
 
-/*
- * Check sysinfo for board information. Failing that if the root node of the DTB
- * has a "model" property, show it.
- *
- * Then call checkboard().
- */
 int __weak show_board_info(void)
 {
 	if (IS_ENABLED(CONFIG_OF_CONTROL)) {
include/init.h +11 -0
index d57a24fd00dd..9a1951d10a01 100644
@@ -292,6 +292,17 @@ int misc_init_r(void);
 
 /* common/board_info.c */
 int checkboard(void);
+
+/**
+ * show_board_info() - Show board information
+ *
+ * Check sysinfo for board information. Failing that if the root node of the DTB
+ * has a "model" property, show it.
+ *
+ * Then call checkboard().
+ *
+ * Return 0 if OK, -ve on error
+ */
 int show_board_info(void);
 
 /**
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#3 lore raw

PATCH 2/9 meson: Use checkboard() instead of show_board_info()

In reply to Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

---

 arch/arm/mach-meson/board-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-meson/board-info.c +1 -1
index 2421acd817e4..95a29da07229 100644
@@ -168,7 +168,7 @@ static unsigned int get_socinfo(void)
 	return socinfo;
 }
 
-int show_board_info(void)
+int checkboard(void)
 {
 	unsigned int socinfo;
 
Signature · 1 line
2.42.0.869.gea05f2083d-goog
maintainer Reviewed-by on v1 2/9
#4 lore raw

Re: [PATCH 2/9] meson: Use checkboard() instead of show_board_info()

Quoted 15 lines · Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

---

  arch/arm/mach-meson/board-info.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-meson/board-info.c +0 -0
index 2421acd817e4..95a29da07229 100644

arch/arm/mach-meson/board-info.c static unsigned int get_socinfo(void) · line 174

Quoted 8 lines
arch/arm/mach-meson/board-info.c +1 -1
@@ -168,7 +168,7 @@ static unsigned int get_socinfo(void)
  	return socinfo;
  }
 
-int show_board_info(void)
+int checkboard(void)
  {
  	unsigned int socinfo;
 
#5 lore raw

PATCH 3/9 turris: Use checkboard() instead of show_board_info()

In reply to Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

---

 board/CZ.NIC/turris_mox/turris_mox.c     | 2 +-
 board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
board/CZ.NIC/turris_mox/turris_mox.c +1 -1
index 63b869921943..3489bdd74bda 100644
@@ -562,7 +562,7 @@ static void handle_reset_button(void)
 	}
 }
 
-int show_board_info(void)
+int checkboard(void)
 {
 	int i, ret, board_version, ram_size, is_sd;
 	const char *pub_key, *model;
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -1
index 19c5043fcbaa..adeb69a205be 100644
@@ -962,7 +962,7 @@ int board_late_init(void)
 	return 0;
 }
 
-int show_board_info(void)
+int checkboard(void)
 {
 	char serial[17];
 	int err;
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#6 lore raw

PATCH 4/9 solidrun: Use checkboard() instead of show_board_info()

In reply to Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

---

 board/solidrun/mx6cuboxi/mx6cuboxi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +1 -6
index e119330bc0c1..8edabf4404c2 100644
@@ -381,6 +381,7 @@ static bool has_emmc(void)
 	return (mmc_get_op_cond(mmc, true) < 0) ? 0 : 1;
 }
 
+/* Override the default implementation, DT model is not accurate */
 int checkboard(void)
 {
 	request_detect_gpios();
@@ -496,12 +497,6 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
 }
 #endif
 
-/* Override the default implementation, DT model is not accurate */
-int show_board_info(void)
-{
-	return checkboard();
-}
-
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#7 lore raw

PATCH 5/9 toradex: Use checkboard() instead of show_board_info()

In reply to Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

Make all the checkboard() functions call the new tdx_checkboard() so that the same information is displayed.

---

 board/toradex/apalis-imx8/apalis-imx8.c         | 2 +-
 board/toradex/apalis-tk1/apalis-tk1.c           | 2 +-
 board/toradex/apalis_imx6/apalis_imx6.c         | 3 ++-
 board/toradex/apalis_t30/apalis_t30.c           | 2 +-
 board/toradex/colibri-imx6ull/colibri-imx6ull.c | 2 +-
 board/toradex/colibri-imx8x/colibri-imx8x.c     | 2 +-
 board/toradex/colibri_imx6/colibri_imx6.c       | 3 ++-
 board/toradex/colibri_imx7/colibri_imx7.c       | 2 +-
 board/toradex/colibri_t20/colibri_t20.c         | 2 +-
 board/toradex/colibri_t30/colibri_t30.c         | 2 +-
 board/toradex/colibri_vf/colibri_vf.c           | 2 +-
 board/toradex/common/tdx-common.c               | 2 +-
 board/toradex/common/tdx-common.h               | 1 +
 13 files changed, 15 insertions(+), 12 deletions(-)
board/toradex/apalis-imx8/apalis-imx8.c +1 -1
index e2bbaba8b8c1..b351ce64abfc 100644
@@ -215,7 +215,7 @@ int checkboard(void)
 	build_info();
 	print_bootinfo();
 
-	return 0;
+	return tdx_checkboard();
 }
 
 static enum pcb_rev_t get_pcb_revision(void)
board/toradex/apalis-tk1/apalis-tk1.c +1 -1
index 851343159186..79a1c92da0a0 100644
@@ -95,7 +95,7 @@ int checkboard(void)
 {
 	puts("Model: Toradex Apalis TK1 2GB\n");
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/apalis_imx6/apalis_imx6.c +2 -1
index fa6b7226fedf..dc0e09991dde 100644
@@ -730,7 +730,8 @@ int checkboard(void)
 	       is_cpu_type(MXC_CPU_MX6D) ? "Dual" : "Quad",
 	       (gd->ram_size == 0x80000000) ? "2GB" :
 	       (gd->ram_size == 0x40000000) ? "1GB" : "512MB", it);
-	return 0;
+
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/apalis_t30/apalis_t30.c +1 -1
index ef71270d9f2d..b9a2af33f19f 100644
@@ -50,7 +50,7 @@ int checkboard(void)
 	printf("Model: Toradex Apalis T30 %dGB\n",
 	       (gd->ram_size == 0x40000000) ? 1 : 2);
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri-imx6ull/colibri-imx6ull.c +1 -1
index 48fdb1e09712..6c8eeff38fa5 100644
@@ -206,7 +206,7 @@ int checkboard(void)
 {
 	printf("Model: Toradex Colibri iMX6ULL\n");
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
index 6c0b09787c8b..d8cc72f323c5 100644
@@ -121,7 +121,7 @@ int checkboard(void)
 	build_info();
 	print_bootinfo();
 
-	return 0;
+	return tdx_checkboard();
 }
 
 static void select_dt_from_module_version(void)
board/toradex/colibri_imx6/colibri_imx6.c +2 -1
index e6c9b10570d1..7635c5811d26 100644
@@ -649,7 +649,8 @@ int checkboard(void)
 	printf("Model: Toradex Colibri iMX6 %s %sMB%s\n",
 	       is_cpu_type(MXC_CPU_MX6DL) ? "DualLite" : "Solo",
 	       (gd->ram_size == 0x20000000) ? "512" : "256", it);
-	return 0;
+
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri_imx7/colibri_imx7.c +1 -1
index f0356af0082b..c3478b15111b 100644
@@ -279,7 +279,7 @@ int checkboard(void)
 	printf("Model: Toradex Colibri iMX7%c\n",
 	       is_cpu_type(MXC_CPU_MX7D) ? 'D' : 'S');
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri_t20/colibri_t20.c +1 -1
index 1df9697b97ce..5861cf7dc93e 100644
@@ -77,7 +77,7 @@ int checkboard(void)
 	       (get_nand_dev_by_index(0)->erasesize >> 10 == 512) ?
 	       ((gd->ram_size == 0x10000000) ? "1.1B" : "1.1C") : "1.2A");
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri_t30/colibri_t30.c +1 -1
index b6b004669c26..8cef098c8e59 100644
@@ -32,7 +32,7 @@ int checkboard(void)
 {
 	puts("Model: Toradex Colibri T30 1GB\n");
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/colibri_vf/colibri_vf.c +1 -1
index dcef2db360a3..af9f2d379cf4 100644
@@ -373,7 +373,7 @@ int checkboard(void)
 	else
 		puts("Model: Toradex Colibri VF50\n");
 
-	return 0;
+	return tdx_checkboard();
 }
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
board/toradex/common/tdx-common.c +1 -1
index d1449143977b..ed8f0a6a4756 100644
@@ -96,7 +96,7 @@ static const char *get_board_assembly(u16 ver_assembly)
 	return ver_name;
 }
 
-int show_board_info(void)
+int tdx_checkboard(void)
 {
 	unsigned char ethaddr[6];
 
board/toradex/common/tdx-common.h +1 -0
index d446e9f1d5ca..44234dc49cd7 100644
@@ -11,5 +11,6 @@
 
 int ft_common_board_setup(void *blob, struct bd_info *bd);
 u32 get_board_revision(void);
+int tdx_checkboard(void);
 
 #endif /* _TDX_COMMON_H */
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#8 lore raw

REGRESSION: [PATCH 5/9] toradex: Use checkboard() instead of show_board_info()

Hi Simon

Sorry, I missed this one, also due to a longer Xmas/New Year and later skiing vacation.

Quoted 1 line · Simon Glass

Boards can use a sysinfo driver if a particular model name is needed.

Okay, but so far we did print more than just a model name:

On Apalis/Colibri:

Model: Toradex 0028 Apalis iMX6Q 2GB IT V1.1D
Serial#: 10867499

On Verdin:

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.1A Serial#: 14772913
Carrier: Toradex Dahlia V1.1A, Serial# 10870316

Optionally there would even be display adapters with potentially more model (serial) information.

Now with your change we get the following:

On Apalis/Colibri:

Model: Toradex Apalis iMX6Q/D Module on Apalis Evaluation Board
Model: Toradex Apalis iMX6 Quad 2GB IT
Model: Toradex 0028 Apalis iMX6Q 2GB IT V1.1D Serial#: 11211073

The first line gets printed from the information in the device tree, the second Line from the fall-back in our board file (which so far was only used for the case when we failed reading the ConfigBlock) and the third and fourth lines are the previous information. Ugly, but so far so good.

On Verdin:

Model: Toradex Verdin iMX8M Plus WB on Verdin Development Board

Here only the device tree information gets printed and the ConfigBlock is not even read at all which subsequently fails detecting the variant (e.g. Wi-Fi vs. non-Wi-Fi) and later Ethernet fails due to an invalid MAC address. This does not look good...

Anyway, I don't propose to just revert your work but instead looked into converting our previous show_board_info (now tdx_checkboard) to a proper sysinfo driver. The basics actually worked quite smoothly but we would need more than just SYSINFO_ID_BOARD_MODEL, just like you do with CONFIG_SYSINFO_EXTRA. Of course, I could just do a CONFIG_SYSINFO_TORADEX, with e.g. SYSINFO_ID_BOARD_SERIAL and optionally SYSINFO_ID_BOARD_CARRIER or something but maybe a more generic way of extending sysinfo would make more sense.

What do you think?

Quoted 2 lines

Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

Unfortunately, as mentioned above, this does not quite lead to any desired behaviour.

Quoted 2 lines

Make all the checkboard() functions call the new tdx_checkboard() so that the same information is displayed.

Not quite.

Quoted 16 lines

---

 board/toradex/apalis-imx8/apalis-imx8.c         | 2 +- board/toradex/apalis-tk1/apalis-tk1.c           | 2 +- board/toradex/apalis_imx6/apalis_imx6.c         | 3 ++- board/toradex/apalis_t30/apalis_t30.c           | 2 +- board/toradex/colibri-imx6ull/colibri-imx6ull.c | 2 +- board/toradex/colibri-imx8x/colibri-imx8x.c     | 2 +- board/toradex/colibri_imx6/colibri_imx6.c       | 3 ++- board/toradex/colibri_imx7/colibri_imx7.c       | 2 +- board/toradex/colibri_t20/colibri_t20.c         | 2 +- board/toradex/colibri_t30/colibri_t30.c         | 2 +- board/toradex/colibri_vf/colibri_vf.c           | 2 +- board/toradex/common/tdx-common.c               | 2 +- board/toradex/common/tdx-common.h               | 1 +

Quoted 1 line
 13 files changed, 15 insertions(+), 12 deletions(-)

[snip]

Cheers

Marcel

#9 lore raw

Re: REGRESSION: [PATCH 5/9] toradex: Use checkboard() instead of show_board_info()

Gentle ping on this. Any opinion on that matter much appreciated. Thanks!

Quoted 89 lines · Marcel Ziswiler

Hi Simon

Sorry, I missed this one, also due to a longer Xmas/New Year and later skiing vacation.

Quoted 1 line · Simon Glass

Boards can use a sysinfo driver if a particular model name is needed.

Okay, but so far we did print more than just a model name:

On Apalis/Colibri:

Model: Toradex 0028 Apalis iMX6Q 2GB IT V1.1D
Serial#: 10867499

On Verdin:

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.1A Serial#: 14772913
Carrier: Toradex Dahlia V1.1A, Serial# 10870316

Optionally there would even be display adapters with potentially more model (serial) information.

Now with your change we get the following:

On Apalis/Colibri:

Model: Toradex Apalis iMX6Q/D Module on Apalis Evaluation Board
Model: Toradex Apalis iMX6 Quad 2GB IT
Model: Toradex 0028 Apalis iMX6Q 2GB IT V1.1D Serial#: 11211073

The first line gets printed from the information in the device tree, the second Line from the fall-back in our
board file (which so far was only used for the case when we failed reading the ConfigBlock) and the third and fourth lines are the previous information. Ugly, but so far so good.

On Verdin:

Model: Toradex Verdin iMX8M Plus WB on Verdin Development Board

Here only the device tree information gets printed and the ConfigBlock is not even read at all which subsequently fails detecting the variant (e.g. Wi-Fi vs. non-Wi-Fi) and later Ethernet fails due to an invalid
MAC address. This does not look good...

Anyway, I don't propose to just revert your work but instead looked into converting our previous show_board_info (now tdx_checkboard) to a proper sysinfo driver. The basics actually worked quite smoothly but
we would need more than just SYSINFO_ID_BOARD_MODEL, just like you do with CONFIG_SYSINFO_EXTRA. Of course, I could just do a CONFIG_SYSINFO_TORADEX, with e.g. SYSINFO_ID_BOARD_SERIAL and optionally SYSINFO_ID_BOARD_CARRIER or something but maybe a more generic way of extending sysinfo would make more sense.

What do you think?

Quoted 2 lines

Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

Unfortunately, as mentioned above, this does not quite lead to any desired behaviour.

Quoted 2 lines

Make all the checkboard() functions call the new tdx_checkboard() so that the same information is displayed.

Not quite.

Quoted 16 lines

---

 board/toradex/apalis-imx8/apalis-imx8.c         | 2 +- board/toradex/apalis-tk1/apalis-tk1.c           | 2 +- board/toradex/apalis_imx6/apalis_imx6.c         | 3 ++- board/toradex/apalis_t30/apalis_t30.c           | 2 +- board/toradex/colibri-imx6ull/colibri-imx6ull.c | 2 +- board/toradex/colibri-imx8x/colibri-imx8x.c     | 2 +- board/toradex/colibri_imx6/colibri_imx6.c       | 3 ++- board/toradex/colibri_imx7/colibri_imx7.c       | 2 +- board/toradex/colibri_t20/colibri_t20.c         | 2 +- board/toradex/colibri_t30/colibri_t30.c         | 2 +- board/toradex/colibri_vf/colibri_vf.c           | 2 +- board/toradex/common/tdx-common.c               | 2 +- board/toradex/common/tdx-common.h               | 1 +

Quoted 1 line
 13 files changed, 15 insertions(+), 12 deletions(-)

[snip]

Cheers

Marcel

#10 lore raw

Re: REGRESSION: [PATCH 5/9] toradex: Use checkboard() instead of show_board_info()

Quoted 1 line · Marcel Ziswiler

Gentle ping on this. Any opinion on that matter much appreciated. Thanks!

Perhaps you need to RFC some sysinfo driver that ends up providing what you expect?

Signature · 1 line
Tom
#11 lore raw

PATCH 6/9 udoo: Use checkboard() instead of show_board_info()

In reply to Simon Glass

Boards can use a sysinfo driver if a particular model name is needed. Update this board to use checkboard() directly, rather than having a weak function laid on top of a weak function.

---

 board/udoo/neo/neo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/udoo/neo/neo.c +1 -1
index 730e266469b2..d99d93b44ae5 100644
@@ -212,7 +212,7 @@ static char *board_string(int type)
 }
 
 /* Override the default implementation, DT model is not accurate */
-int show_board_info(void)
+int checkboard(void)
 {
 	int *board_type = (int *)OCRAM_START;
 
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#12 lore raw

PATCH 7/9 Revert "generic-board: make show_board_info a weak function"

In reply to Simon Glass

We already have:

- a sysinfo driver-interface which can obtain the model
- a weak function called checkboard() for showing board info

The current implementation has a weak function on top of a weak function. Now that all boards have been updated to use checkboard() instead, drop the __weak on show_board_info()

This reverts commit f7637cc01414b9c87b6b0f861f34d83c19bfaaaf.

---

 common/board_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_info.c +1 -1
index 3185793da4a7..a62c04794b90 100644
@@ -15,7 +15,7 @@ int __weak checkboard(void)
 	return 0;
 }
 
-int __weak show_board_info(void)
+int show_board_info(void)
 {
 	if (IS_ENABLED(CONFIG_OF_CONTROL)) {
 		struct udevice *dev;
Signature · 1 line
2.42.0.869.gea05f2083d-goog
Reviewed-by on v1 7/9
#13 lore raw

Re: [PATCH 7/9] Revert "generic-board: make show_board_info a weak function"

Quoted 5 lines · Simon Glass

We already have:

- a sysinfo driver-interface which can obtain the model
- a weak function called checkboard() for showing board info

Quoted 7 lines

The current implementation has a weak function on top of a weak function. Now that all boards have been updated to use checkboard() instead, drop the __weak on show_board_info()

This reverts commit f7637cc01414b9c87b6b0f861f34d83c19bfaaaf.

Signature · 1 line
Tom
#14 lore raw

PATCH 8/9 sysinfo: Allow displaying more info on startup

In reply to Simon Glass

At present only the model name is shown on start. Some boards want to display more information. Add some more options to allow display of the manufacturer as well as the version and date of any prior-stage firmware.

This is useful for coreboot, at least. If other boards have more information to display, it is easy to add it, now.

---

 common/board_info.c     | 72 +++++++++++++++++++++++++++++------------
 drivers/sysinfo/Kconfig |  7 ++++
 include/sysinfo.h       |  3 ++
 3 files changed, 61 insertions(+), 21 deletions(-)
common/board_info.c +51 -21
index a62c04794b90..f4c385add90c 100644
@@ -15,35 +15,65 @@ int __weak checkboard(void)
 	return 0;
 }
 
+static const struct to_show {
+	const char *name;
+	enum sysinfo_id id;
+} to_show[] = {
+	{ "Manufacturer", SYSINFO_ID_BOARD_MANUFACTURER},
+	{ "Prior-stage version", SYSINFO_ID_PRIOR_STAGE_VERSION },
+	{ "Prior-stage date", SYSINFO_ID_PRIOR_STAGE_DATE },
+	{ /* sentinel */ }
+};
+
+static int try_sysinfo(void)
+{
+	struct udevice *dev;
+	char str[80];
+	int ret;
+
+	/* This might provide more detail */
+	ret = sysinfo_get(&dev);
+	if (ret)
+		return ret;
+
+	ret = sysinfo_detect(dev);
+	if (ret)
+		return ret;
+
+	ret = sysinfo_get_str(dev, SYSINFO_ID_BOARD_MODEL, sizeof(str), str);
+	if (ret)
+		return ret;
+	printf("Model: %s\n", str);
+
+	if (IS_ENABLED(CONFIG_SYSINFO_EXTRA)) {
+		const struct to_show *item;
+
+		for (item = to_show; item->id; item++) {
+			ret = sysinfo_get_str(dev, item->id, sizeof(str), str);
+			if (!ret)
+				printf("%s: %s\n", item->name, str);
+		}
+	}
+
+	return 0;
+}
+
 int show_board_info(void)
 {
 	if (IS_ENABLED(CONFIG_OF_CONTROL)) {
-		struct udevice *dev;
-		const char *model;
-		char str[80];
 		int ret = -ENOSYS;
 
-		if (IS_ENABLED(CONFIG_SYSINFO)) {
-			/* This might provide more detail */
-			ret = sysinfo_get(&dev);
-			if (!ret) {
-				ret = sysinfo_detect(dev);
-				if (!ret) {
-					ret = sysinfo_get_str(dev,
-						      SYSINFO_ID_BOARD_MODEL,
-						      sizeof(str), str);
-				}
-			}
-		}
+		if (IS_ENABLED(CONFIG_SYSINFO))
+			ret = try_sysinfo();
 
 		/* Fail back to the main 'model' if available */
-		if (ret)
-			model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
-		else
-			model = str;
+		if (ret) {
+			const char *model;
 
-		if (model)
-			printf("Model: %s\n", model);
+			model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+			if (model)
+				printf("Model: %s\n", model);
+		}
 	}
 
 	return checkboard();
drivers/sysinfo/Kconfig +7 -0
index e35f7cb17914..2030e4babc9f 100644
@@ -8,6 +8,13 @@ menuconfig SYSINFO
 
 if SYSINFO
 
+config SYSINFO_EXTRA
+	bool "Show extra information on startup"
+	help
+	  Enable this to see extra information on startup. Normally only the
+	  model is shown, but with this option the vendor and any prior-stage
+	  firmware's version and date are shown as well.
+
 config SPL_SYSINFO
 	depends on SPL_DM
 	bool "Enable board driver support in SPL"
include/sysinfo.h +3 -0
index b140d742e93d..f2c1aa29d18e 100644
@@ -46,6 +46,9 @@ enum sysinfo_id {
 
 	/* For show_board_info() */
 	SYSINFO_ID_BOARD_MODEL,
+	SYSINFO_ID_BOARD_MANUFACTURER,
+	SYSINFO_ID_PRIOR_STAGE_VERSION,
+	SYSINFO_ID_PRIOR_STAGE_DATE,
 
 	/* First value available for downstream/board used */
 	SYSINFO_ID_USER = 0x1000,
Signature · 1 line
2.42.0.869.gea05f2083d-goog
#15 lore raw

PATCH 9/9 x86: coreboot: Add a sysinfo driver

In reply to Simon Glass

Create a sysinfo driver to avoid needing a custom checkboard() function. With this the following information is printed when booting from coreboot under QEMU:

Model: Standard PC (i440FX + PIIX, 1996)
Manufacturer: QEMU
Prior-stage version: 4.21-885-g2a87ef1eca56
Prior-stage date: 11/11/2023

---

 arch/x86/cpu/coreboot/Kconfig      |  2 +
 arch/x86/dts/coreboot.dts          |  4 ++
 board/coreboot/coreboot/Makefile   |  1 +
 board/coreboot/coreboot/coreboot.c | 44 ---------------
 board/coreboot/coreboot/sysinfo.c  | 89 ++++++++++++++++++++++++++++++
 5 files changed, 96 insertions(+), 44 deletions(-)
 create mode 100644 board/coreboot/coreboot/sysinfo.c
arch/x86/cpu/coreboot/Kconfig +2 -0
index 178f8ad18162..085302c04829 100644
@@ -27,5 +27,7 @@ config SYS_COREBOOT
 	imply X86_TSC_READ_BASE
 	imply USE_PREBOOT
 	select BINMAN if X86_64
+	select SYSINFO
+	imply SYSINFO_EXTRA
 
 endif
arch/x86/dts/coreboot.dts +4 -0
index 0eb31cae42c1..dfce7c2d5919 100644
@@ -45,4 +45,8 @@
 		bootph-some-ram;
 		compatible = "coreboot-fb";
 	};
+
+	sysinfo {
+		compatible = "coreboot,sysinfo";
+	};
 };
board/coreboot/coreboot/Makefile +1 -0
index d292b7032c23..75bfbd189437 100644
@@ -11,3 +11,4 @@
 # Daniel Engström, Omicron Ceti AB, [email protected].
 
 obj-y	+= coreboot.o
+obj-$(CONFIG_$(SPL_TPL_)SMBIOS_PARSER)	+= sysinfo.o
board/coreboot/coreboot/coreboot.c +0 -44

50 lines not on this page · raw message

board/coreboot/coreboot/sysinfo.c new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.42.0.869.gea05f2083d-goog
#16 lore raw
In reply to Simon Glass
Quoted 8 lines · Simon Glass

The show_board_info() function was adjusted to weak so that it could be entirely replaced with a board-specific implementation.

The intended way for boards to provide their own information is via a sysinfo driver. But currently there is no way to show anything other than the model name.

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom