uboot-tools/smbios-test-dmi.patch

52 lines
2.3 KiB
Diff

diff --git a/lib/smbios.c b/lib/smbios.c
index d7f4999e8b..0ceb758cb1 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -281,9 +281,13 @@ 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_prop(ctx, "compatible");
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_prop(ctx, "model");
if (!t->product_name)
t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
@@ -315,9 +319,13 @@ 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_prop(ctx, "compatible");
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_prop(ctx, "model");
if (!t->product_name)
t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
@@ -344,6 +352,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_prop(ctx, "compatible");
if (!t->manufacturer)
t->manufacturer = smbios_add_string(ctx, "Unknown");
t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
@@ -503,6 +513,9 @@ ulong write_smbios_table(ulong addr)
if (IS_ENABLED(CONFIG_OF_CONTROL) && method->subnode_name)
ctx.node = ofnode_find_subnode(parent_node,
method->subnode_name);
+ /* If we can't find any smbios node fallback to the entire DT */
+ if (!ofnode_valid(ctx.node))
+ ctx.node = ofnode_root();
tmp = method->write((ulong *)&addr, handle++, &ctx);
max_struct_size = max(max_struct_size, tmp);