@@ -4,6 +4,53 @@
*/
#include <common.h>
+#include <smbios.h>
+
+int show_board_info(void)
+{
+ struct smbios_parser *p = smbios_parser_create(0xF0000, 0x10000);
+
+ if (!p)
+ goto fallback;
+
+ const struct smbios_header *bios = smbios_header(p, SMBIOS_BIOS_INFORMATION);
+ const struct smbios_header *system = smbios_header(p, SMBIOS_SYSTEM_INFORMATION);
+ const struct smbios_type0 *t0 = (struct smbios_type0 *)bios;
+ const struct smbios_type1 *t1 = (struct smbios_type1 *)system;
+
+ if (!t0 || !t1)
+ goto fallback;
+
+ const char *bios_ver = smbios_string(bios, t0->bios_ver);
+ const char *model = smbios_string(system, t1->product_name);
+ const char *manufacturer = smbios_string(system, t1->manufacturer);
+
+ if (!model || !manufacturer || !bios_ver)
+ goto fallback;
+
+ printf("Vendor: %s\n", manufacturer);
+ printf("Model: %s\n", model);
+ printf("Bios Version: %s\n", bios_ver);
+
+ smbios_parser_destroy(p);
+
+ return 0;
+
+fallback:
+
+ smbios_parser_destroy(p);
+
+#ifdef CONFIG_OF_CONTROL
+ DECLARE_GLOBAL_DATA_PTR;
+
+ model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+
+ if (model)
+ printf("Model: %s\n", model);
+#endif
+
+ return checkboard();
+}
int board_early_init_r(void)
{
@@ -39,3 +39,4 @@ CONFIG_SYSCON=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_SMBIOS_PARSER=y
If u-boot gets used as coreboot payload it might be nice to get vendor, model and bios version from smbios. I am not sure about the output of all the read information. With qemu target for coreboot this could look this: CBFS: 'Master Header Locator' located CBFS at [7a0200:800000) CBFS: Locating 'fallback/payload' CBFS: Found @ offset 13000 size 36ae4 Checking segment from ROM address 0xfffb3238 Checking segment from ROM address 0xfffb3254 Loading segment from ROM address 0xfffb3238 code (compression=1) New segment dstaddr 0x01110000 memsize 0x7c7bb srcaddr 0xfffb3270 filesize 0x36aac Loading Segment: addr: 0x01110000 memsz: 0x000000000007c7bb filesz: 0x0000000000036aac using LZMA Loading segment from ROM address 0xfffb3254 Entry Point 0x01110015 Jumping to boot code at 01110015(07fa8000) U-Boot 2019.04-00337-ga602a0489f-dirty (Apr 16 2019 - 13:30:50 +0200) CPU: x86, vendor Intel, device 663h DRAM: 127.4 MiB MMC: Video: No video mode configured in coreboot! Video: No video mode configured in coreboot! Vendor: QEMU Model: Standard PC (i440FX + PIIX, 1996) Bios Version: 4.9-1324-ge2f0a5f76c-dirty Net: e1000: 52:54:00:12:34:56 Warning: e1000#0 using MAC address from ROM eth0: e1000#0 No working controllers found Finalizing coreboot Hit any key to stop autoboot: 0 Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> --- board/coreboot/coreboot/coreboot.c | 47 ++++++++++++++++++++++++++++++ configs/coreboot_defconfig | 1 + 2 files changed, 48 insertions(+)