aboutsummaryrefslogtreecommitdiff
path: root/lib/smbios.c
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2021-06-10 12:33:15 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-06-28 19:57:13 +0200
commit70e80666f26a516096f3787e884d42818d8b4087 (patch)
tree3cc0568466792482908eb229eb2743bdacbcd5ba /lib/smbios.c
parentff192304b69944734a661227c2d00aab5b15cdaf (diff)
downloadu-boot-70e80666f26a516096f3787e884d42818d8b4087.zip
u-boot-70e80666f26a516096f3787e884d42818d8b4087.tar.gz
u-boot-70e80666f26a516096f3787e884d42818d8b4087.tar.bz2
smbios: Fix SMBIOS tables
Commit e4f8e543f1a9("smbios: Drop the unused Kconfig options") break SMBIOS tables. The reason is that the patch drops the Kconfig options *after* removing the code using them, but that changes the semantics of the code completely. Prior to the change a non NULL value was used in the 'product' and 'manufacturer ' fields. Chapter 6.2 of the DMTF spec requires Manufacturer and Product Name to be non-null on some of the tables. So let's add sane defaults for Type1/2/3. * Before the patchset: <snip> Handle 0x0002, DMI type 2, 14 bytes Base Board Information Manufacturer: Not Specified Product Name: Not Specified Version: Not Specified Serial Number: Not Specified Asset Tag: Not Specified Features: Board is a hosting board Location In Chassis: Not Specified Chassis Handle: 0x0000 Type: Motherboard Invalid entry length (0). DMI table is broken! Stop. * After the patchset: <snip> Handle 0x0005, DMI type 32, 11 bytes System Boot Information Status: No errors detected Handle 0x0006, DMI type 127, 4 bytes End Of Table Fixes: e4f8e543f1a9 ("smbios: Drop the unused Kconfig options") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib/smbios.c')
-rw-r--r--lib/smbios.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/smbios.c b/lib/smbios.c
index b69f5e8..b52e125 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -258,7 +258,11 @@ static int smbios_write_type1(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+ if (!t->manufacturer)
+ t->manufacturer = smbios_add_string(ctx, "Unknown");
t->product_name = smbios_add_prop(ctx, "product");
+ if (!t->product_name)
+ t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_SYSTEM_VERSION);
if (serial_str) {
@@ -288,7 +292,11 @@ static int smbios_write_type2(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+ if (!t->manufacturer)
+ t->manufacturer = smbios_add_string(ctx, "Unknown");
t->product_name = smbios_add_prop(ctx, "product");
+ if (!t->product_name)
+ t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION);
t->asset_tag_number = smbios_add_prop(ctx, "asset-tag");
@@ -313,6 +321,8 @@ static int smbios_write_type3(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+ if (!t->manufacturer)
+ t->manufacturer = smbios_add_string(ctx, "Unknown");
t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
t->bootup_state = SMBIOS_STATE_SAFE;
t->power_supply_state = SMBIOS_STATE_SAFE;