[PATCH v2 11/13] smbios: Fill UUID from sysinfo when available

Simon Glass sjg at chromium.org
Tue Oct 22 19:00:25 CEST 2024


On Tue, 22 Oct 2024 at 08:06, Jan Kiszka <jan.kiszka at siemens.com> wrote:
>
> From: Jan Kiszka <jan.kiszka at siemens.com>
>
> Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will
> be first used by the IOT2050 boards.
>
> Based on original patch by Li Hua Qian.
>
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> ---
>  include/sysinfo.h | 1 +
>  lib/smbios.c      | 4 ++++
>  2 files changed, 5 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>

What is this used for? Would you mind adding a comment for it? Should
mention that it is a struct uuid

>
> diff --git a/include/sysinfo.h b/include/sysinfo.h
> index 8a77ef44856..1c5008b5f23 100644
> --- a/include/sysinfo.h
> +++ b/include/sysinfo.h
> @@ -49,6 +49,7 @@ enum sysinfo_id {
>         SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
>         SYSINFO_ID_SMBIOS_SYSTEM_SKU,
>         SYSINFO_ID_SMBIOS_SYSTEM_FAMILY,
> +       SYSINFO_ID_SMBIOS_SYSTEM_UUID,
>         SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
>         SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
>         SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
> diff --git a/lib/smbios.c b/lib/smbios.c
> index 7c24ea129eb..1441fa4cde6 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,
>         struct smbios_type1 *t;
>         int len = sizeof(struct smbios_type1);
>         char *serial_str = env_get("serial#");
> +       char uuid[sizeof(t->uuid)];
>
>         t = map_sysmem(*current, len);
>         memset(t, 0, sizeof(struct smbios_type1));
> @@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,
>                                                       SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
>                                                       NULL);
>         }
> +       if (!sysinfo_get_str(ctx->dev, SYSINFO_ID_SMBIOS_SYSTEM_UUID,
> +                            sizeof(uuid), uuid))
> +               strncpy((char *)t->uuid, uuid, sizeof(t->uuid));
>         t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
>         t->sku_number = smbios_add_prop_si(ctx, "sku",
>                                            SYSINFO_ID_SMBIOS_SYSTEM_SKU, NULL);
> --
> 2.43.0
>

Regards,
SImon


More information about the U-Boot mailing list