smbios: Fill UUID from sysinfo when available
authorBaocheng Su <baocheng.su@siemens.com>
Tue, 18 Feb 2025 02:36:10 +0000 (10:36 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 28 Feb 2025 14:41:54 +0000 (08:41 -0600)
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will
be first used by the IOT2050 boards.

Signed-off-by: Li Hua Qian <huaqian.li@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Baocheng Su <baocheng.su@siemens.com>
include/sysinfo.h
lib/smbios.c

index ba2ac27..14e923c 100644 (file)
@@ -57,6 +57,7 @@ enum sysinfo_id {
        SYSID_SM_SYSTEM_WAKEUP,
        SYSID_SM_SYSTEM_SKU,
        SYSID_SM_SYSTEM_FAMILY,
+       SYSID_SM_SYSTEM_UUID,
 
        /* Baseboard (or Module) Information (Type 2) */
        SYSID_SM_BASEBOARD_MANUFACTURER,
index 78cee8c..7c9701a 100644 (file)
@@ -429,6 +429,8 @@ static int smbios_write_type1(ulong *current, int handle,
        struct smbios_type1 *t;
        int len = sizeof(*t);
        char *serial_str = env_get("serial#");
+       size_t uuid_len;
+       void *uuid;
 
        t = map_sysmem(*current, len);
        memset(t, 0, len);
@@ -450,6 +452,10 @@ static int smbios_write_type1(ulong *current, int handle,
                                                      SYSID_SM_SYSTEM_SERIAL,
                                                      NULL);
        }
+       if (!sysinfo_get_data(ctx->dev, SYSID_SM_SYSTEM_UUID, &uuid,
+                             &uuid_len) &&
+           uuid_len == sizeof(t->uuid))
+               memcpy(t->uuid, uuid, sizeof(t->uuid));
        t->wakeup_type = smbios_get_val_si(ctx, "wakeup-type",
                                           SYSID_SM_SYSTEM_WAKEUP,
                                           SMBIOS_WAKEUP_TYPE_UNKNOWN);