mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 22:36:05 +00:00
lib: smbios: Detect system properties via SYSINFO IDs
Code is pretty much supports only DT properties and completely ignore information coming from sysinfo driver. Code is calling smbios_add_prop() which calls with smbios_add_prop_si(SYSINFO_ID_NONE). But SYSINFO_ID_NONE can't differentiate different entries from sysinfo driver. That's why introduce separate SYSINFO macros which can be used in sysinfo driver and passed to smbios structure. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
85df7f173c
commit
a5a5756285
2 changed files with 35 additions and 8 deletions
|
@ -43,8 +43,17 @@ enum sysinfo_id {
|
||||||
SYSINFO_ID_NONE,
|
SYSINFO_ID_NONE,
|
||||||
|
|
||||||
/* For SMBIOS tables */
|
/* For SMBIOS tables */
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_MANUFACTURER,
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_PRODUCT,
|
||||||
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
|
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_SKU,
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_FAMILY,
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
|
||||||
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
|
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_SERIAL,
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_ASSET_TAG,
|
||||||
|
|
||||||
/* For show_board_info() */
|
/* For show_board_info() */
|
||||||
SYSINFO_ID_BOARD_MODEL,
|
SYSINFO_ID_BOARD_MODEL,
|
||||||
|
|
34
lib/smbios.c
34
lib/smbios.c
|
@ -383,8 +383,12 @@ static int smbios_write_type1(ulong *current, int handle,
|
||||||
memset(t, 0, sizeof(struct smbios_type1));
|
memset(t, 0, sizeof(struct smbios_type1));
|
||||||
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
|
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
|
||||||
smbios_set_eos(ctx, t->eos);
|
smbios_set_eos(ctx, t->eos);
|
||||||
t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
|
t->manufacturer = smbios_add_prop_si(ctx, "manufacturer",
|
||||||
t->product_name = smbios_add_prop(ctx, "product", NULL);
|
SYSINFO_ID_SMBIOS_SYSTEM_MANUFACTURER,
|
||||||
|
NULL);
|
||||||
|
t->product_name = smbios_add_prop_si(ctx, "product",
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_PRODUCT,
|
||||||
|
NULL);
|
||||||
t->version = smbios_add_prop_si(ctx, "version",
|
t->version = smbios_add_prop_si(ctx, "version",
|
||||||
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
|
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -392,11 +396,15 @@ static int smbios_write_type1(ulong *current, int handle,
|
||||||
t->serial_number = smbios_add_prop(ctx, NULL, serial_str);
|
t->serial_number = smbios_add_prop(ctx, NULL, serial_str);
|
||||||
strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
|
strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
|
||||||
} else {
|
} else {
|
||||||
t->serial_number = smbios_add_prop(ctx, "serial", NULL);
|
t->serial_number = smbios_add_prop_si(ctx, "serial",
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
|
t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
|
||||||
t->sku_number = smbios_add_prop(ctx, "sku", NULL);
|
t->sku_number = smbios_add_prop_si(ctx, "sku",
|
||||||
t->family = smbios_add_prop(ctx, "family", NULL);
|
SYSINFO_ID_SMBIOS_SYSTEM_SKU, NULL);
|
||||||
|
t->family = smbios_add_prop_si(ctx, "family",
|
||||||
|
SYSINFO_ID_SMBIOS_SYSTEM_FAMILY, NULL);
|
||||||
|
|
||||||
len = t->length + smbios_string_table_len(ctx);
|
len = t->length + smbios_string_table_len(ctx);
|
||||||
*current += len;
|
*current += len;
|
||||||
|
@ -415,12 +423,22 @@ static int smbios_write_type2(ulong *current, int handle,
|
||||||
memset(t, 0, sizeof(struct smbios_type2));
|
memset(t, 0, sizeof(struct smbios_type2));
|
||||||
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
|
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
|
||||||
smbios_set_eos(ctx, t->eos);
|
smbios_set_eos(ctx, t->eos);
|
||||||
t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
|
t->manufacturer = smbios_add_prop_si(ctx, "manufacturer",
|
||||||
t->product_name = smbios_add_prop(ctx, "product", NULL);
|
SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
|
||||||
|
NULL);
|
||||||
|
t->product_name = smbios_add_prop_si(ctx, "product",
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
|
||||||
|
NULL);
|
||||||
t->version = smbios_add_prop_si(ctx, "version",
|
t->version = smbios_add_prop_si(ctx, "version",
|
||||||
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
|
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
|
||||||
NULL);
|
NULL);
|
||||||
t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", NULL);
|
|
||||||
|
t->serial_number = smbios_add_prop_si(ctx, "serial",
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_SERIAL,
|
||||||
|
NULL);
|
||||||
|
t->asset_tag_number = smbios_add_prop_si(ctx, "asset-tag",
|
||||||
|
SYSINFO_ID_SMBIOS_BASEBOARD_ASSET_TAG,
|
||||||
|
NULL);
|
||||||
t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
|
t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
|
||||||
t->board_type = SMBIOS_BOARD_MOTHERBOARD;
|
t->board_type = SMBIOS_BOARD_MOTHERBOARD;
|
||||||
t->chassis_handle = handle + 1;
|
t->chassis_handle = handle + 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue