From 85e490b22e89890c99660a13131aaeae52b249dd Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 28 Jan 2024 11:24:21 +0100 Subject: [PATCH 01/12] lib: smbios_entr() use logical or for booleans As a matter of programming style use logical or to combine two boolean results. Signed-off-by: Heinrich Schuchardt --- lib/smbios-parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smbios-parser.c b/lib/smbios-parser.c index f48d743657..0d1ac781b3 100644 --- a/lib/smbios-parser.c +++ b/lib/smbios-parser.c @@ -15,7 +15,7 @@ const struct smbios_entry *smbios_entry(u64 address, u32 size) { const struct smbios_entry *entry = (struct smbios_entry *)(uintptr_t)address; - if (!address | !size) + if (!address || !size) return NULL; if (memcmp(entry->anchor, "_SM_", 4)) From b327e64d5f541072d6a5051c05e5d55440a9038b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 13:58:18 +0100 Subject: [PATCH 02/12] smbios: get_str_from_dt() - add sysinfo_id description Add description for parameter sysinfo_id of function get_str_from_dt(). Fixes: 07c9e683a484 ("smbios: Allow a few values to come from sysinfo") Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/smbios.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/smbios.c b/lib/smbios.c index 7bd9805fec..11b7611a84 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -207,6 +207,7 @@ void get_str_from_dt(const struct map_sysinfo *nprop, char *str, size_t size) * * @ctx: context for writing the tables * @prop: property to write + * @sysinfo_id: unique identifier for the string value to be read * @dval: Default value to use if the string is not found or is empty * Return: 0 if not found, else SMBIOS string number (1 or more) */ From 7ca4b0ea6a5135cdf1e44fa6b338301e50e2af24 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 18:09:50 +0100 Subject: [PATCH 03/12] cmd: smbios: always use '0x%04x' for printing handles Handles are u16 numbers. Consistently use '0x%04x' to print them. Signed-off-by: Heinrich Schuchardt --- cmd/smbios.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index feebf930b7..67f3a9f5f1 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -95,9 +95,9 @@ static void smbios_print_type2(struct smbios_type2 *table) smbios_print_str("Version", table, table->version); smbios_print_str("Serial Number", table, table->serial_number); smbios_print_str("Asset Tag", table, table->asset_tag_number); - printf("\tFeature Flags: 0x%2x\n", table->feature_flags); + printf("\tFeature Flags: 0x%04x\n", table->feature_flags); smbios_print_str("Chassis Location", table, table->chassis_location); - printf("\tChassis Handle: 0x%2x\n", table->chassis_handle); + printf("\tChassis Handle: 0x%04x\n", table->chassis_handle); smbios_print_str("Board Type", table, table->board_type); printf("\tContained Object Handles: "); handle = (void *)table->eos; From e799f8a48d1d4930402078a766dd9e999e63471b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 18:51:24 +0100 Subject: [PATCH 04/12] cmd: smbios: add missing colon after UUID For consistent formatting add a colon ':' after the UUID label. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- cmd/smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index 67f3a9f5f1..62935ecd1a 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -76,7 +76,7 @@ static void smbios_print_type1(struct smbios_type1 *table) smbios_print_str("Version", table, table->version); smbios_print_str("Serial Number", table, table->serial_number); if (table->length >= 0x19) { - printf("\tUUID %pUl\n", table->uuid); + printf("\tUUID: %pUl\n", table->uuid); smbios_print_str("Wake Up Type", table, table->serial_number); } if (table->length >= 0x1b) { From c11f176ab16a3488c0b057fed41d76ef96091564 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 18:01:27 +0100 Subject: [PATCH 05/12] cmd: smbios: replace missing string by 'Not Specified' A missing string value is indicated by a string index of 0. In this case print 'Not Specified' like the Linux dmidecode command does. Signed-off-by: Heinrich Schuchardt --- cmd/smbios.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index 62935ecd1a..95bdff6026 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -25,6 +25,10 @@ static const char *smbios_get_string(void *table, int index) { const char *str = (char *)table + ((struct smbios_header *)table)->length; + static const char fallback[] = "Not Specified"; + + if (!index) + return fallback; if (!*str) ++str; @@ -41,7 +45,7 @@ static struct smbios_header *next_table(struct smbios_header *table) if (table->type == SMBIOS_END_OF_TABLE) return NULL; - str = smbios_get_string(table, 0); + str = smbios_get_string(table, -1); return (struct smbios_header *)(++str); } From e31efe50b5cce46a2ee68c96db445e0a3d481aa8 Mon Sep 17 00:00:00 2001 From: Matthias Brugger Date: Tue, 6 Apr 2021 11:04:35 +0200 Subject: [PATCH 06/12] smbios: Fix table when no string is present When no string is present in a table, next_ptr points to the same location as eos. When calculating the string table length, we would only reserve one \0. By spec a SMBIOS table has to end with two \0\0 when no strings a present. Signed-off-by: Matthias Brugger Reviewed-by: Heinrich Schuchardt --- lib/smbios.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/smbios.c b/lib/smbios.c index 11b7611a84..0ae857855e 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -312,6 +312,10 @@ int smbios_update_version(const char *version) */ static int smbios_string_table_len(const struct smbios_ctx *ctx) { + /* In case no string is defined we have to return two \0 */ + if (ctx->next_ptr == ctx->eos) + return 2; + /* Allow for the final \0 after all strings */ return (ctx->next_ptr + 1) - ctx->eos; } From 6ebf9136ec24c03f6ebeb6ec6d684ce55c2a4320 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 14:09:36 +0100 Subject: [PATCH 07/12] smbios: if a string value is unknown, use string number 0 The SMBIOS specification describes: "If a string field references no string, a null (0) is placed in that string field." Accordingly we should avoid writing a string "Unknown" to the SMBIOS table. dmidecode displays 'Not Specified' if the string number is 0. Commit 00a871d34e2f ("smbios: empty strings in smbios_add_string()") correctly identified that strings may not have length 0 as two consecutive NULs indentify the end of the string list. But the suggested solution did not match the intent of the SMBIOS specification. Fixes: 00a871d34e2f ("smbios: empty strings in smbios_add_string()") Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- lib/smbios.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/smbios.c b/lib/smbios.c index 0ae857855e..6190c168f2 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -135,13 +135,16 @@ static const struct map_sysinfo *convert_sysinfo_to_dt(const char *node, const c * * @ctx: SMBIOS context * @str: string to add - * Return: string number in the string area (1 or more) + * Return: string number in the string area. 0 if str is NULL. */ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) { int i = 1; char *p = ctx->eos; + if (!str) + return 0; + for (;;) { if (!*p) { ctx->last_str = p; @@ -217,7 +220,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, int ret; if (!dval || !*dval) - dval = "Unknown"; + dval = NULL; if (!prop) return smbios_add_string(ctx, dval); @@ -380,19 +383,19 @@ static int smbios_write_type1(ulong *current, int handle, memset(t, 0, sizeof(struct smbios_type1)); fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); - t->product_name = smbios_add_prop(ctx, "product", "Unknown"); + t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL); + t->product_name = smbios_add_prop(ctx, "product", NULL); t->version = smbios_add_prop_si(ctx, "version", SYSINFO_ID_SMBIOS_SYSTEM_VERSION, - "Unknown"); + NULL); if (serial_str) { t->serial_number = smbios_add_prop(ctx, NULL, serial_str); strncpy((char *)t->uuid, serial_str, sizeof(t->uuid)); } else { - t->serial_number = smbios_add_prop(ctx, "serial", "Unknown"); + t->serial_number = smbios_add_prop(ctx, "serial", NULL); } - t->sku_number = smbios_add_prop(ctx, "sku", "Unknown"); - t->family = smbios_add_prop(ctx, "family", "Unknown"); + t->sku_number = smbios_add_prop(ctx, "sku", NULL); + t->family = smbios_add_prop(ctx, "family", NULL); len = t->length + smbios_string_table_len(ctx); *current += len; @@ -411,12 +414,12 @@ static int smbios_write_type2(ulong *current, int handle, memset(t, 0, sizeof(struct smbios_type2)); fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); - t->product_name = smbios_add_prop(ctx, "product", "Unknown"); + t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL); + t->product_name = smbios_add_prop(ctx, "product", NULL); t->version = smbios_add_prop_si(ctx, "version", SYSINFO_ID_SMBIOS_BASEBOARD_VERSION, - "Unknown"); - t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", "Unknown"); + NULL); + t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", NULL); t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING; t->board_type = SMBIOS_BOARD_MOTHERBOARD; @@ -437,7 +440,7 @@ static int smbios_write_type3(ulong *current, int handle, memset(t, 0, sizeof(struct smbios_type3)); fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); + t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL); t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; t->bootup_state = SMBIOS_STATE_SAFE; t->power_supply_state = SMBIOS_STATE_SAFE; @@ -455,8 +458,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t, struct smbios_ctx *ctx) { u16 processor_family = SMBIOS_PROCESSOR_FAMILY_UNKNOWN; - const char *vendor = "Unknown"; - const char *name = "Unknown"; + const char *vendor = NULL; + const char *name = NULL; #ifdef CONFIG_CPU char processor_name[49]; From 545e0e42b966751da48117820891356ccf47baf1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 12:46:05 +0100 Subject: [PATCH 08/12] smbios: provide type 4 RISC-V SMBIOS Processor ID For RISC-V CPUs the SMBIOS Processor ID field contains the Machine Vendor ID from CSR mvendorid. Signed-off-by: Heinrich Schuchardt --- drivers/cpu/riscv_cpu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index a9b253719f..5d1026b37d 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -94,13 +95,24 @@ static int riscv_cpu_bind(struct udevice *dev) struct cpu_plat *plat = dev_get_parent_plat(dev); struct driver *drv; int ret; + long mvendorid; /* save the hart id */ plat->cpu_id = dev_read_addr(dev); + /* provide data for SMBIOS */ if (IS_ENABLED(CONFIG_64BIT)) plat->family = 0x201; else plat->family = 0x200; + if (CONFIG_IS_ENABLED(RISCV_SMODE)) { + /* + * For RISC-V CPUs the SMBIOS Processor ID field contains + * the Machine Vendor ID from CSR mvendorid. + */ + ret = sbi_get_mvendorid(&mvendorid); + if (!ret) + plat->id[0] = mvendorid; + } /* first examine the property in current cpu node */ ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq); /* if not found, then look at the parent /cpus node */ From 5778c88eb094079502acad632febde7ff0d5b146 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 29 Jan 2024 18:32:58 +0100 Subject: [PATCH 09/12] smbios: correctly fill chassis handle The chassis handle field in the type 2 structure must point to the handle of the type 3 structure. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas --- lib/smbios.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/smbios.c b/lib/smbios.c index 6190c168f2..cd750cc218 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -422,6 +422,7 @@ static int smbios_write_type2(ulong *current, int handle, t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", NULL); t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING; t->board_type = SMBIOS_BOARD_MOTHERBOARD; + t->chassis_handle = handle + 1; len = t->length + smbios_string_table_len(ctx); *current += len; @@ -550,6 +551,7 @@ static struct smbios_write_method smbios_write_funcs[] = { { smbios_write_type0, "bios", }, { smbios_write_type1, "system", }, { smbios_write_type2, "baseboard", }, + /* Type 3 must immediately follow type 2 due to chassis handle. */ { smbios_write_type3, "chassis", }, { smbios_write_type4, }, { smbios_write_type32, }, From 551bc96be51c183ee90770bec985990bc6bcc4ad Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 31 Jan 2024 23:34:46 +0100 Subject: [PATCH 10/12] cmd: smbios: show correct table size for SMBIOS2.1 entry point The SMBIOS table size for SMBIOS2.1 entry points is in field 'Structure Table Length' (offset 0x16) and not in field 'Maximum Structure Size' (offset 0x08). Rename the receiving variable max_struct_size to table_maximum_size to avoid future confusion. Signed-off-by: Heinrich Schuchardt --- cmd/smbios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index 95bdff6026..e2d82be163 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -126,7 +126,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc, static const char smbios_sig[] = "_SM_"; static const char smbios3_sig[] = "_SM3_"; size_t count = 0; - u32 max_struct_size; + u32 table_maximum_size; addr = gd_smbios_start(); if (!addr) { @@ -142,7 +142,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc, entry3->major_ver, entry3->minor_ver, entry3->doc_rev); table = (void *)(uintptr_t)entry3->struct_table_address; size = entry3->length; - max_struct_size = entry3->max_struct_size; + table_maximum_size = entry3->max_struct_size; } else if (!memcmp(entry, smbios_sig, sizeof(smbios_sig) - 1)) { struct smbios_entry *entry2 = entry; @@ -150,7 +150,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc, entry2->major_ver, entry2->minor_ver); table = (void *)(uintptr_t)entry2->struct_table_address; size = entry2->length; - max_struct_size = entry2->max_struct_size; + table_maximum_size = entry2->struct_table_length; } else { log_err("Unknown SMBIOS anchor format\n"); return CMD_RET_FAILURE; @@ -163,7 +163,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc, for (struct smbios_header *pos = table; pos; pos = next_table(pos)) ++count; - printf("%zd structures occupying %d bytes\n", count, max_struct_size); + printf("%zd structures occupying %d bytes\n", count, table_maximum_size); printf("Table at 0x%llx\n", (unsigned long long)map_to_sysmem(table)); for (struct smbios_header *pos = table; pos; pos = next_table(pos)) { From e494258deddcae4a6805abfbb643b2fdc8ac3736 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 31 Jan 2024 23:42:35 +0100 Subject: [PATCH 11/12] smbios: do not determine maximum structure size Only the SMBIOS 2.1 entry point has a field for the maximum structure size. As we have switched to an SMBIOS 3 entry point remove the superfluous calculation. Signed-off-by: Heinrich Schuchardt --- lib/smbios.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/smbios.c b/lib/smbios.c index cd750cc218..327f78c8b0 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -566,7 +566,6 @@ ulong write_smbios_table(ulong addr) struct smbios_ctx ctx; ulong tables; int len = 0; - int max_struct_size = 0; int handle = 0; int i; @@ -588,7 +587,6 @@ ulong write_smbios_table(ulong addr) /* populate minimum required tables */ for (i = 0; i < ARRAY_SIZE(smbios_write_funcs); i++) { const struct smbios_write_method *method; - int tmp; method = &smbios_write_funcs[i]; ctx.subnode_name = NULL; @@ -598,10 +596,7 @@ ulong write_smbios_table(ulong addr) ctx.node = ofnode_find_subnode(parent_node, method->subnode_name); } - tmp = method->write((ulong *)&addr, handle++, &ctx); - - max_struct_size = max(max_struct_size, tmp); - len += tmp; + len += method->write((ulong *)&addr, handle++, &ctx); } /* From 406c410ef747d66e16f2f5494cbf88ba1307224f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 31 Jan 2024 23:49:34 +0100 Subject: [PATCH 12/12] smbios: correctly name Structure Table Maximum Size field In the SMBIOS 3 entry point the Structure Table Maximum Size field was incorrectly named max_struct_size. A Maximum Structure Size field only exists in the SMBIOS 2.1 entry point and has a different meaning. Call the Structure Table Length field table_maximum_size. Signed-off-by: Heinrich Schuchardt --- cmd/smbios.c | 2 +- drivers/misc/qfw_smbios.c | 2 +- include/smbios.h | 2 +- lib/efi_loader/efi_tcg2.c | 4 ++-- lib/efi_loader/smbiosdump.c | 6 +++--- lib/smbios-parser.c | 2 +- lib/smbios.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index e2d82be163..66f6b76137 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -142,7 +142,7 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc, entry3->major_ver, entry3->minor_ver, entry3->doc_rev); table = (void *)(uintptr_t)entry3->struct_table_address; size = entry3->length; - table_maximum_size = entry3->max_struct_size; + table_maximum_size = entry3->table_maximum_size; } else if (!memcmp(entry, smbios_sig, sizeof(smbios_sig) - 1)) { struct smbios_entry *entry2 = entry; diff --git a/drivers/misc/qfw_smbios.c b/drivers/misc/qfw_smbios.c index a898cb4eea..c3e8c310d0 100644 --- a/drivers/misc/qfw_smbios.c +++ b/drivers/misc/qfw_smbios.c @@ -90,7 +90,7 @@ static int qfw_parse_smbios_anchor(struct udevice *dev, entry->length = sizeof(struct smbios3_entry); entry->major_ver = entry2->major_ver; entry->minor_ver = entry2->minor_ver; - entry->max_struct_size = entry2->struct_table_length; + entry->table_maximum_size = entry2->struct_table_length; } else { ret = -ENOENT; goto out; diff --git a/include/smbios.h b/include/smbios.h index e2b7f69584..3df8827b60 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -75,7 +75,7 @@ struct __packed smbios3_entry { /** @reserved: reserved */ u8 reserved; /** maximum size of SMBIOS table */ - u32 max_struct_size; + u32 table_maximum_size; /** @struct_table_address: 64-bit physical starting address */ u64 struct_table_address; }; diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index b5d4aa7be5..b07e0099c2 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1098,7 +1098,7 @@ tcg2_measure_smbios(struct udevice *dev, */ event_size = sizeof(struct smbios_handoff_table_pointers2) + FIELD_SIZEOF(struct efi_configuration_table, guid) + - entry->max_struct_size; + entry->table_maximum_size; event = calloc(1, event_size); if (!event) { ret = EFI_OUT_OF_RESOURCES; @@ -1113,7 +1113,7 @@ tcg2_measure_smbios(struct udevice *dev, smbios_copy = (struct smbios_header *)((uintptr_t)&event->table_entry[0].table); memcpy(&event->table_entry[0].table, (void *)((uintptr_t)entry->struct_table_address), - entry->max_struct_size); + entry->table_maximum_size); smbios_prepare_measurement(entry, smbios_copy); diff --git a/lib/efi_loader/smbiosdump.c b/lib/efi_loader/smbiosdump.c index f0b901897e..2f0b91a353 100644 --- a/lib/efi_loader/smbiosdump.c +++ b/lib/efi_loader/smbiosdump.c @@ -329,7 +329,7 @@ efi_status_t do_check(void) return EFI_LOAD_ERROR; } table = (void *)(uintptr_t)smbios3_anchor->struct_table_address; - len = smbios3_anchor->max_struct_size; + len = smbios3_anchor->table_maximum_size; } else { struct smbios_entry *smbios_anchor; int r; @@ -469,7 +469,7 @@ static efi_status_t do_save(u16 *filename) smbios3_anchor = get_config_table(&smbios3_guid); if (smbios3_anchor) { - size = 0x20 + smbios3_anchor->max_struct_size; + size = 0x20 + smbios3_anchor->table_maximum_size; ret = bs->allocate_pool(EFI_LOADER_DATA, size, (void **)&buf); if (ret != EFI_SUCCESS) { error(u"Out of memory\n"); @@ -480,7 +480,7 @@ static efi_status_t do_save(u16 *filename) memcpy(buf, smbios3_anchor, smbios3_anchor->length); memcpy(buf + 0x20, (void *)(uintptr_t)smbios3_anchor->struct_table_address, - smbios3_anchor->max_struct_size); + smbios3_anchor->table_maximum_size); smbios3_anchor = (struct smbios3_entry *)buf; smbios3_anchor->struct_table_address = 0x20; diff --git a/lib/smbios-parser.c b/lib/smbios-parser.c index 0d1ac781b3..9a62b3c760 100644 --- a/lib/smbios-parser.c +++ b/lib/smbios-parser.c @@ -230,7 +230,7 @@ void smbios_prepare_measurement(const struct smbios3_entry *entry, void *table_end; struct smbios_header *header; - table_end = (void *)((u8 *)smbios_copy + entry->max_struct_size); + table_end = (void *)((u8 *)smbios_copy + entry->table_maximum_size); for (i = 0; i < ARRAY_SIZE(smbios_filter_tables); i++) { header = smbios_copy; diff --git a/lib/smbios.c b/lib/smbios.c index 327f78c8b0..c83af730a9 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -615,7 +615,7 @@ ulong write_smbios_table(ulong addr) se->minor_ver = SMBIOS_MINOR_VER; se->doc_rev = 0; se->entry_point_rev = 1; - se->max_struct_size = len; + se->table_maximum_size = len; se->struct_table_address = table_addr; se->checksum = table_compute_checksum(se, sizeof(struct smbios3_entry)); unmap_sysmem(se);